evox.algorithms.so.es_variants.ars

Module Contents

Classes

ARS

The implementation of the ARS algorithm.

API

class evox.algorithms.so.es_variants.ars.ARS(pop_size: int, center_init: torch.Tensor, elite_ratio: float = 0.1, lr: float = 0.05, sigma: float = 0.03, optimizer: Literal[adam] | None = None, device: torch.device | None = None)[source]

Bases: evox.core.Algorithm

The implementation of the ARS algorithm.

Reference: Simple random search provides a competitive approach to reinforcement learning (https://arxiv.org/pdf/1803.07055.pdf)

This code has been inspired by or utilizes the algorithmic implementation from evosax. More information about evosax can be found at the following URL: GitHub Link: https://github.com/RobertTLange/evosax

Initialization

Initialize the ARS algorithm with the given parameters.

Parameters:
  • pop_size – The size of the population.

  • center_init – The initial center of the population. Must be a 1D tensor.

  • elite_ratio – The ratio of elite population. Defaults to 0.1.

  • lr – The learning rate for the optimizer. Defaults to 0.05.

  • sigma – The standard deviation of the noise. Defaults to 0.03.

  • optimizer – The optimizer to use. Defaults to None. Currently, only “adam” or None is supported.

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

step()[source]

Perform a single step of the ARS algorithm.

record_step()[source]