Dynamic Smoothing Cross-Entropy Method (DSCEM)
- class pypop7.optimizers.cem.dscem.DSCEM(problem, options)[source]
Dynamic Smoothing Cross-Entropy Method (DSCEM).
Note
DSCEM uses the dynamic smoothing strategy to update the mean and std of Gaussian search (mutation/sampling) distribution in an online fashion.
- Parameters:
problem (dict) –
- problem arguments with the following common settings (keys):
’fitness_function’ - objective 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 needed to be explicitly set (int);
- and with the following particular settings (keys):
’sigma’ - initial global step-size, aka mutation strength (float),
’mean’ - initial (starting) point, aka mean of Gaussian search distribution (array_like),
if not given, it will draw a random sample from the uniform distribution whose search range is bounded by problem[‘lower_boundary’] and problem[‘upper_boundary’].
’n_individuals’ - offspring population size (int, default: 1000),
’n_parents’ - parent population size (int, default: 200),
’alpha’ - smoothing factor of mean of Gaussian search distribution (float, default: 0.8),
’beta’ - smoothing factor of individual step-sizes (float, default: 0.7),
’q’ - decay factor of smoothing individual step-sizes (float, default: 5.0).
Examples
Use the optimizer to minimize the well-known test function Rosenbrock:
1>>> import numpy # engine for numerical computing 2>>> from pypop7.benchmarks.base_functions import rosenbrock # function to be minimized 3>>> from pypop7.optimizers.cem.dscem import DSCEM 4>>> problem = {'fitness_function': rosenbrock, # define problem arguments 5... 'ndim_problem': 100, 6... 'lower_boundary': -5*numpy.ones((100,)), 7... 'upper_boundary': 5*numpy.ones((100,))} 8>>> options = {'max_function_evaluations': 1000000, # set optimizer options 9... 'seed_rng': 2022, 10... 'sigma': 0.3} # the global step-size may need to be tuned for better performance 11>>> dscem = DSCEM(problem, options) # initialize the optimizer class 12>>> results = dscem.optimize() # run the optimization process 13>>> # return the number of function evaluations and best-so-far fitness 14>>> print(f"DSCEM: {results['n_function_evaluations']}, {results['best_so_far_y']}") 15DSCEM: 1000000, 158.66725776324424
For its correctness checking of coding, refer to this code-based repeatability report for more details.
- alpha
smoothing factor of mean of Gaussian search distribution.
- Type:
float
- beta
smoothing factor of individual step-sizes.
- Type:
float
- mean
initial (starting) point, aka mean of Gaussian search distribution.
- Type:
array_like
- n_individuals
number of offspring, aka offspring population size.
- Type:
int
- n_parents
number of parents, aka parental population size.
- Type:
int
- q
decay factor of smoothing individual step-sizes.
- Type:
float
- sigma
initial global step-size, aka mutation strength.
- Type:
float
References
Kroese, D.P., Porotsky, S. and Rubinstein, R.Y., 2006. The cross-entropy method for continuous multi-extremal optimization. Methodology and Computing in Applied Probability, 8(3), pp.383-407. https://link.springer.com/article/10.1007/s11009-006-9753-0 (See [Appendix B Main CE Program] for the official Matlab code.)
De Boer, P.T., Kroese, D.P., Mannor, S. and Rubinstein, R.Y., 2005. A tutorial on the cross-entropy method. Annals of Operations Research, 134(1), pp.19-67. https://link.springer.com/article/10.1007/s10479-005-5724-z