pele.optimize._lbfgs_py#
- class pele.optimize._lbfgs_py.LBFGS[source]
-
class LBFGS:minimize a function using the LBFGS routine
- Parameters:
- Xarray
the starting configuration for the minimization
- pot
the potential object
- nstepsint
the maximum number of iterations
- tolfloat
the minimization will stop when the rms grad is less than tol
- iprintint
how often to print status information
- maxstepfloat
the maximum step size
- maxErisefloat
the maximum the energy is alowed to rise during a step. The step size will be reduced until this condition is satisfied.
- Mint
the number of previous iterations to use in determining the optimal step
- rel_energybool
if True, then maxErise the the relative maximum the energy is allowed to rise during a step
- H0float
the initial guess for the inverse diagonal Hessian. This particular implementation of LBFGS takes all the inverse diagonal components to be the same.
- eventslist of callables
these are called after each iteration. events can also be added using attachEvent()
- alternate_stop_criterioncallable
this criterion will be used rather than rms gradiant to determine when to stop the iteration
- debug
print debugging information
- loggerlogger object
messages will be passed to this logger rather than the default
- energy, gradientfloat, float array
The initial energy and gradient. If these are both not None then the energy and gradient of the initial point will not be calculated, saving one potential call.
- armijobool
Use the Armijo criterion instead of maxErise as the criterion for accepting a step size. The Armijo criterion is the first wolfe criterion and is a condition that the energy decrease sufficiently
- armijo_cfloat
This adjusts how strong the armijo rule is. 0 < armijo_c < 1. Default 1e-4
- fortranbool
use the fortran version of the LBFGS. Only the step which computes the step size and direction from the memory is in fortran.
See also
MYLBFGSthis implemented in a compiled language
pele.optimize.lbfgs_pya function wrapper
Notes
This each iteration of this minimization routine is composed of the following parts
determine a step size and direction using the LBFGS algorithm
ensure the step size is appropriate (see maxErise and maxstep). Reduce the step size until conditions are satisfied.
take step
- LBFGS.set_state()[source]
-
def set_state(self, state):set the LBFGS memory from the passed state
- LBFGS.update_coords()[source]
-
def update_coords(self, X, E, G):change the location of the minimizer manually
If the position change is too great the LBFGS memory will not accurately represent the local curvature.
- LBFGS.getStep()[source]
-
def getStep(self, X, G):update the LBFGS memory and compute a step direction and size
http://en.wikipedia.org/wiki/Limited-memory_BFGS
Liu and Nocedal 1989 http://dx.doi.org/10.1007/BF01589116
- LBFGS.adjustStepSize()[source]
-
def adjustStepSize(self, X, E, G, stp):We now have a proposed step. This function will make sure it is a good step and then take it. This is known as a Backtracking linesearch
http://en.wikipedia.org/wiki/Backtracking_line_search
if the step is not anti-aligned with the gradient (i.e. downhill), then reverse the step
if the step is larger than maxstep, then rescale the step
calculate the energy and gradient of the new position
- if the step increases the energy by more than maxErise,
then reduce the step size and go to 3)
if the step is reduced more than 10 times and the energy is still not acceptable, then increment nfail, reset the lbfgs optimizer and continue
if nfail is greater than 5 abort the quench
- LBFGS.stop_criterion_satisfied()[source]
-
def stop_criterion_satisfied(self):test the stop criterion
- LBFGS.run()[source]
-
def run(self):run the LBFGS minimizer
stop when the stop criterion is satisfied or when the maximum number of steps is reached
- Returns:
- return a results object