pulsatrix
Loading...
Searching...
No Matches
pulsatrix::CMAES Class Reference

RNG-driven ask-tell wrapper: caches the z-samples an Ask() call draws so a matching Tell() call can reuse them without the caller needing to track them. More...

#include <cma_es.hpp>

Public Member Functions

 CMAES (std::vector< double > initial_mean, double initial_sigma, size_t lambda, double step_size_learning_rate=0.3, double scale_learning_rate=0.3)
 
template<typename RNG >
std::vector< std::vector< double > > Ask (RNG &rng)
 Draws lambda fresh offspring from the current state, caching the standard- normal samples used for the next Tell() call.
 
void Tell (const std::vector< std::vector< double > > &offspring, const std::vector< double > &fitness)
 Updates the internal state from the most recent Ask() call's offspring and their fitness values (maximization convention).
 
const std::vector< double > & mean () const
 
double sigma () const
 
const std::vector< double > & variances () const
 

Detailed Description

RNG-driven ask-tell wrapper: caches the z-samples an Ask() call draws so a matching Tell() call can reuse them without the caller needing to track them.

Constructor & Destructor Documentation

◆ CMAES()

pulsatrix::CMAES::CMAES ( std::vector< double >  initial_mean,
double  initial_sigma,
size_t  lambda,
double  step_size_learning_rate = 0.3,
double  scale_learning_rate = 0.3 
)
inline
Exceptions
std::invalid_argumentif initial_mean is empty, initial_sigma <= 0, or lambda < 2.

Member Function Documentation

◆ Ask()

template<typename RNG >
std::vector< std::vector< double > > pulsatrix::CMAES::Ask ( RNG &  rng)
inline

Draws lambda fresh offspring from the current state, caching the standard- normal samples used for the next Tell() call.

◆ mean()

const std::vector< double > & pulsatrix::CMAES::mean ( ) const
inline

◆ sigma()

double pulsatrix::CMAES::sigma ( ) const
inline

◆ Tell()

void pulsatrix::CMAES::Tell ( const std::vector< std::vector< double > > &  offspring,
const std::vector< double > &  fitness 
)
inline

Updates the internal state from the most recent Ask() call's offspring and their fitness values (maximization convention).

Exceptions
std::invalid_argumentif Ask() was never called, or offspring/fitness don't match the cached sample count – see TellGivenSamples.

◆ variances()

const std::vector< double > & pulsatrix::CMAES::variances ( ) const
inline

The documentation for this class was generated from the following file: