Skip to main content
`Ctrl`+`K`

# minimize(method=’L-BFGS-B’)

scipy.optimize.minimize(fun, x0, args=(), method=None, jac=None, hess=None, hessp=None, bounds=None, constraints=(), tol=None, callback=None, options=None)

  Minimize a scalar function of one or more variables using the L-BFGS-B algorithm.

  See also

  For documentation for the rest of the parameters, see `scipy.optimize.minimize`

  Options:
    ——-
    dispNone or int

      Deprecated option that previously controlled the text printed on the screen during the problem solution. Now the code does not emit any output and this keyword has no function.

      Deprecated since version 1.15.0: This keyword is deprecated and will be removed from SciPy 1.18.0.

    maxcorint

      The maximum number of variable metric corrections used to define the limited memory matrix. (The limited memory BFGS method does not store the full hessian but uses this many terms in an approximation to it.)

    ftolfloat

      The iteration stops when `(f^k - f^{k+1})/max{|f^k|,|f^{k+1}|,1} <= ftol`.

    gtolfloat

      The iteration will stop when `max{|proj g_i | i = 1, ..., n} <= gtol` where `proj g_i` is the i-th component of the projected gradient.

    epsfloat or ndarray

      If jac is None the absolute step size used for numerical approximation of the jacobian via forward differences.

    maxfunint

      Maximum number of function evaluations before minimization terminates. Note that this function may violate the limit if the gradients are evaluated by numerical differentiation.

    maxiterint

      Maximum number of algorithm iterations.

    iprintint, optional

      Deprecated option that previously controlled the text printed on the screen during the problem solution. Now the code does not emit any output and this keyword has no function.

      Deprecated since version 1.15.0: This keyword is deprecated and will be removed from SciPy 1.18.0.

    maxlsint, optional

      Maximum number of line search steps (per iteration). Default is 20.

    finite_diff_rel_stepNone or array_like, optional

      If `jac in ['2-point', '3-point', 'cs']` the relative step size to use for numerical approximation of the jacobian. The absolute step size is computed as `h = rel_step * sign(x) * max(1, abs(x))`, possibly adjusted to fit into the bounds. For `method='3-point'` the sign of h is ignored. If None (default) then step is selected automatically.

    workersint, map-like callable, optional

      A map-like callable, such as multiprocessing.Pool.map for evaluating any numerical differentiation in parallel. This evaluation is carried out as `workers(fun, iterable)`.

      Added in version 1.16.0.

  Notes

  The option ftol is exposed via the `scipy.optimize.minimize` interface, but calling `scipy.optimize.fmin_l_bfgs_b` directly exposes factr. The relationship between the two is `ftol = factr * numpy.finfo(float).eps`. I.e., factr multiplies the default machine floating-point precision to arrive at ftol. If the minimization is slow to converge the optimizer may halt if the total number of function evaluations exceeds maxfun, or the number of algorithm iterations has reached maxiter (whichever comes first). If this is the case then `result.success=False`, and an appropriate error message is contained in `result.message`.