meshi.optimizers
Class WolfConditionLineSearch
java.lang.Object
meshi.optimizers.LineSearch
meshi.optimizers.WolfConditionLineSearch
public class WolfConditionLineSearch
- extends LineSearch
This class implements a line search that satisfies the Wolf conditions according to the scheme in: Numerical Optimization
by J. Nocendal & S. J. Wright, Springer 1999, pp 55-62.
Being in position Xk, and having a descent search direction Pk, a step length (alpha) is sought, that leads to a new position Xk+1,
so that Xk+1 = Xk + alpha*Pk, and stisfies the 2 Wolf conditons:
1) E(Xk+1) < E(Xk) + c1*alpha*grad(Xk)*Pk (sufficient decrease)
2) |grad(Xk+1)*Pk| < c2*|grad(Xk)*Pk| (curvature condition)
The implementation follows the one in the above reference. In short, the variable alpha is iteratively enlarged, until it
brackets (with the previous iteration value) an interval that contain some points with the Wolf conditions. The function
Zoom is then called, that finds the exact alpha where the Wolf conditions hold. The initial choice of alpha (at the first
iteration) is the popular min{1 , -2*(E(Xk-1) - E(Xk))/(grad(Xk)*Pk)}. Other choices are possible to code if this one
leads to failure of the line search algorithm. This algorithm is safe guarded against infinite loop, by a condition on the
maximal number of energy evaluations. See bellow what to do if this condition is violated.
How to use this class:
----------------------
a) Instantiate this class with the desired parameters.
b) In a position Xk: evaluate the energy gradients and coordinates to position Xk.
c) Run 'findStepLength(Vec[n][2])' where the first column in Vec is the position Xk, and the second
column is the direction Pk. This method returns the found step length. This method also changes the coordinates
in class 'energy' to the coordinates in the new (minimized) position: Xk+1 = Xk + (step_length)*Pk. Also the
gradients in the energy class are updated.
d) Check for thrown exceptions to make sure that the step length is correct.
Parameters (Good default values are given after the parameter name)
----------
c1,c2 - 1e-4,0.9 - The two paramters of the Wolf conditions. Must satisfy: 0
|
Method Summary |
double |
findStepLength(double[][] inputCoordinates)
|
void |
Reset()
|
void |
Reset(double resAlpha)
|
private void |
Zoom(double[][] inputCoordinates,
int inv)
|
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
maxNumEvaluations
private double maxNumEvaluations
extendAlphaFactor
private double extendAlphaFactor
c1
private double c1
c2
private double c2
interSafeGuardFactor
private final double interSafeGuardFactor
- See Also:
- Constant Field Values
interSafeGuard
private double interSafeGuard
oldE
private double oldE
newE
private double newE
coordinates
private double[][] coordinates
firstRun
private int firstRun
alphaI
private double alphaI
alphaI1
private double alphaI1
alphaFinal
private double alphaFinal
n
private int n
e0
private double e0
eI
private double eI
eI1
private double eI1
grad0
private double grad0
gradI
private double gradI
gradI1
private double gradI1
numAlphaEvaluations
private int numAlphaEvaluations
stop
private int stop
i
private int i
WolfConditionLineSearch
public WolfConditionLineSearch(TotalEnergy energy,
double c1,
double c2,
double extendAlphaFactor,
int maxNumEvaluations)
Reset
public void Reset()
Reset
public void Reset(double resAlpha)
findStepLength
public double findStepLength(double[][] inputCoordinates)
throws LineSearchException
- Specified by:
findStepLength in class LineSearch
- Throws:
LineSearchException
Zoom
private void Zoom(double[][] inputCoordinates,
int inv)