Class LineSearch

java.lang.Object
ffx.numerics.optimization.LineSearch

public class LineSearch extends Object
This class implements an algorithm for uni-dimensional line search using parabolic extrapolation and cubic interpolation with both function and gradient values.

The algorithm works as follows:

  1. Initialize with the current point, function value, gradient, and search direction
  2. Check if the search direction makes a reasonable angle with the negative gradient
  3. Set an initial step size based on previous function decrease
  4. Perform parabolic extrapolation to find a better step size
  5. If needed, perform cubic interpolation to refine the step size
  6. 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
  • 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 the OptimizationInterface that provides function values and gradients.
      Returns:
      The final function value at the best point found.
      Since:
      1.0