{ } Raw JSON

bundles / scipy 1.17.1 / scipy / optimize / _slsqp_py / _minimize_slsqp

function

scipy.optimize._slsqp_py:_minimize_slsqp

source: /scipy/optimize/_slsqp_py.py :219

Signature

def   _minimize_slsqp ( func x0 args = () jac = None bounds = None constraints = () maxiter = 100 ftol = 1e-06 iprint = 1 disp = False eps = 1.4901161193847656e-08 callback = None finite_diff_rel_step = None workers = None ** unknown_options )

Summary

Minimize a scalar function of one or more variables using Sequential Least Squares Programming (SLSQP).

Parameters

ftol : float

Precision target for the value of f in the stopping criterion. This value controls the final accuracy for checking various optimality conditions; gradient of the lagrangian and absolute sum of the constraint violations should be lower than ftol. Similarly, computed step size and the objective function changes are checked against this value. Default is 1e-6.

eps : float

Step size used for numerical approximation of the Jacobian.

disp : bool

Set to True to print convergence messages. If False, verbosity is ignored and set to 0.

maxiter : int, optional

Maximum number of iterations. Default value is 100.

finite_diff_rel_step : None or array_like, optional

If jac in ['2-point', '3-point', 'cs'] the relative step size to use for numerical approximation of jac. 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.

workers : int, 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).

Returns

res : OptimizeResult

The optimization result represented as an OptimizeResult object. In this dict-like object the following fields are of particular importance: x the solution array, success a Boolean flag indicating if the optimizer exited successfully, message which describes the reason for termination, and multipliers which contains the Karush-Kuhn-Tucker (KKT) multipliers for the QP approximation used in solving the original nonlinear problem. See Notes below. See also OptimizeResult for a description of other attributes.

Notes

The KKT multipliers are returned in the OptimizeResult.multipliers attribute as a NumPy array. Denoting the dimension of the equality constraints with meq, and of inequality constraints with mineq, then the returned array slice m[:meq] contains the multipliers for the equality constraints, and the remaining m[meq:meq + mineq] contains the multipliers for the inequality constraints. The multipliers corresponding to bound inequalities are not returned. See [1] pp. 321 or [2] for an explanation of how to interpret these multipliers. The internal QP problem is solved using the methods given in [3] Chapter 25.

Note that if new-style NonlinearConstraint or LinearConstraint were used, then minimize converts them first to old-style constraint dicts. It is possible for a single new-style constraint to simultaneously contain both inequality and equality constraints. This means that if there is mixing within a single constraint, then the returned list of multipliers will have a different length than the original new-style constraints.

Aliases

  • scipy.optimize._minimize._minimize_slsqp