forte2.helpers.lbfgs#
Module Contents#
- class forte2.helpers.lbfgs.LBFGS#
Limited-memory Broyden-Fletcher-Goldfarb-Shanno (L-BFGS) optimizer.
- Parameters:
- mint, optional, default=6
The number of vectors to keep in memory for the L-BFGS update.
- epsilonfloat, optional, default=1.0e-5
Convergence threshold to terminate the minimization: |g| < ε * max(1, |x|).
- maxiterint, optional, default=20
Maximum number of iterations for the optimization.
- maxiter_linesearchint, optional, default=5
Maximum number of trials for line search to find the optimal step length.
- max_dirfloat, optional, default=1.0e15
Maximum absolute value allowed in the direction vector.
- line_search_conditionstr, optional, default=’strong_wolfe’
Condition to terminate line search backtracking. Options are ‘armijo’, ‘wolfe’, or ‘strong_wolfe’.
- step_length_methodstr, optional, default=’line_bracketing_zoom’
Method to determine step lengths. Options are ‘max_correction’, ‘line_backtracking’, or ‘line_bracketing_zoom’.
- min_stepfloat, optional, default=1.0e-15
Minimum step length allowed during line search.
- max_stepfloat, optional, default=1.0e15
Maximum step length allowed during line search.
- c1float, optional, default=1.0e-4
Parameter for the Armijo condition in line search.
- c2float, optional, default=0.9
Parameter for the Wolfe curvature condition in line search.
Notes
Translated into Python from Forte v1: evangelistalab/forte For implementation details, see Wikipedia https://en.wikipedia.org/wiki/Limited-memory_BFGS and Numerical Optimization 2nd Ed. by Jorge Nocedal and Stephen J. Wright
- m: int = 6#
- epsilon: float = 1e-05#
- maxiter: int = 20#
- maxiter_linesearch: int = 5#
- max_dir: float = 1000000000000000.0#
- line_search_condition: str = 'strong_wolfe'#
- step_length_method: str = 'line_bracketing_zoom'#
- min_step: float = 1e-15#
- max_step: float = 1000000000000000.0#
- c1: float = 0.0001#
- c2: float = 0.9#
- log_level: int#
- warn_if_not_converged: bool = False#
- dtype: type#
- converged: bool = False#
- iter: int = 0#
- p: numpy.typing.NDArray#
- minimize(obj, x)#
The minimization for the objective function
- Parameters:
- objobject
Target function to minimize, it should should be encapsulated in a class that has the following methods:
fx, g = obj.evaluate(x, g, do_g=True)where gradientgis modified by the function,fxis the function return value, andgis computed whendo_g==True. If diagonal Hessian is specified,h0 = obj.hess_diag(x)should be available.- xNDArray
The initial value of
xas input, the final value ofxas output.
- Returns:
- fxfloat
The function value at optimized
x.
- class forte2.helpers.lbfgs.LBFGS_scipy#
A wrapper for the SciPy L-BFGS optimization. For debug use only.
- epsilon: float = 1e-05#
- maxiter: int = 20#
- c1: float = 0.0001#
- c2: float = 0.9#
- print: int = 1#
- m: int = 6#
- maxiter_linesearch: int = 5#
- max_dir: float = 1000000000000000.0#
- line_search_condition: str = 'strong_wolfe'#
- step_length_method: str = 'line_bracketing_zoom'#
- min_step: float = 1e-15#
- max_step: float = 1000000000000000.0#
- minimize(obj, x)#
- class forte2.helpers.lbfgs.NewtonRaphson#
- epsilon: float = 1e-05#
- maxiter: int = 20#
- c1: float = 0.0001#
- c2: float = 0.9#
- print: int = 1#
- m: int = 6#
- maxiter_linesearch: int = 5#
- max_dir: float = 1000000000000000.0#
- line_search_condition: str = 'strong_wolfe'#
- step_length_method: str = 'line_bracketing_zoom'#
- min_step: float = 1e-15#
- max_step: float = 1000000000000000.0#
- minimize(obj, x)#