Class SimplexOptimizer
- java.lang.Object
-
- org.apache.commons.math4.legacy.optim.BaseOptimizer<PAIR>
-
- org.apache.commons.math4.legacy.optim.BaseMultivariateOptimizer<PointValuePair>
-
- org.apache.commons.math4.legacy.optim.nonlinear.scalar.MultivariateOptimizer
-
- org.apache.commons.math4.legacy.optim.nonlinear.scalar.noderiv.SimplexOptimizer
-
public class SimplexOptimizer extends MultivariateOptimizer
This class implements simplex-based direct search optimization.Direct search methods only use objective function values, they do not need derivatives and don't either try to compute approximation of the derivatives. According to a 1996 paper by Margaret H. Wright (Direct Search Methods: Once Scorned, Now Respectable), they are used when either the computation of the derivative is impossible (noisy functions, unpredictable discontinuities) or difficult (complexity, computation cost). In the first cases, rather than an optimum, a not too bad point is desired. In the latter cases, an optimum is desired but cannot be reasonably found. In all cases direct search methods can be useful.
Simplex-based direct search methods are based on comparison of the objective function values at the vertices of a simplex (which is a set of n+1 points in dimension n) that is updated by the algorithms steps.
In addition to those documented in
MultivariateOptimizer
, an instance of this class will register the following data:Each call to
optimize
will re-use the start configuration of the current simplex and move it such that its first vertex is at the provided start point of the optimization. If theoptimize
method is called to solve a different problem and the number of parameters change, the simplex must be re-initialized to one with the appropriate dimensions.Convergence is considered achieved when all the simplex points have converged.
Whenever
simulated annealing (SA)
is activated, and the SA phase has completed, convergence has probably not been reached yet; whenever it's the case, an additional (non-SA) search will be performed (using the current best simplex point as a start point).Additional "best list" searches can be requested through setting the
PopulationSize
argument of theoptimize
method.This implementation does not directly support constrained optimization with simple bounds. The call to
optimize
will throwMathUnsupportedOperationException
if bounds are passed to it.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interface
SimplexOptimizer.Observer
Callback interface for updating caller's code with the current state of the optimization.
-
Constructor Summary
Constructors Constructor Description SimplexOptimizer(double rel, double abs)
SimplexOptimizer(ConvergenceChecker<PointValuePair> checker)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addObserver(SimplexOptimizer.Observer cb)
Register a callback.protected PointValuePair
doOptimize()
Performs the bulk of the optimization algorithm.protected void
parseOptimizationData(OptimizationData... optData)
Scans the list of (required and optional) optimization data that characterize the problem.-
Methods inherited from class org.apache.commons.math4.legacy.optim.nonlinear.scalar.MultivariateOptimizer
computeObjectiveValue, getGoalType, optimize
-
Methods inherited from class org.apache.commons.math4.legacy.optim.BaseMultivariateOptimizer
getLowerBound, getStartPoint, getUpperBound
-
Methods inherited from class org.apache.commons.math4.legacy.optim.BaseOptimizer
getConvergenceChecker, getEvaluations, getIterations, getMaxEvaluations, getMaxIterations, incrementEvaluationCount, incrementIterationCount, optimize
-
-
-
-
Constructor Detail
-
SimplexOptimizer
public SimplexOptimizer(ConvergenceChecker<PointValuePair> checker)
- Parameters:
checker
- Convergence checker.
-
SimplexOptimizer
public SimplexOptimizer(double rel, double abs)
- Parameters:
rel
- Relative threshold.abs
- Absolute threshold.
-
-
Method Detail
-
addObserver
public void addObserver(SimplexOptimizer.Observer cb)
Register a callback.- Parameters:
cb
- Callback.
-
doOptimize
protected PointValuePair doOptimize()
Performs the bulk of the optimization algorithm.- Specified by:
doOptimize
in classBaseOptimizer<PointValuePair>
- Returns:
- the point/value pair giving the optimal value of the objective function.
-
parseOptimizationData
protected void parseOptimizationData(OptimizationData... optData)
Scans the list of (required and optional) optimization data that characterize the problem.- Overrides:
parseOptimizationData
in classMultivariateOptimizer
- Parameters:
optData
- Optimization data. The following data will be looked for:
-
-