opytimizer.optimizers.misc.cem

Cross-Entropy Method.

class opytimizer.optimizers.misc.cem.CEM(params: Optional[Dict[str, Any]] = None)

A CEM class, inherited from Optimizer.

This is the designed class to define CEM-related variables and methods.

References

R. Y. Rubinstein. Optimization of Computer simulation Models with Rare Events. European Journal of Operations Research (1997).

__init__(params: Optional[Dict[str, Any]] = None) → None

Initialization method.

Parameters:params – Contains key-value parameters to the meta-heuristics.
n_updates

Number of positions to employ in update formulae.

alpha

Learning rate.

mean

Array of means.

std

Array of standard deviations.

compile(space: opytimizer.core.space.Space) → None

Compiles additional information that is used by this optimizer.

Parameters:space – A Space object containing meta-information.
_create_new_samples(agents: List[opytimizer.core.agent.Agent], function: opytimizer.core.function.Function) → None

Creates new agents based on current mean and standard deviation.

Parameters:
  • agents (list) – List of agents.
  • function – A Function object that will be used as the objective function.
_update_mean(updates: numpy.ndarray) → numpy.ndarray

Calculates and updates mean.

Parameters:updates – An array of updates’ positions.
Returns:The new mean values.
Return type:(np.ndarray)
_update_std(updates: numpy.ndarray) → numpy.ndarray

Calculates and updates standard deviation.

Parameters:updates – An array of updates’ positions.
Returns:The new standard deviation values.
Return type:(np.ndarray)
update(space: opytimizer.core.space.Space, function: opytimizer.core.function.Function) → None

Wraps Cross-Entropy Method over all agents and variables.

Parameters:
  • space – Space containing agents and update-related information.
  • function – A Function object that will be used as the objective function.