Classic Differential Evolution (CDE)¶
- class pypop7.optimizers.de.cde.CDE(problem, options)¶
Classic Differential Evolution (CDE).
Note
Typically, DE/rand/1/bin is seen as the classic/basic version of DE. CDE often optimizes on relatively low-dimensional (e.g., << 1000) search spaces. Its two creators (Kenneth Price&Rainer Storn) won the 2017 Evolutionary Computation Pioneer Award from IEEE-CIS.
- Parameters:
problem (dict) –
- problem arguments with the following common settings (keys):
’fitness_function’ - objective/cost function to be minimized (func),
’ndim_problem’ - number of dimensionality (int),
’upper_boundary’ - upper boundary of search range (array_like),
’lower_boundary’ - lower boundary of search range (array_like).
options (dict) –
- optimizer options with the following common settings (keys):
’max_function_evaluations’ - maximum of function evaluations (int, default: np.Inf),
’max_runtime’ - maximal runtime to be allowed (float, default: np.Inf),
’seed_rng’ - seed for random number generation (RNG) needed to be explicitly set (int);
- and with the following particular settings (keys):
’n_individuals’ - number of offspring, aka offspring population size (int, default: 100),
’f’ - mutation factor (float, default: 0.5),
’cr’ - crossover probability (float, default: 0.9).
Examples
Use the optimizer CDE to minimize the well-known test function Rosenbrock:
1>>> import numpy 2>>> from pypop7.benchmarks.base_functions import rosenbrock # function to be minimized 3>>> from pypop7.optimizers.de.cde import CDE 4>>> problem = {'fitness_function': rosenbrock, # define problem arguments 5... 'ndim_problem': 2, 6... 'lower_boundary': -5*numpy.ones((2,)), 7... 'upper_boundary': 5*numpy.ones((2,))} 8>>> options = {'max_function_evaluations': 5000, # set optimizer options 9... 'seed_rng': 0} 10>>> cde = CDE(problem, options) # initialize the optimizer class 11>>> results = cde.optimize() # run the optimization process 12>>> # return the number of function evaluations and best-so-far fitness 13>>> print(f"CDE: {results['n_function_evaluations']}, {results['best_so_far_y']}") 14CDE: 5000, 2.0242437417701847e-07
For its correctness checking of Python coding, refer to this code-based repeatability report for more details.
- cr¶
crossover probability.
- Type:
float
- f¶
mutation factor.
- Type:
float
- n_individuals¶
number of offspring, aka offspring population size.
- Type:
int
References
Price, K.V., 2013. Differential evolution. In Handbook of optimization (pp. 187-214). Springer, Berlin, Heidelberg. https://link.springer.com/chapter/10.1007/978-3-642-30504-7_8
Price, K.V., Storn, R.M. and Lampinen, J.A., 2005. Differential evolution: A practical approach to global optimization. Springer Science & Business Media. https://link.springer.com/book/10.1007/3-540-31306-0
Storn, R.M. and Price, K.V. 1997. Differential evolution – a simple and efficient heuristic for global optimization over continuous spaces. Journal of Global Optimization, 11(4), pp.341–359. https://link.springer.com/article/10.1023/A:1008202821328 (Kenneth Price&Rainer Storn won the 2017 Evolutionary Computation Pioneer Award from IEEE CIS.)