shark::LMCMA Class Reference

Implements a Limited-Memory-CMA. More...

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

+ Inheritance diagram for shark::LMCMA:

Public Member Functions

 LMCMA (random::rng_type &rng=random::globalRng)
 Default c'tor.
 
std::string name () const
 From INameable: return the class name.
 
unsigned suggestLambda (unsigned int dimension)
 Calculates lambda for the supplied dimensionality n.
 
double suggestMu (unsigned int lambda)
 Calculates mu for the supplied lambda and the recombination strategy.
 
void init (ObjectiveFunctionType const &function, SearchPointType const &p)
 Initializes the algorithm for the supplied objective function.
 
void init (ObjectiveFunctionType const &function, SearchPointType const &initialSearchPoint, unsigned int lambda, double mu, double initialSigma)
 Initializes the algorithm for the supplied objective function.
 
void step (ObjectiveFunctionType const &function)
 Executes one iteration of the algorithm.
 
double sigma () const
 Accesses the current step size.
 
RealVector const & mean () const
 Accesses the current population mean.
 
RealVector const & weights () const
 Accesses the current weighting vector.
 
RealVector const & evolutionPath () const
 Accesses the evolution path for the covariance matrix update.
 
unsigned int mu () const
 Returns the size of the parent population \(\mu\).
 
unsigned int & mu ()
 Returns a mutabl rference to the size of the parent population \(\mu\).
 
unsigned int lambda () const
 Returns a immutable reference to the size of the offspring population \(\mu\).
 
unsigned int & lambda ()
 Returns a mutable reference to the size of the offspring population \(\mu\).
 
- Public Member Functions inherited from shark::AbstractSingleObjectiveOptimizer< RealVector >
std::size_t numInitPoints () const
 By default most single objective optimizers only require a single point.
 
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.
 
virtual const SolutionTypesolution () const
 returns the current solution of the optimizer
 
- Public Member Functions inherited from shark::AbstractOptimizer< PointType, ResultT, SolutionTypeT >
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.
 
virtual void init (ObjectiveFunctionType const &function, std::vector< SearchPointType > const &initPoints)=0
 Initialize the optimizer for the supplied objective function using a set of initialisation points.
 
virtual void step (ObjectiveFunctionType const &function)=0
 Carry out one step of the optimizer for the supplied objective function.
 
- Public Member Functions inherited from shark::INameable
virtual ~INameable ()
 
- Public Member Functions inherited from shark::ISerializable
virtual ~ISerializable ()
 Virtual d'tor.
 
virtual void read (InArchive &archive)
 Read the component from the supplied archive.
 
virtual void write (OutArchive &archive) const
 Write the component to the supplied archive.
 
void load (InArchive &archive, unsigned int version)
 Versioned loading of components, calls read(...).
 
void save (OutArchive &archive, unsigned int version) const
 Versioned storing of components, calls write(...).
 
 BOOST_SERIALIZATION_SPLIT_MEMBER ()
 

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< PointType, ResultT, SolutionTypeT >
enum  Feature {
  REQUIRES_VALUE = 1 , REQUIRES_FIRST_DERIVATIVE = 2 , REQUIRES_SECOND_DERIVATIVE = 4 , CAN_SOLVE_CONSTRAINED = 8 ,
  REQUIRES_CLOSEST_FEASIBLE = 16
}
 Models features that the optimizer requires from the objective function. More...
 
typedef PointType SearchPointType
 
typedef ResultT ResultType
 
typedef SolutionTypeT SolutionType
 
typedef AbstractObjectiveFunction< PointType, ResultTypeObjectiveFunctionType
 
typedef TypedFlags< FeatureFeatures
 
typedef TypedFeatureNotAvailableException< FeatureFeatureNotAvailableException
 
- Protected Member Functions inherited from shark::AbstractOptimizer< PointType, ResultT, SolutionTypeT >
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.
 
- Protected Attributes inherited from shark::AbstractSingleObjectiveOptimizer< RealVector >
SolutionType m_best
 Current solution of the optimizer.
 
- Protected Attributes inherited from shark::AbstractOptimizer< PointType, ResultT, SolutionTypeT >
Features m_features
 

Detailed Description

Implements a Limited-Memory-CMA.

This is the algorithm as proposed in Ilya Loshchilov, "A Computationally Efficient Limited Memory CMA-ES for Large Scale Optimization" with a few corrections regarding the covariance matrix update.

The algorithm stores a subset of previous evolution path vectors and approximates the covariance matrix based on this. This algorithm only requires O(nm) memory, where n is the dimensionality and n the problem dimensionality. To be more exact, 2*m vectors of size n are stored to calculate the matrix-vector product with the choelsky factor of the covariance matrix in O(mn).

The algorithm uses the population based step size adaptation strategy as proposed in the same paper.

Definition at line 198 of file LMCMA.h.

Constructor & Destructor Documentation

◆ LMCMA()

shark::LMCMA::LMCMA ( random::rng_type &  rng = random::globalRng)
inline

Member Function Documentation

◆ evolutionPath()

RealVector const & shark::LMCMA::evolutionPath ( ) const
inline

Accesses the evolution path for the covariance matrix update.

Definition at line 317 of file LMCMA.h.

◆ init() [1/2]

void shark::LMCMA::init ( ObjectiveFunctionType const &  function,
SearchPointType const &  initialSearchPoint,
unsigned int  lambda,
double  mu,
double  initialSigma 
)
inline

◆ init() [2/2]

void shark::LMCMA::init ( ObjectiveFunctionType const &  function,
SearchPointType const &  p 
)
inlinevirtual

Initializes the algorithm for the supplied objective function.

Implements shark::AbstractSingleObjectiveOptimizer< RealVector >.

Definition at line 227 of file LMCMA.h.

References init(), lambda(), mu(), suggestLambda(), and suggestMu().

Referenced by init().

◆ lambda() [1/2]

unsigned int & shark::LMCMA::lambda ( )
inline

Returns a mutable reference to the size of the offspring population \(\mu\).

Definition at line 337 of file LMCMA.h.

◆ lambda() [2/2]

unsigned int shark::LMCMA::lambda ( ) const
inline

Returns a immutable reference to the size of the offspring population \(\mu\).

Definition at line 332 of file LMCMA.h.

Referenced by init(), init(), step(), suggestLambda(), and suggestMu().

◆ mean()

RealVector const & shark::LMCMA::mean ( ) const
inline

Accesses the current population mean.

Definition at line 307 of file LMCMA.h.

◆ mu() [1/2]

unsigned int & shark::LMCMA::mu ( )
inline

Returns a mutabl rference to the size of the parent population \(\mu\).

Definition at line 327 of file LMCMA.h.

◆ mu() [2/2]

unsigned int shark::LMCMA::mu ( ) const
inline

Returns the size of the parent population \(\mu\).

Definition at line 322 of file LMCMA.h.

Referenced by init(), and init().

◆ name()

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

From INameable: return the class name.

Reimplemented from shark::INameable.

Definition at line 208 of file LMCMA.h.

◆ sigma()

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

Accesses the current step size.

Definition at line 302 of file LMCMA.h.

References shark::PopulationBasedStepSizeAdaptation::stepSize().

◆ step()

void shark::LMCMA::step ( ObjectiveFunctionType const &  function)
inline

Executes one iteration of the algorithm.

Definition at line 278 of file LMCMA.h.

References lambda(), shark::AbstractSingleObjectiveOptimizer< RealVector >::m_best, and shark::searchPoint().

◆ suggestLambda()

unsigned shark::LMCMA::suggestLambda ( unsigned int  dimension)
inline

Calculates lambda for the supplied dimensionality n.

Definition at line 212 of file LMCMA.h.

References lambda().

Referenced by init().

◆ suggestMu()

double shark::LMCMA::suggestMu ( unsigned int  lambda)
inline

Calculates mu for the supplied lambda and the recombination strategy.

Definition at line 220 of file LMCMA.h.

References lambda().

Referenced by init().

◆ weights()

RealVector const & shark::LMCMA::weights ( ) const
inline

Accesses the current weighting vector.

Definition at line 312 of file LMCMA.h.


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