From 7b4f9d3fc47c998c31d47953bbe0ae3cac777516 Mon Sep 17 00:00:00 2001 From: Julien Gacon Date: Mon, 4 Jul 2022 10:57:07 +0200 Subject: [PATCH] Fix ``maxfun`` default in ``L_BFGS`` (Qiskit/qiskit-terra#8285) * Fix maxfun and rm deprecated arg * update docs, rm "epsilon" * add reno * lint * update reno --- qiskit_algorithms/optimizers/l_bfgs_b.py | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/qiskit_algorithms/optimizers/l_bfgs_b.py b/qiskit_algorithms/optimizers/l_bfgs_b.py index 1b5cf676..6b26ee80 100644 --- a/qiskit_algorithms/optimizers/l_bfgs_b.py +++ b/qiskit_algorithms/optimizers/l_bfgs_b.py @@ -16,7 +16,6 @@ import numpy as np - from .scipy_optimizer import SciPyOptimizer @@ -39,7 +38,7 @@ class L_BFGS_B(SciPyOptimizer): # pylint: disable=invalid-name and also to form an estimate of the Hessian matrix (second derivative) of :math:`f`. L-BFGS-B extends L-BFGS to handle simple, per-variable bound constraints. - Uses scipy.optimize.fmin_l_bfgs_b. + Uses ``scipy.optimize.fmin_l_bfgs_b``. For further detail, please refer to https://docs.scipy.org/doc/scipy/reference/optimize.minimize-lbfgsb.html """ @@ -49,10 +48,9 @@ class L_BFGS_B(SciPyOptimizer): # pylint: disable=invalid-name # pylint: disable=unused-argument def __init__( self, - maxfun: int = 1000, + maxfun: int = 15000, maxiter: int = 15000, ftol: float = 10 * np.finfo(float).eps, - factr: Optional[float] = None, iprint: int = -1, eps: float = 1e-08, options: Optional[dict] = None, @@ -63,17 +61,18 @@ def __init__( Args: maxfun: Maximum number of function evaluations. maxiter: Maximum number of iterations. - ftol: The iteration stops when (f\^k - f\^{k+1})/max{\|f\^k\|,\|f\^{k+1}\|,1} <= ftol. - iprint: Controls the frequency of output. iprint < 0 means no output; - iprint = 0 print only one line at the last iteration; 0 < iprint < 99 - print also f and \|proj g\| every iprint iterations; iprint = 99 print - details of every iteration except n-vectors; iprint = 100 print also the - changes of active set and final x; iprint > 100 print details of - every iteration including x and g. + ftol: The iteration stops when + :math:`(f^k - f^{k+1}) / \max\{|f^k|, |f^{k+1}|,1\} \leq \text{ftol}`. + iprint: Controls the frequency of output. ``iprint < 0`` means no output; + ``iprint = 0`` print only one line at the last iteration; ``0 < iprint < 99`` + print also :math:`f` and :math:`|\text{proj} g|` every iprint iterations; + ``iprint = 99`` print details of every iteration except n-vectors; ``iprint = 100`` + print also the changes of active set and final :math:`x`; ``iprint > 100`` print + details of every iteration including :math:`x` and :math:`g`. eps: If jac is approximated, use this value for the step size. options: A dictionary of solver options. max_evals_grouped: Max number of default gradient evaluations performed simultaneously. - kwargs: additional kwargs for scipy.optimize.minimize. + kwargs: additional kwargs for ``scipy.optimize.minimize``. """ if options is None: options = {}