fr.inria.optimization.cmaes
Class CMAParameters

java.lang.Object
  extended by fr.inria.optimization.cmaes.CMAParameters
All Implemented Interfaces:
java.io.Serializable

public class CMAParameters
extends java.lang.Object
implements java.io.Serializable

Interface to strategy parameters for the CMA Evolution Strategy, most importantly the population size lambda, while the change of other parameters is discouraged. The class CMAParameters processes the strategy parameters, like population size and learning rates, for the class CMAEvolutionStrategy where the public field parameters of type CMAParameters can be used to set the parameter values. The method supplementRemainders(int, CMAOptions) supplements those parameters that were not explicitly given, regarding dependencies (eg, the parent number, mu, cannot be larger than the population size lambda) and does a respective consistency checking via method check(). Parameters cannot be changed after CMAEvolutionStrategy method init() was called.

Example code snippet:

        CMAEvolutionStrategy cma = new CMAEvolutionStrategy();
        cma.parameters.setPopulationSize(33); // set lambda
        int mu = cma.parameters.getMu(); // will fail as mu was not set and missing 
                                         // parameters were not supplemented yet 
        cma.readProperties();         // read necessary initial values, might overwrite lambda
        mu = cma.parameters.getMu();  // might still fail               
        cma.init();                   // finalize initialization, supplement missing parameters
        mu = cma.parameters.getMu();  // OK now
        cma.parameters.setMu(4);      // runtime error, parameters cannot be changed after init()
 

Most commonly, the offspring population size lambda can be changed (increased) from its default value via setPopulationSize to improve the global search capability, see file CMAExample2.java. It is recommended to use the default values first!

See Also:
CMAEvolutionStrategy.readProperties(), Serialized Form

Nested Class Summary
static class CMAParameters.RecombinationType
           
 
Constructor Summary
CMAParameters()
           
 
Method Summary
 java.lang.String check()
          Checks strategy parameter setting with respect to principle consistency.
 double getCc()
          Getter for backward time horizon parameter cc for distribution cumulation (for evolution path pc).
 double getCcov()
          Getter for property covariance matrix learning rate ccov
 double getCcov(boolean flgdiag)
          Getter for property covariance matrix learning rate ccov
 double getCs()
          Getter for cs, parameter for the backward time horizon for the cumulation for sigma.
 double getDamps()
          Getter for step-size damping damps.
 CMAParameters getDefaults(int N)
          get default parameter setting depending on given dimension N
 CMAParameters getDefaults(int N, int lambda)
          get default parameter setting depending on dimension N and population size lambda.
 int getLambda()
          Getter for offspring population size lambda, no check, whether lambda was already set properly
 int getMu()
          Getter for property mu.
 double getMucov()
          Getter for property mucov.
 double getMueff()
          Getter for property mueff, the "variance effective selection mass".
 int getPopulationSize()
           
 double[] getWeights()
          Getter for property weights.
 void setCc(double cc)
          Setter for cc to default value.
 void setCcov(double ccov)
          Setter for covariance matrix learning rate ccov.
 void setCs(double cs)
          Setter for cs to default value.
 void setDamps(double damps)
          Setter for damps.
 void setMu(int mu)
          Setter for parent number mu, be aware of the recombinationType when setting mu
 void setMucov(double mucov)
          Setter for mucov.
 void setPopulationSize(int lambda)
          Setter for offspring population size (lambda).
 void setRecombination(int mu, CMAParameters.RecombinationType recombinationType)
          Sets parent number mu and the policy for choosing the recombination weights.
 void setRecombinationWeights(CMAParameters.RecombinationType recombinationType)
          Recombination weights can be equal, linearly decreasing, or super-linearly decreasing (default).
 void supplementRemainders(int N, CMAOptions opts)
          Supplements all default parameter values that were not explicitly set already.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CMAParameters

public CMAParameters()
Method Detail

check

public java.lang.String check()
Checks strategy parameter setting with respect to principle consistency. Returns a string with description of the first error found, otherwise an empty string "".


getDefaults

public CMAParameters getDefaults(int N)
get default parameter setting depending on given dimension N

Parameters:
N - dimension
Returns:
default parameter setting
See Also:
getDefaults(int, int)

getDefaults

public CMAParameters getDefaults(int N,
                                 int lambda)
get default parameter setting depending on dimension N and population size lambda. Code snippet to get, for example, the default parent number value mu (weighted recombination is default):
 int default_mu_for_dimension_42 = new CMAParameters().getDefaults(42).getMu();
 
 CMAEvolutionStrategy cma = new CMAEvolutionStrategy(42);
 int the_same_most_convenient = cma.getParameterDefaults().getMu(); 
 int also_the_same = cma.getParameterDefaults(42).getMu();
 

Parameters:
N -
lambda -
Returns:
default parameter setting
See Also:
getDefaults(int, int)

supplementRemainders

public void supplementRemainders(int N,
                                 CMAOptions opts)
Supplements all default parameter values that were not explicitly set already. Also checks whether the values that were already explicitly set are fine.

Parameters:
N - search space dimension
opts - CMAOptions where stopMaxFunEvals and stopMaxIter are used to set step-size damping parameter damps. This is of minor relevance.

getMu

public int getMu()
Getter for property mu.

Returns:
Value of property mu.

setMu

public void setMu(int mu)
Setter for parent number mu, be aware of the recombinationType when setting mu

Parameters:
mu - New value for the number of parents mu.
See Also:
setRecombination(int, CMAParameters.RecombinationType), setRecombinationWeights(CMAParameters.RecombinationType)

getLambda

public int getLambda()
Getter for offspring population size lambda, no check, whether lambda was already set properly

Returns:
Value of lambda

getPopulationSize

public int getPopulationSize()
See Also:
getLambda()

setPopulationSize

public void setPopulationSize(int lambda)
Setter for offspring population size (lambda). If (only) lambda is set, other parameters, eg. mu and recombination weights and subsequently learning rates for the covariance matrix etc. are chosen accordingly

Parameters:
lambda - is the offspring population size

getWeights

public double[] getWeights()
Getter for property weights.

Returns:
Value of property weights.

setRecombinationWeights

public void setRecombinationWeights(CMAParameters.RecombinationType recombinationType)
Recombination weights can be equal, linearly decreasing, or super-linearly decreasing (default). The respective parameter value is in enum RecombinationType.

Parameters:
recombinationType -
See Also:
setRecombination(int, fr.inria.optimization.cmaes.CMAParameters.RecombinationType), setMu(int)

setRecombination

public void setRecombination(int mu,
                             CMAParameters.RecombinationType recombinationType)
Sets parent number mu and the policy for choosing the recombination weights. Recombination weights can be equal, linearly decreasing, or super-linearly decreasing (default). The respective parameter value is The respective parameter value is in enum RecombinationType. For equal recombination weights mu=lambda/4 is appropriate, otherwise mu=lambda/2.

Parameters:
mu -
recombinationType -

getMueff

public double getMueff()
Getter for property mueff, the "variance effective selection mass".

Returns:
Value of property mueff.

getMucov

public double getMucov()
Getter for property mucov. mucov determines the mixing between rank-one and rank-mu update. For mucov = 1, no rank-mu updated takes place.

Returns:
Value of property mucov.

setMucov

public void setMucov(double mucov)
Setter for mucov.

Parameters:
mucov - New value of mucov.
See Also:
getMucov()

getCcov

public double getCcov(boolean flgdiag)
Getter for property covariance matrix learning rate ccov

Parameters:
flgdiag - boolean, true for getting the learning rate when only the diagonal of the covariance matrix is updated
Returns:
Value of property ccov.

getCcov

public double getCcov()
Getter for property covariance matrix learning rate ccov

Returns:
Value of property ccov.

setCcov

public void setCcov(double ccov)
Setter for covariance matrix learning rate ccov. For ccov=0 no covariance matrix adaptation takes place and only Cumulation Step-Size Adaptation (CSA) is conducted, also know as Path Length Control.

Parameters:
ccov - New value of property ccov.
See Also:
getCcov()

getDamps

public double getDamps()
Getter for step-size damping damps. The damping damps determines the amount of step size change.

Returns:
Value of damps.

setDamps

public void setDamps(double damps)
Setter for damps.

Parameters:
damps - New value of damps.
See Also:
getDamps()

getCc

public double getCc()
Getter for backward time horizon parameter cc for distribution cumulation (for evolution path pc).

Returns:
Value of cc.

setCc

public void setCc(double cc)
Setter for cc to default value.


getCs

public double getCs()
Getter for cs, parameter for the backward time horizon for the cumulation for sigma.

Returns:
Value of property cs.

setCs

public void setCs(double cs)
Setter for cs to default value.

See Also:
getCs()