qcqps_knitro
- qcqps_knitro(H, c, Q, B, lq, uq, A, l, u, xmin, xmax, x0, opt)
qcqps_knitro()- Quadratically Constrained Quadratic Program Solver based on Artelys Knitro.[X, F, EXITFLAG, OUTPUT, LAMBDA] = ... QCQPS_KNITRO(H, C, Q, B, LQ, UQ, A, L, U, XMIN, XMAX, X0, OPT) [X, F, EXITFLAG, OUTPUT, LAMBDA] = QCQPS_KNITRO(PROBLEM) A wrapper function providing a standardized interface for using KNITRO to solve the following (possibly non-convex) QCQP (quadratically constrained quadratic programming) problem: min 1/2 X'*H*X + C'*X X subject to LQ(i) <= 1/2 X'*Q{i}*X + B(i,:)*X <= UQ(i), i = 1,2,...,nq (quadratic constraints) L <= A*X <= U (linear constraints) XMIN <= X <= XMAX (variable bounds) Inputs (all optional except H, C, Q, B, LQ, and UQ): H : matrix (possibly sparse) of quadratic cost coefficients C : vector of linear cost coefficients Q : nq x 1 cell array of sparse quadratic matrices for quadratic constraints B : matrix (possibly sparse) of linear term of quadratic constraints LQ, UQ: define the lower an upper bounds on the quadratic constraints 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 3 = even more verbose progress output knitro_opt - options struct for Artelys Knitro, value in verbose overrides these options PROBLEM : The inputs can alternatively be supplied in a single PROBLEM struct with fields corresponding to the input arguments described above: H, c, Q, B, lq, uq, A, l, u, xmin, xmax, x0, opt Outputs: X : solution vector F : final objective function value EXITFLAG : exit flag 1 = converged 0 or negative values = solver specific failure codes OUTPUT : output struct with the following fields: alg - algorithm code of solver used (others) - algorithm specific fields LAMBDA : struct 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 mu_lq - lower (left-hand) limit on quadratic constraints mu_uq - upper (right-hand) limit on quadratic constraints lower - lower bound on optimization variables upper - upper bound on optimization variables Calling syntax options: [x, f, exitflag, output, lambda] = ... qcqps_knitro(H, c, Q, B, lq, uq, A, l, u, xmin, xmax, x0, opt) x = qcqps_knitro(H, c, Q, B, lq, uq) x = qcqps_knitro(H, c, Q, B, lq, uq, A, l, u) x = qcqps_knitro(H, c, Q, B, lq, uq, A, l, u, xmin, xmax) x = qcqps_knitro(H, c, Q, B, lq, uq, A, l, u, xmin, xmax, x0) x = qcqps_knitro(H, c, Q, B, lq, uq, A, l, u, xmin, xmax, x0, opt) x = qcqps_knitro(problem), where problem is a struct with fields: H, c, Q, B, lq, uq, A, l, u, xmin, xmax, x0, opt all fields except 'c', are optional, and problem with linear costs must include constraints x = qcqps_knitro(...) [x, f] = qcqps_knitro(...) [x, f, exitflag] = qcqps_knitro(...) [x, f, exitflag, output] = qcqps_knitro(...) [x, f, exitflag, output, lambda] = qcqps_knitro(...) Example: (problem from https://docs.gurobi.com/projects/examples/en/current/examples/matlab/qcp.html) H = []; c = [-1;0;0]; Q = { sparse([2 0 0; 0 2 0; 0 0 -2]), ... sparse([2 0 0; 0 0 -2; 0 -2 0]) }; B = zeros(2,3); lq = [-Inf;-Inf]; uq = [0; 0]; A = [1 1 1]; l = 1; u = 1; xmin = zeros(3,1); xmax = Inf(3,1); x0 = zeros(3,1); opt = struct('verbose', 2); [x, f, s, out, lambda] = ... qcqps_knitro(H, c, Q, B, lq, uq, A, l, u, xmin, xmax, x0, opt);
See also
qcqps_master(),artelys_knitro_options(),qcqp_knitro