Class LineSearch
- java.lang.Object
-
- org.apache.commons.math3.optim.nonlinear.scalar.LineSearch
-
public class LineSearch extends java.lang.ObjectClass for finding the minimum of the objective function along a given direction.- Since:
- 3.3
-
-
Field Summary
Fields Modifier and Type Field Description private static doubleABS_TOL_UNUSEDValue that will pass the precondition check forBrentOptimizerbut will not pass the convergence check, so that the custom checker will always decide when to stop the line search.private BracketFinderbracketAutomatic bracketing.private doubleinitialBracketingRangeExtent of the initial interval used to find an interval that brackets the optimum.private UnivariateOptimizerlineOptimizerOptimizer used for line search.private MultivariateOptimizermainOptimizerOptimizer on behalf of which the line search must be performed.private static doubleREL_TOL_UNUSEDValue that will pass the precondition check forBrentOptimizerbut will not pass the convergence check, so that the custom checker will always decide when to stop the line search.
-
Constructor Summary
Constructors Constructor Description LineSearch(MultivariateOptimizer optimizer, double relativeTolerance, double absoluteTolerance, double initialBracketingRange)TheBrentOptimizerdefault stopping criterion uses the tolerances to check the domain (point) values, not the function values.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description UnivariatePointValuePairsearch(double[] startPoint, double[] direction)Finds the numberalphathat optimizesf(startPoint + alpha * direction).
-
-
-
Field Detail
-
REL_TOL_UNUSED
private static final double REL_TOL_UNUSED
Value that will pass the precondition check forBrentOptimizerbut will not pass the convergence check, so that the custom checker will always decide when to stop the line search.- See Also:
- Constant Field Values
-
ABS_TOL_UNUSED
private static final double ABS_TOL_UNUSED
Value that will pass the precondition check forBrentOptimizerbut will not pass the convergence check, so that the custom checker will always decide when to stop the line search.- See Also:
- Constant Field Values
-
lineOptimizer
private final UnivariateOptimizer lineOptimizer
Optimizer used for line search.
-
bracket
private final BracketFinder bracket
Automatic bracketing.
-
initialBracketingRange
private final double initialBracketingRange
Extent of the initial interval used to find an interval that brackets the optimum.
-
mainOptimizer
private final MultivariateOptimizer mainOptimizer
Optimizer on behalf of which the line search must be performed.
-
-
Constructor Detail
-
LineSearch
public LineSearch(MultivariateOptimizer optimizer, double relativeTolerance, double absoluteTolerance, double initialBracketingRange)
TheBrentOptimizerdefault stopping criterion uses the tolerances to check the domain (point) values, not the function values. TherelativeToleranceandabsoluteTolerancearguments are thus passed to acustom checkerthat will use the function values.- Parameters:
optimizer- Optimizer on behalf of which the line search be performed. ItscomputeObjectiveValuemethod will be called by thesearchmethod.relativeTolerance- Search will stop when the function relative difference between successive iterations is below this value.absoluteTolerance- Search will stop when the function absolute difference between successive iterations is below this value.initialBracketingRange- Extent of the initial interval used to find an interval that brackets the optimum. If the optimized function varies a lot in the vicinity of the optimum, it may be necessary to provide a value lower than the distance between successive local minima.
-
-
Method Detail
-
search
public UnivariatePointValuePair search(double[] startPoint, double[] direction)
Finds the numberalphathat optimizesf(startPoint + alpha * direction).- Parameters:
startPoint- Starting point.direction- Search direction.- Returns:
- the optimum.
- Throws:
TooManyEvaluationsException- if the number of evaluations is exceeded.
-
-