qps_mips
- qps_mips(H, c, A, l, u, xmin, xmax, x0, opt)
qps_mips()
- Quadratic Program Solver based on MIPS.[x, f, exitflag, output, lambda] = ... qps_mips(H, c, A, l, u, xmin, xmax, x0, opt) x = qps_mips(H, c, A, l, u) x = qps_mips(H, c, A, l, u, xmin, xmax) x = qps_mips(H, c, A, l, u, xmin, xmax, x0) x = qps_mips(H, c, A, l, u, xmin, xmax, x0, opt) x = qps_mips(problem) where problem is a struct with fields: H, c, A, l, u, xmin, xmax, x0, opt all fields are optional, except if H is missing or all zeros, then c must *not* be missing or all zeros, and linear constraints or variable bounds must be supplied x = qps_mips(...) [x, f] = qps_mips(...) [x, f, exitflag] = qps_mips(...) [x, f, exitflag, output] = qps_mips(...) [x, f, exitflag, output, lambda] = qps_mips(...)
A wrapper function providing a standardized interface for using
mips()
, the MATPOWER Interior Point Solver (MIPS), to solve the following QP (quadratic programming) problem:(6)\[\min_\x f(\x) = \frac{1}{2} \trans{\x} \param{\cmat{H}} \x + \trans{\param{\rvec{c}}} \x\]subject to
(7)\[\param{\rvec{l}} \le \param{\cmat{A}} \x \le \param{\rvec{u}}\](8)\[\param{\x}_\mathrm{min} \le \x \le \param{\x}_\mathrm{max}\]where (6)–(8) are, respectively, the objective function, linear constraints, and variable bounds.
- Inputs:
(all optional except that, if
H
is missing or all zeros, thenc
must not be missing or all zeros, and linear constraints or variable bounds must be supplied)H (double) – (optional, default all zeros) matrix \(\param{\cmat{H}}\) (possibly sparse) of quadratic cost coefficients
c (double) – (optional, default all zeros) vector of linear cost coefficients \(\param{\rvec{c}}\)
A, l, u (double) – (optional, respective defaults \([empty, -\infty, +\infty]\) ) matrix \(\param{\cmat{A}}\) and vectors \(\param{\rvec{l}}\) and \(\param{\rvec{u}}\) to define the linear constraints in (7)
xmin, xmax (double) – (optional, respective defaults \([-\infty, +\infty]\) ) lower and upper bounds, \(\param{\x}_\mathrm{min}\) and \(\param{\x}_\mathrm{max}\), on the optimization variables \(\x\)
x0 (double) – (optional, default all zeros) starting value of optimization vector \(\x\)
opt (struct) – (optional) MIPS options structure (see
mips()
for details)problem (struct) – The inputs can alternatively be supplied in a single
problem
struct with fields corresponding to the input arguments described above, namely,H
,c
,A
,l
,u
,x0
,xmin
,xmax
, andopt
- Outputs:
x (double) – solution vector, \(\x\)
f (double) – final objective function value, \(f(\x)\)
exitflag (integer) – exit flag
1 = first order optimality conditions satisfied
0 = maximum number of iterations reached
-1 = numerically failed
output (struct) – output struct with fields:
iterations
- number of iterations performedhist
- struct array with trajectories of the following:feascond
,gradcond
,compcond
,costcond
,gamma
,stepsize
,obj
,alphap
,alphad
message
- exit message
lambda (struct) – struct containing the Langrange and Kuhn-Tucker multipliers on the constraints, with fields:
mu_l
- lower (left-hand) limit on linear constraintsmu_u
- upper (right-hand) limit on linear constraintslower
- lower bound on optimization variablesupper
- upper bound on optimization variables
Note the calling syntax is almost identical to that of
quadprog()
from MathWorks’ Optimization Toolbox. The main difference is that the linear constraints are specified withA
,l
,u
instead ofA
,B
,Aeq
,Beq
.Example: (problem from https://v8doc.sas.com/sashtml/iml/chap8/sect12.htm):
H = [ 1003.1 4.3 6.3 5.9; 4.3 2.2 2.1 3.9; 6.3 2.1 3.5 4.8; 5.9 3.9 4.8 10 ]; c = zeros(4,1); A = [ 1 1 1 1; 0.17 0.11 0.10 0.18 ]; l = [1; 0.10]; u = [1; Inf]; xmin = zeros(4,1); x0 = [1; 0; 0; 1]; opt = struct('verbose', 2); [x, f, s, out, lambda] = qps_mips(H, c, A, l, u, xmin, [], x0, opt);
See also
mips()
.