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

public Class PowellOptimizer

extends MultivariateOptimizer
Class Inheritance
Imports
org.apache.commons.math3.util.FastMath, .MathArrays, org.apache.commons.math3.exception.NumberIsTooSmallException, .NotStrictlyPositiveException, .MathUnsupportedOperationException, org.apache.commons.math3.exception.util.LocalizedFormats, org.apache.commons.math3.optim.nonlinear.scalar.GoalType, .MultivariateOptimizer, .LineSearch, org.apache.commons.math3.optim.PointValuePair, .ConvergenceChecker, org.apache.commons.math3.optim.univariate.UnivariatePointValuePair

Powell's algorithm. This code is translated and adapted from the Python version of this algorithm (as implemented in module optimize.py v0.5 of SciPy).
The default stopping criterion is based on the differences of the function value between two successive iterations. It is however possible to define a custom convergence checker that might terminate the algorithm earlier.
Line search is performed by the LineSearch class.
Constraints are not supported: the call to optimize will throw MathUnsupportedOperationException if bounds are passed to it. In order to impose simple constraints, the objective function must be wrapped in an adapter like MultivariateFunctionMappingAdapter or MultivariateFunctionPenaltyAdapter.
Since
2.2

Field Summary

Modifier and TypeField and Description
private final double
absoluteThreshold

Absolute threshold.

private final LineSearch
line

Line search.

private static final double
MIN_RELATIVE_TOLERANCE

Minimum relative tolerance.

private final double
relativeThreshold

Relative threshold.

Constructor Summary

AccessConstructor and Description
public
PowellOptimizer(double
Relative threshold.
rel
,
double
Absolute threshold.
abs
,
ConvergenceChecker<PointValuePair>
Convergence checker.
checker
)

This constructor allows to specify a user-defined convergence checker, in addition to the parameters that control the default convergence checking procedure.

public
PowellOptimizer(double
Relative threshold for this optimizer.
rel
,
double
Absolute threshold for this optimizer.
abs
,
double
Relative threshold for the internal line search optimizer.
lineRel
,
double
Absolute threshold for the internal line search optimizer.
lineAbs
,
ConvergenceChecker<PointValuePair>
Convergence checker.
checker
)

This constructor allows to specify a user-defined convergence checker, in addition to the parameters that control the default convergence checking procedure and the line search tolerances.

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

The parameters control the default convergence checking procedure.

public
PowellOptimizer(double
Relative threshold.
rel
,
double
Absolute threshold.
abs
,
double
Relative threshold for the internal line search optimizer.
lineRel
,
double
Absolute threshold for the internal line search optimizer.
lineAbs
)

Builds an instance with the default convergence checking procedure.

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.

private double[][]

Returns:

a 2-element array containing the new point (at index 0) and the new direction (at index 1).
newPointAndDirection
(double[]
Point used in the line search.
p
,
double[]
Direction used in the line search.
d
,
double
Optimum found by the line search.
optimum
)

Compute a new point (in the original space) and a new direction vector, resulting from the line search.

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

Field Detail

absoluteThresholdback to summary
private final double absoluteThreshold

Absolute threshold.

lineback to summary
private final LineSearch line

Line search.

MIN_RELATIVE_TOLERANCEback to summary
private static final double MIN_RELATIVE_TOLERANCE

Minimum relative tolerance.

relativeThresholdback to summary
private final double relativeThreshold

Relative threshold.

Constructor Detail

PowellOptimizerback to summary
public PowellOptimizer(double rel, double abs, ConvergenceChecker<PointValuePair> checker)

This constructor allows to specify a user-defined convergence checker, in addition to the parameters that control the default convergence checking procedure.
The internal line search tolerances are set to the square-root of their corresponding value in the multivariate optimizer.

Parameters
rel:double

Relative threshold.

abs:double

Absolute threshold.

checker:ConvergenceChecker<PointValuePair>

Convergence checker.

Exceptions
NotStrictlyPositiveException:
if abs <= 0.
NumberIsTooSmallException:
if rel < 2 * Math.ulp(1d).
PowellOptimizerback to summary
public PowellOptimizer(double rel, double abs, double lineRel, double lineAbs, ConvergenceChecker<PointValuePair> checker)

This constructor allows to specify a user-defined convergence checker, in addition to the parameters that control the default convergence checking procedure and the line search tolerances.

Parameters
rel:double

Relative threshold for this optimizer.

abs:double

Absolute threshold for this optimizer.

lineRel:double

Relative threshold for the internal line search optimizer.

lineAbs:double

Absolute threshold for the internal line search optimizer.

checker:ConvergenceChecker<PointValuePair>

Convergence checker.

Exceptions
NotStrictlyPositiveException:
if abs <= 0.
NumberIsTooSmallException:
if rel < 2 * Math.ulp(1d).
PowellOptimizerback to summary
public PowellOptimizer(double rel, double abs)

The parameters control the default convergence checking procedure.
The internal line search tolerances are set to the square-root of their corresponding value in the multivariate optimizer.

Parameters
rel:double

Relative threshold.

abs:double

Absolute threshold.

Exceptions
NotStrictlyPositiveException:
if abs <= 0.
NumberIsTooSmallException:
if rel < 2 * Math.ulp(1d).
PowellOptimizerback to summary
public PowellOptimizer(double rel, double abs, double lineRel, double lineAbs)

Builds an instance with the default convergence checking procedure.

Parameters
rel:double

Relative threshold.

abs:double

Absolute threshold.

lineRel:double

Relative threshold for the internal line search optimizer.

lineAbs:double

Absolute threshold for the internal line search optimizer.

Exceptions
NotStrictlyPositiveException:
if abs <= 0.
NumberIsTooSmallException:
if rel < 2 * Math.ulp(1d).

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.
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
newPointAndDirectionback to summary
private double[][] newPointAndDirection(double[] p, double[] d, double optimum)

Compute a new point (in the original space) and a new direction vector, resulting from the line search.

Parameters
p:double[]

Point used in the line search.

d:double[]

Direction used in the line search.

optimum:double

Optimum found by the line search.

Returns:double[][]

a 2-element array containing the new point (at index 0) and the new direction (at index 1).