qp⚓︎
A small dense solver for the strictly convex quadratic programs of an SQP method.
solve_qp(B, g, A_eq=None, b_eq=None, A_iq=None, b_iq=None, lb=None, ub=None, rho=None, rho_max=None, tol=1e-09, maxiter=None)
⚓︎
Solve the quadratic program of an SQP step,
The linear constraints are relaxed with non-negative slacks that cost rho each (an
exact penalty), which does two things. A feasible starting point always exists
(d = 0 with the slacks taking up the violation), so a primal active-set method needs
no first phase; and constraints that cannot all hold, which happens for the
linearisation of a nonlinear problem far from the solution, still give a step that
reduces their violation. rho is raised until the slacks vanish or stop shrinking.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
B
|
(ndarray, shape(n, n))
|
Symmetric positive definite Hessian. |
required |
g
|
(ndarray, shape(n))
|
Gradient. |
required |
A_eq
|
(ndarray, shape(m_eq, n) and (m_eq,))
|
Equality constraints. |
None
|
b_eq
|
(ndarray, shape(m_eq, n) and (m_eq,))
|
Equality constraints. |
None
|
A_iq
|
(ndarray, shape(m_iq, n) and (m_iq,))
|
Inequality constraints. |
None
|
b_iq
|
(ndarray, shape(m_iq, n) and (m_iq,))
|
Inequality constraints. |
None
|
lb
|
(ndarray, shape(n))
|
Bounds on |
None
|
ub
|
(ndarray, shape(n))
|
Bounds on |
None
|
rho
|
float
|
First penalty on the slacks. Default: ten times the largest gradient element, at least 1. |
None
|
rho_max
|
float
|
Largest penalty tried. Default: |
None
|
tol
|
float
|
Tolerance on steps, multipliers and slacks. |
1e-09
|
maxiter
|
int
|
Active-set iterations per solve. Default: 50 times the number of variables and constraints. |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
d |
(ndarray, shape(n))
|
The step. |
multipliers |
dict
|
|
info |
dict
|
|