Top Description Fields Constructors Methods
org.apache.commons.math3.optim.nonlinear.scalar.noderiv

public Class SimplexOptimizer

extends MultivariateOptimizer
Class Inheritance
Imports
java.util.Comparator, org.apache.commons.math3.analysis.MultivariateFunction, org.apache.commons.math3.exception.NullArgumentException, .MathUnsupportedOperationException, org.apache.commons.math3.exception.util.LocalizedFormats, org.apache.commons.math3.optim.nonlinear.scalar.GoalType, .MultivariateOptimizer, org.apache.commons.math3.optim.ConvergenceChecker, .PointValuePair, .SimpleValueChecker, .OptimizationData

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.

The simplex update procedure (NelderMeadSimplex or MultiDirectionalSimplex) must be passed to the optimize method.

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 the optimize 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 checked by providing the worst points of previous and current simplex to the convergence checker, not the best ones.

This simplex optimizer implementation does not directly support constrained optimization with simple bounds; so, for such optimizations, either a more dedicated algorithm must be used like CMAESOptimizer or BOBYQAOptimizer, or the objective function must be wrapped in an adapter like MultivariateFunctionMappingAdapter or MultivariateFunctionPenaltyAdapter.
The call to optimize will throw MathUnsupportedOperationException if bounds are passed to it.

Since
3.0

Field Summary

Modifier and TypeField and Description
private AbstractSimplex
simplex

Simplex update rule.

Constructor Summary

AccessConstructor and Description
public
SimplexOptimizer(ConvergenceChecker<PointValuePair>
Convergence checker.
checker
)

public
SimplexOptimizer(double
Relative threshold.
rel
,
double
Absolute threshold.
abs
)

Method Summary

Modifier and TypeMethod and Description
private void
protected PointValuePair
doOptimize()

Implements abstract org.apache.commons.math3.optim.BaseOptimizer.doOptimize.

Performs the bulk of the optimization algorithm.

public PointValuePair

Returns:

a point/value pair that satisfies the convergence criteria.
optimize
(OptimizationData...
Optimization data. In addition to those documented in MultivariateOptimizer, this method will register the following data:
optData
)

Overrides org.apache.commons.math3.optim.nonlinear.scalar.MultivariateOptimizer.optimize.

Stores data and performs the optimization.

protected void
parseOptimizationData(OptimizationData...
Optimization data. The following data will be looked for:
optData
)

Overrides org.apache.commons.math3.optim.nonlinear.scalar.MultivariateOptimizer.parseOptimizationData.

Scans the list of (required and optional) optimization data that characterize the problem.

Inherited from org.apache.commons.math3.optim.nonlinear.scalar.MultivariateOptimizer:
computeObjectiveValuegetGoalType

Field Detail

simplexback to summary
private AbstractSimplex simplex

Simplex update rule.

Constructor Detail

SimplexOptimizerback to summary
public SimplexOptimizer(ConvergenceChecker<PointValuePair> checker)
Parameters
checker:ConvergenceChecker<PointValuePair>

Convergence checker.

SimplexOptimizerback to summary
public SimplexOptimizer(double rel, double abs)
Parameters
rel:double

Relative threshold.

abs:double

Absolute threshold.

Method Detail

checkParametersback to summary
private void checkParameters()

Hides org.apache.commons.math3.optim.BaseMultivariateOptimizer.checkParameters.

Doc from org.apache.commons.math3.optim.BaseMultivariateOptimizer.checkParameters.

Check parameters consistency.

Exceptions
MathUnsupportedOperationException:
if bounds were passed to the optimize method.
NullArgumentException:
if no initial simplex was passed to the optimize method.
doOptimizeback to summary
protected PointValuePair doOptimize()

Implements abstract org.apache.commons.math3.optim.BaseOptimizer.doOptimize.

Doc from org.apache.commons.math3.optim.BaseOptimizer.doOptimize.

Performs the bulk of the optimization algorithm.

Returns:PointValuePair

the point/value pair giving the optimal value of the objective function.

Annotations
@Override
optimizeback to summary
public PointValuePair optimize(OptimizationData... optData)

Overrides org.apache.commons.math3.optim.nonlinear.scalar.MultivariateOptimizer.optimize.

Doc from org.apache.commons.math3.optim.nonlinear.scalar.MultivariateOptimizer.optimize.

Stores data and performs the optimization.

The list of parameters is open-ended so that sub-classes can extend it with arguments specific to their concrete implementations.

When the method is called multiple times, instance data is overwritten only when actually present in the list of arguments: when not specified, data set in a previous call is retained (and thus is optional in subsequent calls).

Important Note

Subclasses must override parseOptimizationData(OptimizationData[]) if they need to register their own options; but then, they must also call super.parseOptimizationData(optData) within that method.

Parameters
optData:OptimizationData[]

Optimization data. In addition to those documented in MultivariateOptimizer, this method will register the following data:

Returns:PointValuePair

a point/value pair that satisfies the convergence criteria.

Annotations
@Override
parseOptimizationDataback to summary
protected void parseOptimizationData(OptimizationData... optData)

Overrides org.apache.commons.math3.optim.nonlinear.scalar.MultivariateOptimizer.parseOptimizationData.

Scans the list of (required and optional) optimization data that characterize the problem.

Parameters
optData:OptimizationData[]

Optimization data. The following data will be looked for:

Annotations
@Override