Class LineSearch
java.lang.Object
org.hipparchus.optim.nonlinear.vector.constrained.LineSearch
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
ConstructorsConstructorDescriptionLineSearch(double minAlpha, int maxHistory, double mu, double beta, int maxMonotoneFailures, int maxBadSteps) Simple constructor. -
Method Summary
Modifier and TypeMethodDescriptionbooleanacceptStep(double fxNew, double fxCurrent, double alpha, double directionalDeriv) Verify Armijo condition for accept step.intGet number of iterations in line search.booleanCheck if bad step has been detected.booleanCheck if too many consecutive bad step have been detected.voidMark Good Step if line search worked.voidReset bad steps count and indicators.doubleMain line search process: tries monotone first, then non-monotone.voidupdateHistory(double fx) Save penalty value when step is accepted for reusing in case of non-monotone research.
-
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 searchmaxHistory- maximum penalty history sizemu- parameter for evaluation of Armijo condition for descend directionbeta- step reduction factormaxMonotoneFailures- failures before switching to non-monotonemaxBadSteps- 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*alphafxCurrent- penalty at the current pointalpha- step lengthdirectionalDeriv- penalty gradient- Returns:
- true or false
-
markGoodStep
public void markGoodStep()Mark Good Step if line search worked. -
search
Main line search process: tries monotone first, then non-monotone.- Parameters:
f- penalty function- Returns:
- alpha
-