Class LineSearch
The algorithm works as follows:
- Initialize with the current point, function value, gradient, and search direction
- Check if the search direction makes a reasonable angle with the negative gradient
- Set an initial step size based on previous function decrease
- Perform parabolic extrapolation to find a better step size
- If needed, perform cubic interpolation to refine the step size
- Return the best point found along the search direction
This implementation is a translation of FORTRAN code written by Jay Ponder (search.f).
- Since:
- 1.0
- Author:
- Michael J. Schnieders
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enum
Enum representing the possible outcomes of a line search operation. -
Method Summary
Modifier and TypeMethodDescriptiondouble
search
(int n, double[] x, double f, double[] g, double[] p, double[] angle, double fMove, LineSearch.LineSearchResult[] info, int[] functionEvaluations, OptimizationInterface optimizationSystem) Minimize a function along a search direction.
-
Method Details
-
search
public double search(int n, double[] x, double f, double[] g, double[] p, double[] angle, double fMove, LineSearch.LineSearchResult[] info, int[] functionEvaluations, OptimizationInterface optimizationSystem) Minimize a function along a search direction.This method performs a unidimensional line search along the specified search direction using parabolic extrapolation and cubic interpolation with both function and gradient values. The search attempts to find a step size that provides sufficient decrease in the function value while maintaining a reasonable angle between the search direction and negative gradient.
If the search is forced to proceed in an uphill direction (angle > DEFAULT_ANGLEMAX), the method returns after the initial step without performing the search.
The method modifies the input arrays x and g to contain the coordinates and gradient at the best point found along the search direction.
- Parameters:
n
- Number of variables in the optimization problem.x
- Current variable values (modified to contain the best point found).f
- Current function value at point x.g
- Current gradient values at point x (modified to contain the gradient at the best point).p
- Search direction vector.angle
- Output parameter that will contain the angle between the gradient and search direction.fMove
- Change in function value due to the previous optimization step.info
- Output parameter that will contain the line search result status.functionEvaluations
- Input/output parameter for tracking the number of function evaluations.optimizationSystem
- Implementation of theOptimizationInterface
that provides function values and gradients.- Returns:
- The final function value at the best point found.
- Since:
- 1.0
-