shark::CMSA Class Reference

Implements the CMSA. More...

#include <shark/Algorithms/DirectSearch/CMSA.h>

+ Inheritance diagram for shark::CMSA:

Public Member Functions

 CMSA (random::rng_type &rng=random::globalRng)
 Default c'tor. More...
 
std::string name () const
 From INameable: return the class name. More...
 
SHARK_EXPORT_SYMBOL void read (InArchive &archive)
 Read the component from the supplied archive. More...
 
SHARK_EXPORT_SYMBOL void write (OutArchive &archive) const
 Write the component to the supplied archive. More...
 
SHARK_EXPORT_SYMBOL void init (ObjectiveFunctionType const &function, SearchPointType const &p)
 Initializes the algorithm for the supplied objective function. More...
 
SHARK_EXPORT_SYMBOL void init (ObjectiveFunctionType const &function, SearchPointType const &initialSearchPoint, std::size_t lambda, std::size_t mu, double initialSigma, const boost::optional< RealMatrix > &initialCovarianceMatrix=boost::optional< RealMatrix >())
 Initializes the algorithm for the supplied objective function. More...
 
SHARK_EXPORT_SYMBOL void step (ObjectiveFunctionType const &function)
 Executes one iteration of the algorithm. More...
 
void setInitialSigma (double initSigma)
 sets the initial step length sigma More...
 
void setMu (std::size_t mu)
 Sets the number of selected samples. More...
 
void setLambda (std::size_t lambda)
 Sets the number of sampled points. More...
 
std::size_t mu () const
 Accesses the size of the parent population. More...
 
std::size_t lambda () const
 Accesses the size of the offspring population. More...
 
RealVector eigenValues () const
 
double sigma () const
 
- Public Member Functions inherited from shark::AbstractSingleObjectiveOptimizer< RealVector >
std::size_t numInitPoints () const
 By default most single objective optimizers only require a single point. More...
 
virtual void init (ObjectiveFunctionType const &function, std::vector< SearchPointType > const &initPoints)
 Initialize the optimizer for the supplied objective function using a set of initialisation points. More...
 
virtual const SolutionTypesolution () const
 returns the current solution of the optimizer More...
 
- Public Member Functions inherited from shark::AbstractOptimizer< RealVector, double, SingleObjectiveResultSet< RealVector > >
const Featuresfeatures () const
 
virtual void updateFeatures ()
 
bool requiresValue () const
 
bool requiresFirstDerivative () const
 
bool requiresSecondDerivative () const
 
bool canSolveConstrained () const
 
bool requiresClosestFeasible () const
 
virtual ~AbstractOptimizer ()
 
virtual void init (ObjectiveFunctionType const &function)
 Initialize the optimizer for the supplied objective function. More...
 
- Public Member Functions inherited from shark::INameable
virtual ~INameable ()
 
- Public Member Functions inherited from shark::ISerializable
virtual ~ISerializable ()
 Virtual d'tor. More...
 
void load (InArchive &archive, unsigned int version)
 Versioned loading of components, calls read(...). More...
 
void save (OutArchive &archive, unsigned int version) const
 Versioned storing of components, calls write(...). More...
 
 BOOST_SERIALIZATION_SPLIT_MEMBER ()
 

Protected Types

typedef Individual< RealVector, double, LightChromosome > IndividualType
 The type of individual used by the CMSA. More...
 

Protected Member Functions

SHARK_EXPORT_SYMBOL std::vector< IndividualTypegenerateOffspring () const
 Samples lambda individuals from the search distribution. More...
 
SHARK_EXPORT_SYMBOL void updatePopulation (std::vector< IndividualType > const &offspring)
 Updates the strategy parameters based on the supplied offspring population. More...
 
SHARK_EXPORT_SYMBOL void doInit (std::vector< SearchPointType > const &points, std::vector< ResultType > const &functionValues, std::size_t lambda, std::size_t mu, double initialSigma)
 Initializes the internal data structures of the CMSA. More...
 
- Protected Member Functions inherited from shark::AbstractOptimizer< RealVector, double, SingleObjectiveResultSet< RealVector > >
void checkFeatures (ObjectiveFunctionType const &objectiveFunction)
 Convenience function that checks whether the features of the supplied objective function match with the required features of the optimizer. More...
 

Additional Inherited Members

- Public Types inherited from shark::AbstractSingleObjectiveOptimizer< RealVector >
typedef base_type::SearchPointType SearchPointType
 
typedef base_type::SolutionType SolutionType
 
typedef base_type::ResultType ResultType
 
typedef base_type::ObjectiveFunctionType ObjectiveFunctionType
 
- Public Types inherited from shark::AbstractOptimizer< RealVector, double, SingleObjectiveResultSet< RealVector > >
enum  Feature
 Models features that the optimizer requires from the objective function. More...
 
typedef RealVector SearchPointType
 
typedef double ResultType
 
typedef SingleObjectiveResultSet< RealVector > SolutionType
 
typedef AbstractObjectiveFunction< RealVector, ResultTypeObjectiveFunctionType
 
typedef TypedFlags< FeatureFeatures
 
typedef TypedFeatureNotAvailableException< FeatureFeatureNotAvailableException
 
- Protected Attributes inherited from shark::AbstractSingleObjectiveOptimizer< RealVector >
SolutionType m_best
 Current solution of the optimizer. More...
 
- Protected Attributes inherited from shark::AbstractOptimizer< RealVector, double, SingleObjectiveResultSet< RealVector > >
Features m_features
 

Detailed Description

Implements the CMSA.

The algorithm is described in

H. G. Beyer, B. Sendhoff (2008). Covariance Matrix Adaptation Revisited: The CMSA Evolution Strategy In Proceedings of the Tenth International Conference on Parallel Problem Solving from Nature (PPSN X), pp. 123-132, LNCS, Springer-Verlag

Definition at line 64 of file CMSA.h.

Member Typedef Documentation

◆ IndividualType

typedef Individual< RealVector, double, LightChromosome > shark::CMSA::IndividualType
protected

The type of individual used by the CMSA.

Definition at line 148 of file CMSA.h.

Constructor & Destructor Documentation

◆ CMSA()

Member Function Documentation

◆ doInit()

SHARK_EXPORT_SYMBOL void shark::CMSA::doInit ( std::vector< SearchPointType > const &  points,
std::vector< ResultType > const &  functionValues,
std::size_t  lambda,
std::size_t  mu,
double  initialSigma 
)
protected

Initializes the internal data structures of the CMSA.

◆ eigenValues()

RealVector shark::CMSA::eigenValues ( ) const
inline

Definition at line 139 of file CMSA.h.

References shark::sqr().

◆ generateOffspring()

SHARK_EXPORT_SYMBOL std::vector<IndividualType> shark::CMSA::generateOffspring ( ) const
protected

Samples lambda individuals from the search distribution.

◆ init() [1/2]

SHARK_EXPORT_SYMBOL void shark::CMSA::init ( ObjectiveFunctionType const &  function,
SearchPointType const &  p 
)
virtual

Initializes the algorithm for the supplied objective function.

Implements shark::AbstractSingleObjectiveOptimizer< RealVector >.

Referenced by name().

◆ init() [2/2]

SHARK_EXPORT_SYMBOL void shark::CMSA::init ( ObjectiveFunctionType const &  function,
SearchPointType const &  initialSearchPoint,
std::size_t  lambda,
std::size_t  mu,
double  initialSigma,
const boost::optional< RealMatrix > &  initialCovarianceMatrix = boost::optional< RealMatrix >() 
)

Initializes the algorithm for the supplied objective function.

◆ lambda()

std::size_t shark::CMSA::lambda ( ) const
inline

Accesses the size of the offspring population.

Definition at line 135 of file CMSA.h.

Referenced by name(), and setLambda().

◆ mu()

std::size_t shark::CMSA::mu ( ) const
inline

Accesses the size of the parent population.

Definition at line 130 of file CMSA.h.

Referenced by name(), and setMu().

◆ name()

std::string shark::CMSA::name ( ) const
inlinevirtual

From INameable: return the class name.

Reimplemented from shark::INameable.

Definition at line 86 of file CMSA.h.

References init(), lambda(), mu(), read(), SHARK_EXPORT_SYMBOL, step(), and write().

◆ read()

SHARK_EXPORT_SYMBOL void shark::CMSA::read ( InArchive archive)
virtual

Read the component from the supplied archive.

Parameters
[in,out]archiveThe archive to read from.

Reimplemented from shark::ISerializable.

Referenced by name().

◆ setInitialSigma()

void shark::CMSA::setInitialSigma ( double  initSigma)
inline

sets the initial step length sigma

It is by default <=0 which means that sigma =1/sqrt(numVariables)

Definition at line 115 of file CMSA.h.

◆ setLambda()

void shark::CMSA::setLambda ( std::size_t  lambda)
inline

Sets the number of sampled points.

Definition at line 125 of file CMSA.h.

References lambda().

◆ setMu()

void shark::CMSA::setMu ( std::size_t  mu)
inline

Sets the number of selected samples.

Definition at line 120 of file CMSA.h.

References mu().

◆ sigma()

double shark::CMSA::sigma ( ) const
inline

Definition at line 143 of file CMSA.h.

◆ step()

SHARK_EXPORT_SYMBOL void shark::CMSA::step ( ObjectiveFunctionType const &  function)
virtual

Executes one iteration of the algorithm.

Implements shark::AbstractOptimizer< RealVector, double, SingleObjectiveResultSet< RealVector > >.

Referenced by name().

◆ updatePopulation()

SHARK_EXPORT_SYMBOL void shark::CMSA::updatePopulation ( std::vector< IndividualType > const &  offspring)
protected

Updates the strategy parameters based on the supplied offspring population.

◆ write()

SHARK_EXPORT_SYMBOL void shark::CMSA::write ( OutArchive archive) const
virtual

Write the component to the supplied archive.

Parameters
[in,out]archiveThe archive to write to.

Reimplemented from shark::ISerializable.

Referenced by name().


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