evox.algorithms.so.es_variants.nes

Module Contents

Classes

XNES

The implementation of the xNES algorithm.

SeparableNES

The implementation of the Separable NES algorithm.

API

class evox.algorithms.so.es_variants.nes.XNES(init_mean: torch.Tensor, init_covar: torch.Tensor, pop_size: int | None = None, recombination_weights: torch.Tensor | None = None, learning_rate_mean: float | None = None, learning_rate_var: float | None = None, learning_rate_B: float | None = None, covar_as_cholesky: bool = False, device: torch.device | None = None)[source]

Bases: evox.core.Algorithm

The implementation of the xNES algorithm.

Reference: Exponential Natural Evolution Strategies (https://dl.acm.org/doi/abs/10.1145/1830483.1830557)

Initialization

Initialize the xNES algorithm with the given parameters.

Parameters:
  • init_mean – The initial mean vector of the population. Must be a 1D tensor.

  • init_covar – The initial covariance matrix of the population. Must be a 2D tensor.

  • pop_size – The size of the population. Defaults to None.

  • recombination_weights – The recombination weights of the population. Defaults to None.

  • learning_rate_mean – The learning rate for the mean vector. Defaults to None.

  • learning_rate_var – The learning rate for the variance vector. Defaults to None.

  • learning_rate_B – The learning rate for the B matrix. Defaults to None.

  • covar_as_cholesky – Whether to use the covariance matrix as a Cholesky factorization result. Defaults to False.

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

step()[source]

Run one step of the xNES algorithm.

The function will sample a population, evaluate their fitness, and then update the center and covariance of the algorithm using the sampled population.

record_step()[source]
class evox.algorithms.so.es_variants.nes.SeparableNES(init_mean: torch.Tensor, init_std: torch.Tensor, pop_size: int | None = None, recombination_weights: torch.Tensor | None = None, learning_rate_mean: float | None = None, learning_rate_var: float | None = None, device: torch.device | None = None)[source]

Bases: evox.core.Algorithm

The implementation of the Separable NES algorithm.

Reference: Natural Evolution Strategies (https://www.jmlr.org/papers/volume15/wierstra14a/wierstra14a.pdf)

Initialization

Initialize the Separable NES algorithm with the given parameters.

Parameters:
  • init_mean – The initial mean vector of the population. Must be a 1D tensor.

  • init_std – The initial standard deviation for each dimension. Must be a 1D tensor.

  • pop_size – The size of the population. Defaults to None.

  • recombination_weights – The recombination weights of the population. Defaults to None.

  • learning_rate_mean – The learning rate for the mean vector. Defaults to None.

  • learning_rate_var – The learning rate for the variance vector. Defaults to None.

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

step()[source]

Run one step of the Separable NES algorithm.

The function will sample a population, evaluate their fitness, and then update the center and covariance of the algorithm using the sampled population.

record_step()[source]