Python3 framework for comparative study of recent metaheuristics
- Free software: MIT license
- Python versions: 3.7.x, 3.8.x, 3.9.x, 3.10.x
- Dependencies: numpy, matplotlib
Our goals are
- To implement some of the classical as well as the state-of-the-art metaheuristics.
- To implement the IEEE-CEC benchmark functions set.
- Create a simple interface that helps researchers, practitioners and students access optimization algorithms as quickly as possible, evaluate their performances against most common metaheuristics and share knowledge of the optimization field with everyone.
git clone https://github.com/adlyZaroui/metaheuristics-benchmark.git
python -m requirements
from functions import *
from metaheuristics import *
cost = Rastrigin(dim=12)
model = whale_optimization(cost)
best_agent, cost_best_agent, costs = model.optimize()
model.plot()
We tried to implement all functions of the IEEE-CEC-2017 benchmark functions, listed here
For now, available metaheuristics optimization algorithms are
- Simulated Annealing
- Differential Evolution
- Grey Wolf Optimizer
- Whale Optimization
- Equilibrium Optimizer
More are coming soon.
Follow the problems model defined in functions.py
For instance the sum of squared function
class custom_problem:
name = "custom_problem"
separable = False # not mandatory
def __init__(self, d): # only the attribute d is mandatory, you can add if needed
self.d = d
self.input_domain = np.array([[-100, 100] for _ in range(d)]) # CEC default search domain
def get_param(self): # dictionnary of parameters
return {}
def get_global_minimum(self):
X = np.array([0 for _ in range(d)]) # if a solution of the problem is known...
return (X, self(X))
def __call__(self, X): # here is the behaviour of the function when it is call
return sum(X**2)