qps_ipopt(H,
c,
A,
l,
u,
xmin,
xmax,
x0,
opt)
| source code
|
Quadratic Program Solver based on IPOPT.
Uses IPOPT to solve the following QP (quadratic programming)
problem:
min 1/2 x'*H*x + c'*x
x
subject to:
l <= A*x <= u (linear constraints)
xmin <= x <= xmax (variable bounds)
Inputs (all optional except H , C ,
A and L ):
-
H : matrix (possibly sparse) of quadratic cost
coefficients
-
C : vector of linear cost coefficients
-
A, l, u : define the optional linear constraints.
Default values for the elements of l and u
are -Inf and Inf, respectively.
-
xmin, xmax : optional lower and upper bounds on the
x variables, defaults are -Inf and Inf, respectively.
-
x0 : optional starting value of optimization vector
x
-
opt : optional options structure with the following
fields, all of which are also optional (default values shown in
parentheses)
-
verbose (0) - controls level of progress output
displayed
-
0 = no progress output
-
1 = some progress output
-
2 = verbose progress output
-
max_it (0) - maximum number of iterations allowed
-
0 = use algorithm default
-
ipopt_opt - options struct for IPOPT, values in
verbose and max_it override these
options
-
problem : The inputs can alternatively be supplied in a
single problem dict with fields corresponding to the
input arguments described above: H, c, A, l, u, xmin, xmax, x0,
opt
Outputs:
-
x : solution vector
-
f : final objective function value
-
exitflag : exit flag
-
1 = first order optimality conditions satisfied
-
0 = maximum number of iterations reached
-
-1 = numerically failed
-
output : output struct with the following fields:
-
iterations - number of iterations performed
-
hist - dict list with trajectories of the following:
feascond , gradcond ,
compcond , costcond , gamma ,
stepsize , obj , alphap ,
alphad
-
message - exit message
-
lmbda : dict containing the Langrange and Kuhn-Tucker
multipliers on the constraints, with fields:
-
mu_l - lower (left-hand) limit on linear constraints
-
mu_u - upper (right-hand) limit on linear
constraints
-
lower - lower bound on optimization variables
-
upper - upper bound on optimization variables
Calling syntax options:
x, f, exitflag, output, lmbda = qps_ipopt(H, c, A, l, u, xmin, xmax, x0, opt)
x = qps_ipopt(H, c, A, l, u)
x = qps_ipopt(H, c, A, l, u, xmin, xmax)
x = qps_ipopt(H, c, A, l, u, xmin, xmax, x0)
x = qps_ipopt(H, c, A, l, u, xmin, xmax, x0, opt)
x = qps_ipopt(problem), where problem is a struct with fields:
H, c, A, l, u, xmin, xmax, x0, opt
all fields except 'c', 'A' and 'l' or 'u' are optional
x = qps_ipopt(...)
x, f = qps_ipopt(...)
x, f, exitflag = qps_ipopt(...)
x, f, exitflag, output = qps_ipopt(...)
x, f, exitflag, output, lmbda = qps_ipopt(...)
Example:
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 = {'verbose': 2)
x, f, s, out, lam = qps_ipopt(H, c, A, l, u, xmin, [], x0, opt)
Problem from http://www.jmu.edu/docs/sasdoc/sashtml/iml/chap8/sect12.htm
See Also:
pyipopt , ipopt_options
- Authors:
-
Ray Zimmerman (PSERC Cornell),
Richard Lincoln
|