java.lang.Object
org.hipparchus.optim.nonlinear.vector.constrained.LineSearch

public class LineSearch extends Object
Robust Line Search strategy.

This class manages monotone and non-monotone line search. Switching is automatic after repeated failures of the monotone search.

Typical parameter values used in Schittkowski's algorithms:

  • maxHistory = 5 to 10 (memory for non-monotone search)
  • sigma = 1e-4 or 1e-5 (Armijo sufficient decrease parameter)
  • beta = 0.5 (step reduction factor)
  • alphaMin (minimum allowed step length)
  • alphaMax = 1.0 (maximum allowed step length)
  • maxMonotoneFailures = 20 to 50 (failures before switching to non-monotone)
  • maxBadSteps = 3 to 5 (allowed consecutive bad steps before Hessian reset)
Since:
4.1
  • Constructor Summary

    Constructors
    Constructor
    Description
    LineSearch(double minAlpha, int maxHistory, double mu, double beta, int maxMonotoneFailures, int maxBadSteps)
    Simple constructor.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    acceptStep(double fxNew, double fxCurrent, double alpha, double directionalDeriv)
    Verify Armijo condition for accept step.
    int
    Get number of iterations in line search.
    boolean
    Check if bad step has been detected.
    boolean
    Check if too many consecutive bad step have been detected.
    void
    Mark Good Step if line search worked.
    void
    Reset bad steps count and indicators.
    double
    Main line search process: tries monotone first, then non-monotone.
    void
    updateHistory(double fx)
    Save penalty value when step is accepted for reusing in case of non-monotone research.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • LineSearch

      public LineSearch(double minAlpha, int maxHistory, double mu, double beta, int maxMonotoneFailures, int maxBadSteps)
      Simple constructor.
      Parameters:
      minAlpha - minimum step for line search
      maxHistory - maximum penalty history size
      mu - parameter for evaluation of Armijo condition for descend direction
      beta - step reduction factor
      maxMonotoneFailures - failures before switching to non-monotone
      maxBadSteps - allowed consecutive bad steps before Hessian reset
  • Method Details

    • isBadStepDetected

      public boolean isBadStepDetected()
      Check if bad step has been detected.
      Returns:
      true if bad step has been detected
    • isBadStepFailed

      public boolean isBadStepFailed()
      Check if too many consecutive bad step have been detected.
      Returns:
      true if too many consecutive bad step have been detected
    • getIteration

      public int getIteration()
      Get number of iterations in line search.
      Returns:
      number of iterations in line search
    • resetBadStepCount

      public void resetBadStepCount()
      Reset bad steps count and indicators.
    • updateHistory

      public void updateHistory(double fx)
      Save penalty value when step is accepted for reusing in case of non-monotone research.
      Parameters:
      fx - penalty
    • acceptStep

      public boolean acceptStep(double fxNew, double fxCurrent, double alpha, double directionalDeriv)
      Verify Armijo condition for accept step.
      Parameters:
      fxNew - penalty at candidate point x+dx*alpha
      fxCurrent - penalty at the current point
      alpha - step length
      directionalDeriv - penalty gradient
      Returns:
      true or false
    • markGoodStep

      public void markGoodStep()
      Mark Good Step if line search worked.
    • search

      public double search(MeritFunctionL2 f)
      Main line search process: tries monotone first, then non-monotone.
      Parameters:
      f - penalty function
      Returns:
      alpha