evox.algorithms.so.es_variants.cma_es

Module Contents

Classes

CMAES

The CMA-ES algorithm as described in “The CMA Evolution Strategy: A Tutorial” from https://arxiv.org/abs/1604.00772.

API

class evox.algorithms.so.es_variants.cma_es.CMAES(mean_init: torch.Tensor, sigma: float, pop_size: int | None = None, weights: torch.Tensor | None = None, device: torch.device | None = None)[source]

Bases: evox.core.Algorithm

The CMA-ES algorithm as described in “The CMA Evolution Strategy: A Tutorial” from https://arxiv.org/abs/1604.00772.

Initialization

Initialize the CMA-ES algorithm with the given parameters.

Parameters:
  • pop_size – The size of the population with the notation \(\lambda\).

  • mean_init – The initial mean of the population. Must be a 1D tensor.

  • sigma – The overall standard deviation, i.e., the step size of the algorithm.

  • weights – The recombination weights of the population. Defaults to None and is calculated automatically with recommended values.

  • device – The device to use for the tensors. Defaults to None.

step()[source]

The main step of the CMA-ES algorithm.

In this step, the algorithm generates a new population, evaluates it, and updates the mean, covariance matrix, and step size correspondingly.

_update_mean(mean: torch.Tensor, population: torch.Tensor) torch.Tensor[source]
_update_covariance_matrix(C: torch.Tensor, p_c: torch.Tensor, population: torch.Tensor, old_mean: torch.Tensor, h_sigma)[source]
_update_path_c(path_c: torch.Tensor, h_sigma, delta_mean: torch.Tensor)[source]
_update_path_sigma(path_sigma: torch.Tensor, C_invsqrt: torch.Tensor, delta_mean: torch.Tensor)[source]
_update_step_size(step_size: torch.Tensor)[source]
_conditional_decomposition(iteration: torch.Tensor, C: torch.Tensor)[source]
_no_decomposition(C: torch.Tensor)[source]
_decomposition(C: torch.Tensor) Tuple[torch.Tensor, torch.Tensor, torch.Tensor][source]
record_step()[source]