mlpack  git-master
CMAES< SelectionPolicyType > Class Template Reference

CMA-ES - Covariance Matrix Adaptation Evolution Strategy is s a stochastic search algorithm. More...

Public Member Functions

 CMAES (const size_t lambda=0, const double lowerBound=-10, const double upperBound=10, const size_t batchSize=32, const size_t maxIterations=1000, const double tolerance=1e-5, const SelectionPolicyType &selectionPolicy=SelectionPolicyType())
 Construct the CMA-ES optimizer with the given function and parameters. More...

 
size_t BatchSize () const
 Get the batch size. More...

 
size_t & BatchSize ()
 Modify the batch size. More...

 
double LowerBound () const
 Get the lower bound of decision variables. More...

 
double & LowerBound ()
 Modify the lower bound of decision variables. More...

 
size_t MaxIterations () const
 Get the maximum number of iterations (0 indicates no limit). More...

 
size_t & MaxIterations ()
 Modify the maximum number of iterations (0 indicates no limit). More...

 
template
<
typename
DecomposableFunctionType
>
double Optimize (DecomposableFunctionType &function, arma::mat &iterate)
 Optimize the given function using CMA-ES. More...

 
size_t PopulationSize () const
 Get the step size. More...

 
size_t & PopulationSize ()
 Modify the step size. More...

 
const SelectionPolicyType & SelectionPolicy () const
 Get the selection policy. More...

 
SelectionPolicyType & SelectionPolicy ()
 Modify the selection policy. More...

 
double Tolerance () const
 Get the tolerance for termination. More...

 
double & Tolerance ()
 Modify the tolerance for termination. More...

 
double UpperBound () const
 Get the upper bound of decision variables. More...

 
double & UpperBound ()
 Modify the upper bound of decision variables. More...

 

Detailed Description


template
<
typename
SelectionPolicyType
=
FullSelection
>

class mlpack::optimization::CMAES< SelectionPolicyType >

CMA-ES - Covariance Matrix Adaptation Evolution Strategy is s a stochastic search algorithm.

CMA-ES is a second order approach estimating a positive definite matrix within an iterative procedure using the covariance matrix.

For more information, please refer to:

@article{Hansen2001
author = {Hansen, Nikolaus and Ostermeier, Andreas},
title = {Completely Derandomized Self-Adaptation in Evolution
Strategies},
journal = {Evol. Comput.},
volume = {9},
number = {2},
year = {2001},
pages = {159--195},
publisher = {MIT Press},
}

For CMA-ES to work, the class must implement the following function:

size_t NumFunctions(); double Evaluate(const arma::mat& coordinates, const size_t i); void Gradient(const arma::mat& coordinates, const size_t i, arma::mat& gradient);

NumFunctions() should return the number of functions ( $n$), and in the other two functions, the parameter i refers to which individual function (or gradient) is being evaluated. So, for the case of a data-dependent function, such as NCA (see mlpack::nca::NCA), NumFunctions() should return the number of points in the dataset, and Evaluate(coordinates, 0) will evaluate the objective function on the first point in the dataset (presumably, the dataset is held internally in the DecomposableFunctionType).

Template Parameters
SelectionPolicyThe selection strategy used for the evaluation step.

Definition at line 66 of file cmaes.hpp.

Constructor & Destructor Documentation

◆ CMAES()

CMAES ( const size_t  lambda = 0,
const double  lowerBound = -10,
const double  upperBound = 10,
const size_t  batchSize = 32,
const size_t  maxIterations = 1000,
const double  tolerance = 1e-5,
const SelectionPolicyType &  selectionPolicy = SelectionPolicyType() 
)

Construct the CMA-ES optimizer with the given function and parameters.

The defaults here are not necessarily good for the given problem, so it is suggested that the values used be tailored to the task at hand. The maximum number of iterations refers to the maximum number of points that are processed (i.e., one iteration equals one point; one iteration does not equal one pass over the dataset).

Parameters
lambdaThe population size (0 use the default size).
lowerBoundLower bound of decision variables.
upperBoundUpper bound of decision variables.
batchSizeBatch size to use for the objective calculation.
maxIterationsMaximum number of iterations allowed (0 means no limit).
toleranceMaximum absolute tolerance to terminate algorithm.
selectionPolicyInstantiated selection policy used to calculate the objective.

Member Function Documentation

◆ BatchSize() [1/2]

size_t BatchSize ( ) const
inline

Get the batch size.

Definition at line 124 of file cmaes.hpp.

◆ BatchSize() [2/2]

size_t& BatchSize ( )
inline

Modify the batch size.

Definition at line 126 of file cmaes.hpp.

◆ LowerBound() [1/2]

double LowerBound ( ) const
inline

Get the lower bound of decision variables.

Definition at line 114 of file cmaes.hpp.

◆ LowerBound() [2/2]

double& LowerBound ( )
inline

Modify the lower bound of decision variables.

Definition at line 116 of file cmaes.hpp.

◆ MaxIterations() [1/2]

size_t MaxIterations ( ) const
inline

Get the maximum number of iterations (0 indicates no limit).

Definition at line 129 of file cmaes.hpp.

◆ MaxIterations() [2/2]

size_t& MaxIterations ( )
inline

Modify the maximum number of iterations (0 indicates no limit).

Definition at line 131 of file cmaes.hpp.

◆ Optimize()

double Optimize ( DecomposableFunctionType &  function,
arma::mat &  iterate 
)

Optimize the given function using CMA-ES.

The given starting point will be modified to store the finishing point of the algorithm, and the final objective value is returned.

Template Parameters
DecomposableFunctionTypeType of the function to be optimized.
Parameters
functionFunction to optimize.
iterateStarting point (will be modified).
Returns
Objective value of the final point.

◆ PopulationSize() [1/2]

size_t PopulationSize ( ) const
inline

Get the step size.

Definition at line 109 of file cmaes.hpp.

◆ PopulationSize() [2/2]

size_t& PopulationSize ( )
inline

Modify the step size.

Definition at line 111 of file cmaes.hpp.

◆ SelectionPolicy() [1/2]

const SelectionPolicyType& SelectionPolicy ( ) const
inline

Get the selection policy.

Definition at line 139 of file cmaes.hpp.

◆ SelectionPolicy() [2/2]

SelectionPolicyType& SelectionPolicy ( )
inline

Modify the selection policy.

Definition at line 141 of file cmaes.hpp.

◆ Tolerance() [1/2]

double Tolerance ( ) const
inline

Get the tolerance for termination.

Definition at line 134 of file cmaes.hpp.

◆ Tolerance() [2/2]

double& Tolerance ( )
inline

Modify the tolerance for termination.

Definition at line 136 of file cmaes.hpp.

◆ UpperBound() [1/2]

double UpperBound ( ) const
inline

Get the upper bound of decision variables.

Definition at line 119 of file cmaes.hpp.

◆ UpperBound() [2/2]

double& UpperBound ( )
inline

Modify the upper bound of decision variables.

Definition at line 121 of file cmaes.hpp.


The documentation for this class was generated from the following file:
  • /var/www/www.mlpack.org/mlpack-git/src/mlpack/core/optimizers/cmaes/cmaes.hpp