Added a way for user to define tune convergence checking in CMA-ES.
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/math/trunk@1198839 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
ae22813ab1
commit
70667484eb
|
@ -31,9 +31,11 @@ import org.apache.commons.math.linear.Array2DRowRealMatrix;
|
||||||
import org.apache.commons.math.linear.EigenDecomposition;
|
import org.apache.commons.math.linear.EigenDecomposition;
|
||||||
import org.apache.commons.math.linear.MatrixUtils;
|
import org.apache.commons.math.linear.MatrixUtils;
|
||||||
import org.apache.commons.math.linear.RealMatrix;
|
import org.apache.commons.math.linear.RealMatrix;
|
||||||
|
import org.apache.commons.math.optimization.ConvergenceChecker;
|
||||||
import org.apache.commons.math.optimization.GoalType;
|
import org.apache.commons.math.optimization.GoalType;
|
||||||
import org.apache.commons.math.optimization.MultivariateRealOptimizer;
|
import org.apache.commons.math.optimization.MultivariateRealOptimizer;
|
||||||
import org.apache.commons.math.optimization.RealPointValuePair;
|
import org.apache.commons.math.optimization.RealPointValuePair;
|
||||||
|
import org.apache.commons.math.optimization.SimpleScalarValueChecker;
|
||||||
import org.apache.commons.math.random.MersenneTwister;
|
import org.apache.commons.math.random.MersenneTwister;
|
||||||
import org.apache.commons.math.random.RandomGenerator;
|
import org.apache.commons.math.random.RandomGenerator;
|
||||||
import org.apache.commons.math.util.MathArrays;
|
import org.apache.commons.math.util.MathArrays;
|
||||||
|
@ -276,6 +278,33 @@ public class CMAESOptimizer
|
||||||
double[][] boundaries, int maxIterations, double stopFitness,
|
double[][] boundaries, int maxIterations, double stopFitness,
|
||||||
boolean isActiveCMA, int diagonalOnly, int checkFeasableCount,
|
boolean isActiveCMA, int diagonalOnly, int checkFeasableCount,
|
||||||
RandomGenerator random, boolean generateStatistics) {
|
RandomGenerator random, boolean generateStatistics) {
|
||||||
|
this(lambda, inputSigma, boundaries, maxIterations, stopFitness, isActiveCMA,
|
||||||
|
diagonalOnly, checkFeasableCount, random, generateStatistics,
|
||||||
|
new SimpleScalarValueChecker());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param lambda Population size.
|
||||||
|
* @param inputSigma Initial search volume; sigma of offspring objective variables.
|
||||||
|
* @param boundaries Boundaries for objective variables.
|
||||||
|
* @param maxIterations Maximal number of iterations.
|
||||||
|
* @param stopFitness Whether to stop if objective function value is smaller than
|
||||||
|
* {@code stopFitness}.
|
||||||
|
* @param isActiveCMA Chooses the covariance matrix update method.
|
||||||
|
* @param diagonalOnly Number of initial iterations, where the covariance matrix
|
||||||
|
* remains diagonal.
|
||||||
|
* @param checkFeasableCount Determines how often new random objective variables are
|
||||||
|
* generated in case they are out of bounds.
|
||||||
|
* @param random Random generator.
|
||||||
|
* @param generateStatistics Whether statistic data is collected.
|
||||||
|
* @param checker Convergence checker.
|
||||||
|
*/
|
||||||
|
public CMAESOptimizer(int lambda, double[] inputSigma,
|
||||||
|
double[][] boundaries, int maxIterations, double stopFitness,
|
||||||
|
boolean isActiveCMA, int diagonalOnly, int checkFeasableCount,
|
||||||
|
RandomGenerator random, boolean generateStatistics,
|
||||||
|
ConvergenceChecker<RealPointValuePair> checker) {
|
||||||
|
super(checker);
|
||||||
this.lambda = lambda;
|
this.lambda = lambda;
|
||||||
this.inputSigma = inputSigma == null ? null : (double[]) inputSigma.clone();
|
this.inputSigma = inputSigma == null ? null : (double[]) inputSigma.clone();
|
||||||
if (boundaries == null) {
|
if (boundaries == null) {
|
||||||
|
|
Loading…
Reference in New Issue