Class CMAESOptimizer
- java.lang.Object
-
- org.apache.commons.math3.optimization.direct.BaseAbstractMultivariateOptimizer<FUNC>
-
- org.apache.commons.math3.optimization.direct.BaseAbstractMultivariateSimpleBoundsOptimizer<MultivariateFunction>
-
- org.apache.commons.math3.optimization.direct.CMAESOptimizer
-
- All Implemented Interfaces:
BaseMultivariateOptimizer<MultivariateFunction>
,BaseMultivariateSimpleBoundsOptimizer<MultivariateFunction>
,BaseOptimizer<PointValuePair>
,MultivariateOptimizer
@Deprecated public class CMAESOptimizer extends BaseAbstractMultivariateSimpleBoundsOptimizer<MultivariateFunction> implements MultivariateOptimizer
Deprecated.As of 3.1 (to be removed in 4.0).An implementation of the active Covariance Matrix Adaptation Evolution Strategy (CMA-ES) for non-linear, non-convex, non-smooth, global function minimization. The CMA-Evolution Strategy (CMA-ES) is a reliable stochastic optimization method which should be applied if derivative-based methods, e.g. quasi-Newton BFGS or conjugate gradient, fail due to a rugged search landscape (e.g. noise, local optima, outlier, etc.) of the objective function. Like a quasi-Newton method, the CMA-ES learns and applies a variable metric on the underlying search space. Unlike a quasi-Newton method, the CMA-ES neither estimates nor uses gradients, making it considerably more reliable in terms of finding a good, or even close to optimal, solution.
In general, on smooth objective functions the CMA-ES is roughly ten times slower than BFGS (counting objective function evaluations, no gradients provided). For up to variables also the derivative-free simplex direct search method (Nelder and Mead) can be faster, but it is far less reliable than CMA-ES.
The CMA-ES is particularly well suited for non-separable and/or badly conditioned problems. To observe the advantage of CMA compared to a conventional evolution strategy, it will usually take about function evaluations. On difficult problems the complete optimization (a single run) is expected to take roughly between and function evaluations.
This implementation is translated and adapted from the Matlab version of the CMA-ES algorithm as implemented in module
For more information, please refer to the following links:cmaes.m
version 3.51.- Since:
- 3.0
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
CMAESOptimizer.PopulationSize
Deprecated.Population size.static class
CMAESOptimizer.Sigma
Deprecated.Input sigma values.
-
Field Summary
Fields Modifier and Type Field Description static int
DEFAULT_CHECKFEASABLECOUNT
Deprecated.Default value forcheckFeasableCount
: 0.static int
DEFAULT_DIAGONALONLY
Deprecated.Default value fordiagonalOnly
: 0.static boolean
DEFAULT_ISACTIVECMA
Deprecated.Default value forisActiveCMA
: true.static int
DEFAULT_MAXITERATIONS
Deprecated.Default value formaxIterations
: 30000.static RandomGenerator
DEFAULT_RANDOMGENERATOR
Deprecated.Default value forrandom
.static double
DEFAULT_STOPFITNESS
Deprecated.Default value forstopFitness
: 0.0.-
Fields inherited from class org.apache.commons.math3.optimization.direct.BaseAbstractMultivariateOptimizer
evaluations
-
-
Constructor Summary
Constructors Constructor Description CMAESOptimizer()
Deprecated.As of version 3.1: Parameterlambda
must be passed with the call tooptimize
(whereas in the current code it is set to an undocumented value).CMAESOptimizer(int lambda)
Deprecated.As of version 3.1: Parameterlambda
must be passed with the call tooptimize
(whereas in the current code it is set to an undocumented value)..CMAESOptimizer(int lambda, double[] inputSigma)
Deprecated.CMAESOptimizer(int lambda, double[] inputSigma, int maxIterations, double stopFitness, boolean isActiveCMA, int diagonalOnly, int checkFeasableCount, RandomGenerator random, boolean generateStatistics)
Deprecated.CMAESOptimizer(int lambda, double[] inputSigma, int maxIterations, double stopFitness, boolean isActiveCMA, int diagonalOnly, int checkFeasableCount, RandomGenerator random, boolean generateStatistics, ConvergenceChecker<PointValuePair> checker)
Deprecated.CMAESOptimizer(int maxIterations, double stopFitness, boolean isActiveCMA, int diagonalOnly, int checkFeasableCount, RandomGenerator random, boolean generateStatistics, ConvergenceChecker<PointValuePair> checker)
Deprecated.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description protected PointValuePair
doOptimize()
Deprecated.Perform the bulk of the optimization algorithm.java.util.List<RealMatrix>
getStatisticsDHistory()
Deprecated.java.util.List<java.lang.Double>
getStatisticsFitnessHistory()
Deprecated.java.util.List<RealMatrix>
getStatisticsMeanHistory()
Deprecated.java.util.List<java.lang.Double>
getStatisticsSigmaHistory()
Deprecated.protected PointValuePair
optimizeInternal(int maxEval, MultivariateFunction f, GoalType goalType, OptimizationData... optData)
Deprecated.Optimize an objective function.-
Methods inherited from class org.apache.commons.math3.optimization.direct.BaseAbstractMultivariateSimpleBoundsOptimizer
optimize, optimize
-
Methods inherited from class org.apache.commons.math3.optimization.direct.BaseAbstractMultivariateOptimizer
computeObjectiveValue, getConvergenceChecker, getEvaluations, getGoalType, getLowerBound, getMaxEvaluations, getStartPoint, getUpperBound, optimize, optimizeInternal
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.commons.math3.optimization.BaseMultivariateOptimizer
optimize
-
Methods inherited from interface org.apache.commons.math3.optimization.BaseOptimizer
getConvergenceChecker, getEvaluations, getMaxEvaluations
-
-
-
-
Field Detail
-
DEFAULT_CHECKFEASABLECOUNT
public static final int DEFAULT_CHECKFEASABLECOUNT
Deprecated.Default value forcheckFeasableCount
: 0.- See Also:
- Constant Field Values
-
DEFAULT_STOPFITNESS
public static final double DEFAULT_STOPFITNESS
Deprecated.Default value forstopFitness
: 0.0.- See Also:
- Constant Field Values
-
DEFAULT_ISACTIVECMA
public static final boolean DEFAULT_ISACTIVECMA
Deprecated.Default value forisActiveCMA
: true.- See Also:
- Constant Field Values
-
DEFAULT_MAXITERATIONS
public static final int DEFAULT_MAXITERATIONS
Deprecated.Default value formaxIterations
: 30000.- See Also:
- Constant Field Values
-
DEFAULT_DIAGONALONLY
public static final int DEFAULT_DIAGONALONLY
Deprecated.Default value fordiagonalOnly
: 0.- See Also:
- Constant Field Values
-
DEFAULT_RANDOMGENERATOR
public static final RandomGenerator DEFAULT_RANDOMGENERATOR
Deprecated.Default value forrandom
.
-
-
Constructor Detail
-
CMAESOptimizer
@Deprecated public CMAESOptimizer()
Deprecated.As of version 3.1: Parameterlambda
must be passed with the call tooptimize
(whereas in the current code it is set to an undocumented value).Default constructor, uses default parameters
-
CMAESOptimizer
@Deprecated public CMAESOptimizer(int lambda)
Deprecated.As of version 3.1: Parameterlambda
must be passed with the call tooptimize
(whereas in the current code it is set to an undocumented value)..- Parameters:
lambda
- Population size.
-
CMAESOptimizer
@Deprecated public CMAESOptimizer(int lambda, double[] inputSigma)
Deprecated.- Parameters:
lambda
- Population size.inputSigma
- Initial standard deviations to sample new points around the initial guess.
-
CMAESOptimizer
@Deprecated public CMAESOptimizer(int lambda, double[] inputSigma, int maxIterations, double stopFitness, boolean isActiveCMA, int diagonalOnly, int checkFeasableCount, RandomGenerator random, boolean generateStatistics)
Deprecated.- Parameters:
lambda
- Population size.inputSigma
- Initial standard deviations to sample new points around the initial guess.maxIterations
- Maximal number of iterations.stopFitness
- Whether to stop if objective function value is smaller thanstopFitness
.isActiveCMA
- Chooses the covariance matrix update method.diagonalOnly
- Number of initial iterations, where the covariance matrix remains diagonal.checkFeasableCount
- Determines how often new random objective variables are generated in case they are out of bounds.random
- Random generator.generateStatistics
- Whether statistic data is collected.
-
CMAESOptimizer
@Deprecated public CMAESOptimizer(int lambda, double[] inputSigma, int maxIterations, double stopFitness, boolean isActiveCMA, int diagonalOnly, int checkFeasableCount, RandomGenerator random, boolean generateStatistics, ConvergenceChecker<PointValuePair> checker)
Deprecated.- Parameters:
lambda
- Population size.inputSigma
- Initial standard deviations to sample new points around the initial guess.maxIterations
- Maximal number of iterations.stopFitness
- Whether to stop if objective function value is smaller thanstopFitness
.isActiveCMA
- Chooses the covariance matrix update method.diagonalOnly
- Number of initial iterations, where the covariance matrix remains diagonal.checkFeasableCount
- Determines how often new random objective variables are generated in case they are out of bounds.random
- Random generator.generateStatistics
- Whether statistic data is collected.checker
- Convergence checker.
-
CMAESOptimizer
public CMAESOptimizer(int maxIterations, double stopFitness, boolean isActiveCMA, int diagonalOnly, int checkFeasableCount, RandomGenerator random, boolean generateStatistics, ConvergenceChecker<PointValuePair> checker)
Deprecated.- Parameters:
maxIterations
- Maximal number of iterations.stopFitness
- Whether to stop if objective function value is smaller thanstopFitness
.isActiveCMA
- Chooses the covariance matrix update method.diagonalOnly
- Number of initial iterations, where the covariance matrix remains diagonal.checkFeasableCount
- Determines how often new random objective variables are generated in case they are out of bounds.random
- Random generator.generateStatistics
- Whether statistic data is collected.checker
- Convergence checker.- Since:
- 3.1
-
-
Method Detail
-
getStatisticsSigmaHistory
public java.util.List<java.lang.Double> getStatisticsSigmaHistory()
Deprecated.- Returns:
- History of sigma values.
-
getStatisticsMeanHistory
public java.util.List<RealMatrix> getStatisticsMeanHistory()
Deprecated.- Returns:
- History of mean matrix.
-
getStatisticsFitnessHistory
public java.util.List<java.lang.Double> getStatisticsFitnessHistory()
Deprecated.- Returns:
- History of fitness values.
-
getStatisticsDHistory
public java.util.List<RealMatrix> getStatisticsDHistory()
Deprecated.- Returns:
- History of D matrix.
-
optimizeInternal
protected PointValuePair optimizeInternal(int maxEval, MultivariateFunction f, GoalType goalType, OptimizationData... optData)
Deprecated.Optimize an objective function.- Overrides:
optimizeInternal
in classBaseAbstractMultivariateOptimizer<MultivariateFunction>
- Parameters:
maxEval
- Allowed number of evaluations of the objective function.f
- Objective function.goalType
- Optimization type.optData
- Optimization data. The following data will be looked for:- Returns:
- the point/value pair giving the optimal value for objective function.
-
doOptimize
protected PointValuePair doOptimize()
Deprecated.Perform the bulk of the optimization algorithm.- Specified by:
doOptimize
in classBaseAbstractMultivariateOptimizer<MultivariateFunction>
- Returns:
- the point/value pair giving the optimal value of the objective function.
-
-