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

public Class LineSearch

extends Object
Class Inheritance
Imports
org.apache.commons.math3.optim.univariate.UnivariateOptimizer, .BrentOptimizer, .BracketFinder, .UnivariatePointValuePair, .SimpleUnivariateValueChecker, .SearchInterval, .UnivariateObjectiveFunction, org.apache.commons.math3.analysis.UnivariateFunction, org.apache.commons.math3.optim.MaxEval

Class for finding the minimum of the objective function along a given direction.
Since
3.3

Field Summary

Modifier and TypeField and Description
private static final 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 final BracketFinder
bracket

Automatic bracketing.

private final double
initialBracketingRange

Extent of the initial interval used to find an interval that brackets the optimum.

private final UnivariateOptimizer
lineOptimizer

Optimizer used for line search.

private final MultivariateOptimizer
mainOptimizer

Optimizer on behalf of which the line search must be performed.

private static final 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 Summary

AccessConstructor and Description
public
LineSearch(MultivariateOptimizer
Optimizer on behalf of which the line search be performed. Its computeObjectiveValue method will be called by the search method.
optimizer
,
double
Search will stop when the function relative difference between successive iterations is below this value.
relativeTolerance
,
double
Search will stop when the function absolute difference between successive iterations is below this value.
absoluteTolerance
,
double
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.
initialBracketingRange
)

The BrentOptimizer default stopping criterion uses the tolerances to check the domain (point) values, not the function values.

Method Summary

Modifier and TypeMethod and Description
public UnivariatePointValuePair

Returns:

the optimum.
search
(final double[]
Starting point.
startPoint
,
final double[]
Search direction.
direction
)

Finds the number alpha that optimizes f(startPoint + alpha * direction).

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

ABS_TOL_UNUSEDback to summary
private static final 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.

bracketback to summary
private final BracketFinder bracket

Automatic bracketing.

initialBracketingRangeback to summary
private final double initialBracketingRange

Extent of the initial interval used to find an interval that brackets the optimum.

lineOptimizerback to summary
private final UnivariateOptimizer lineOptimizer

Optimizer used for line search.

mainOptimizerback to summary
private final MultivariateOptimizer mainOptimizer

Optimizer on behalf of which the line search must be performed.

REL_TOL_UNUSEDback to summary
private static final 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 Detail

LineSearchback to summary
public 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. The relativeTolerance and absoluteTolerance arguments are thus passed to a custom checker that will use the function values.

Parameters
optimizer:MultivariateOptimizer

Optimizer on behalf of which the line search be performed. Its computeObjectiveValue method will be called by the search method.

relativeTolerance:double

Search will stop when the function relative difference between successive iterations is below this value.

absoluteTolerance:double

Search will stop when the function absolute difference between successive iterations is below this value.

initialBracketingRange:double

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

searchback to summary
public UnivariatePointValuePair search(final double[] startPoint, final double[] direction)

Finds the number alpha that optimizes f(startPoint + alpha * direction).

Parameters
startPoint:double[]

Starting point.

direction:double[]

Search direction.

Returns:UnivariatePointValuePair

the optimum.

Exceptions
TooManyEvaluationsException:
if the number of evaluations is exceeded.