Class or Function Names
- WhaleOptimizationSampler
Example
from __future__ import annotations
import matplotlib.pyplot as plt
import optuna
import optunahub
WhaleOptimizationSampler = optunahub.load_module(
"samplers/whale_optimization"
).WhaleOptimizationSampler
if __name__ == "__main__":
def objective(trial: optuna.trial.Trial) -> float:
x = trial.suggest_float("x", -10, 10)
y = trial.suggest_float("y", -10, 10)
return x**2 + y**2
sampler = WhaleOptimizationSampler()
study = optuna.create_study(sampler=sampler)
study.optimize(objective, n_trials=100)
optuna.visualization.matplotlib.plot_optimization_history(study)
plt.show()
Others
Reference
Mirjalili, Seyedali & Lewis, Andrew. (2016). The Whale Optimization Algorithm. Advances in Engineering Software. 95. 51-67. 10.1016/j.advengsoft.2016.01.008.
- Package
- samplers/whale_optimization
- Author
- mist714
- License
- MIT License
- Verified Optuna version
- 3.6.1
- Last update
- 2024-11-14