evox.algorithms.so.es_variants.cma_es
¶
Module Contents¶
Classes¶
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_covariance_matrix(C: torch.Tensor, p_c: torch.Tensor, population: torch.Tensor, old_mean: torch.Tensor, h_sigma)[source]¶