Class BrentOptimizer
- java.lang.Object
-
- org.apache.commons.math3.optimization.univariate.BaseAbstractUnivariateOptimizer
-
- org.apache.commons.math3.optimization.univariate.BrentOptimizer
-
- All Implemented Interfaces:
BaseOptimizer<UnivariatePointValuePair>,BaseUnivariateOptimizer<UnivariateFunction>,UnivariateOptimizer
- Direct Known Subclasses:
PowellOptimizer.LineSearch
@Deprecated public class BrentOptimizer extends BaseAbstractUnivariateOptimizer
Deprecated.As of 3.1 (to be removed in 4.0).For a function defined on some interval(lo, hi), this class finds an approximationxto 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- to use an initial guess provided by the user,
- to ensure that the best point encountered is the one returned.
- Since:
- 2.0
-
-
Field Summary
Fields Modifier and Type Field Description private doubleabsoluteThresholdDeprecated.Absolute threshold.private static doubleGOLDEN_SECTIONDeprecated.Golden section.private static doubleMIN_RELATIVE_TOLERANCEDeprecated.Minimum relative tolerance.private doublerelativeThresholdDeprecated.Relative threshold.
-
Constructor Summary
Constructors Constructor Description BrentOptimizer(double rel, double abs)Deprecated.The arguments are used for implementing the original stopping criterion of Brent's algorithm.BrentOptimizer(double rel, double abs, ConvergenceChecker<UnivariatePointValuePair> checker)Deprecated.The arguments are used implement the original stopping criterion of Brent's algorithm.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description private UnivariatePointValuePairbest(UnivariatePointValuePair a, UnivariatePointValuePair b, boolean isMinim)Deprecated.Selects the best of two points.protected UnivariatePointValuePairdoOptimize()Deprecated.Method for implementing actual optimization algorithms in derived classes.-
Methods inherited from class org.apache.commons.math3.optimization.univariate.BaseAbstractUnivariateOptimizer
computeObjectiveValue, getConvergenceChecker, getEvaluations, getGoalType, getMax, getMaxEvaluations, getMin, getStartValue, optimize, optimize
-
-
-
-
Field Detail
-
GOLDEN_SECTION
private static final double GOLDEN_SECTION
Deprecated.Golden section.
-
MIN_RELATIVE_TOLERANCE
private static final double MIN_RELATIVE_TOLERANCE
Deprecated.Minimum relative tolerance.
-
relativeThreshold
private final double relativeThreshold
Deprecated.Relative threshold.
-
absoluteThreshold
private final double absoluteThreshold
Deprecated.Absolute threshold.
-
-
Constructor Detail
-
BrentOptimizer
public BrentOptimizer(double rel, double abs, ConvergenceChecker<UnivariatePointValuePair> checker)Deprecated.The arguments are used implement the original stopping criterion of Brent's algorithm.absandreldefine a tolerancetol = rel |x| + abs.relshould be no smaller than 2 macheps and preferably not much less than sqrt(macheps), where macheps is the relative machine precision.absmust be positive.- Parameters:
rel- Relative threshold.abs- Absolute threshold.checker- Additional, user-defined, convergence checking procedure.- Throws:
NotStrictlyPositiveException- ifabs <= 0.NumberIsTooSmallException- ifrel < 2 * Math.ulp(1d).
-
BrentOptimizer
public BrentOptimizer(double rel, double abs)Deprecated.The arguments are used for implementing the original stopping criterion of Brent's algorithm.absandreldefine a tolerancetol = rel |x| + abs.relshould be no smaller than 2 macheps and preferably not much less than sqrt(macheps), where macheps is the relative machine precision.absmust be positive.- Parameters:
rel- Relative threshold.abs- Absolute threshold.- Throws:
NotStrictlyPositiveException- ifabs <= 0.NumberIsTooSmallException- ifrel < 2 * Math.ulp(1d).
-
-
Method Detail
-
doOptimize
protected UnivariatePointValuePair doOptimize()
Deprecated.Method for implementing actual optimization algorithms in derived classes.- Specified by:
doOptimizein classBaseAbstractUnivariateOptimizer- Returns:
- the optimum and its corresponding function value.
-
best
private UnivariatePointValuePair best(UnivariatePointValuePair a, UnivariatePointValuePair b, boolean isMinim)
Deprecated.Selects the best of two points.- Parameters:
a- Point and value.b- Point and value.isMinim-trueif the selected point must be the one with the lowest value.- Returns:
- the best point, or
nullifaandbare bothnull. Whenaandbhave the same function value,ais returned.
-
-