Top Description Fields Constructors Methods
org.apache.commons.math3.optimization.univariate

public Class BrentOptimizer

extends BaseAbstractUnivariateOptimizer
Class Inheritance
Known Direct Subclasses
org.apache.commons.math3.optimization.direct.PowellOptimizer.LineSearch
Annotations
@Deprecated
Imports
org.apache.commons.math3.util.Precision, .FastMath, org.apache.commons.math3.exception.NumberIsTooSmallException, .NotStrictlyPositiveException, org.apache.commons.math3.optimization.ConvergenceChecker, .GoalType

Deprecated

As of 3.1 (to be removed in 4.0).

For a function defined on some interval (lo, hi), this class finds an approximation x to the point at which the function attains its minimum. It implements Richard Brent's algorithm (from his book "Algorithms for Minimization without Derivatives", p. 79) for finding minima of real univariate functions.
This code is an adaptation, partly based on the Python code from SciPy (module "optimize.py" v0.5); the original algorithm is also modified
Since
2.0

Field Summary

Modifier and TypeField and Description
private final double
absoluteThreshold

Absolute threshold.

private static final double
GOLDEN_SECTION

Golden section.

private static final double
MIN_RELATIVE_TOLERANCE

Minimum relative tolerance.

private final double
relativeThreshold

Relative threshold.

Constructor Summary

AccessConstructor and Description
public
BrentOptimizer(double
Relative threshold.
rel
,
double
Absolute threshold.
abs
,
ConvergenceChecker<UnivariatePointValuePair>
Additional, user-defined, convergence checking procedure.
checker
)
Deprecated as a consequence of ConvergenceChecker being deprecated.

The arguments are used implement the original stopping criterion of Brent's algorithm.

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

The arguments are used for implementing the original stopping criterion of Brent's algorithm.

Method Summary

Modifier and TypeMethod and Description
private UnivariatePointValuePair

Returns:

the best point, or null if a and b are both null. When a and b have the same function value, a is returned.
best
(UnivariatePointValuePair
Point and value.
a
,
UnivariatePointValuePair
Point and value.
b
,
boolean
true if the selected point must be the one with the lowest value.
isMinim
)
Deprecated as a consequence of UnivariatePointValuePair being deprecated.

Selects the best of two points.

protected UnivariatePointValuePair
doOptimize()

Implements abstract org.apache.commons.math3.optimization.univariate.BaseAbstractUnivariateOptimizer.doOptimize.

Deprecated as a consequence of UnivariatePointValuePair being deprecated.

Method for implementing actual optimization algorithms in derived classes.

Inherited from org.apache.commons.math3.optimization.univariate.BaseAbstractUnivariateOptimizer:
computeObjectiveValuegetConvergenceCheckergetEvaluationsgetGoalTypegetMaxgetMaxEvaluationsgetMingetStartValueoptimizeoptimize

Field Detail

absoluteThresholdback to summary
private final double absoluteThreshold

Absolute threshold.

GOLDEN_SECTIONback to summary
private static final double GOLDEN_SECTION

Golden section.

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

BrentOptimizerback to summary
public BrentOptimizer(double rel, double abs, ConvergenceChecker<UnivariatePointValuePair> checker)

Deprecated

as a consequence of ConvergenceChecker being deprecated. See corresponding docs for further information.

The arguments are used implement the original stopping criterion of Brent's algorithm. abs and rel define a tolerance tol = rel |x| + abs. rel should be no smaller than 2 macheps and preferably not much less than sqrt(macheps), where macheps is the relative machine precision. abs must be positive.

Parameters
rel:double

Relative threshold.

abs:double

Absolute threshold.

checker:ConvergenceChecker<UnivariatePointValuePair>

Additional, user-defined, convergence checking procedure.

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

The arguments are used for implementing the original stopping criterion of Brent's algorithm. abs and rel define a tolerance tol = rel |x| + abs. rel should be no smaller than 2 macheps and preferably not much less than sqrt(macheps), where macheps is the relative machine precision. abs must be positive.

Parameters
rel:double

Relative threshold.

abs:double

Absolute threshold.

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

Method Detail

bestback to summary
private UnivariatePointValuePair best(UnivariatePointValuePair a, UnivariatePointValuePair b, boolean isMinim)

Deprecated

as a consequence of UnivariatePointValuePair being deprecated. See corresponding docs for further information.

Selects the best of two points.

Parameters
a:UnivariatePointValuePair

Point and value.

b:UnivariatePointValuePair

Point and value.

isMinim:boolean

true if the selected point must be the one with the lowest value.

Returns:UnivariatePointValuePair

the best point, or null if a and b are both null. When a and b have the same function value, a is returned.

doOptimizeback to summary
protected UnivariatePointValuePair doOptimize()

Implements abstract org.apache.commons.math3.optimization.univariate.BaseAbstractUnivariateOptimizer.doOptimize.

Doc from org.apache.commons.math3.optimization.univariate.BaseAbstractUnivariateOptimizer.doOptimize.

Deprecated

as a consequence of UnivariatePointValuePair being deprecated. See corresponding docs for further information.

Method for implementing actual optimization algorithms in derived classes.

Returns:UnivariatePointValuePair

the optimum and its corresponding function value.

Annotations
@Override