public class LineSearch
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
private static double |
ABS_TOL_UNUSED
Value that will pass the precondition check for
BrentOptimizer
but will not pass the convergence check, so that the custom checker
will always decide when to stop the line search. |
private BracketFinder |
bracket
Automatic bracketing.
|
private double |
initialBracketingRange
Extent of the initial interval used to find an interval that
brackets the optimum.
|
private UnivariateOptimizer |
lineOptimizer
Optimizer used for line search.
|
private MultivariateOptimizer |
mainOptimizer
Optimizer on behalf of which the line search must be performed.
|
private static double |
REL_TOL_UNUSED
Value that will pass the precondition check for
BrentOptimizer
but will not pass the convergence check, so that the custom checker
will always decide when to stop the line search. |
Constructor and Description |
---|
LineSearch(MultivariateOptimizer optimizer,
double relativeTolerance,
double absoluteTolerance,
double initialBracketingRange)
The
BrentOptimizer default stopping criterion uses the
tolerances to check the domain (point) values, not the function
values. |
Modifier and Type | Method and Description |
---|---|
UnivariatePointValuePair |
search(double[] startPoint,
double[] direction)
Finds the number
alpha that optimizes
f(startPoint + alpha * direction) . |
private static final double REL_TOL_UNUSED
BrentOptimizer
but will not pass the convergence check, so that the custom checker
will always decide when to stop the line search.private static final double ABS_TOL_UNUSED
BrentOptimizer
but will not pass the convergence check, so that the custom checker
will always decide when to stop the line search.private final UnivariateOptimizer lineOptimizer
private final BracketFinder bracket
private final double initialBracketingRange
private final MultivariateOptimizer mainOptimizer
public LineSearch(MultivariateOptimizer optimizer, double relativeTolerance, double absoluteTolerance, double initialBracketingRange)
BrentOptimizer
default stopping criterion uses the
tolerances to check the domain (point) values, not the function
values.
The relativeTolerance
and absoluteTolerance
arguments are thus passed to a custom checker
that will use the function values.optimizer
- Optimizer on behalf of which the line search
be performed.
Its computeObjectiveValue
method will be called by the
search
method.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.public UnivariatePointValuePair search(double[] startPoint, double[] direction)
alpha
that optimizes
f(startPoint + alpha * direction)
.startPoint
- Starting point.direction
- Search direction.TooManyEvaluationsException
- if the number of evaluations is exceeded.