------------------------------ deprecated ------------------------------ Use QPS_MATPOWER instead. -------------------------------------------------------------------------- MP_QP Quadratic program solver. [X, LAMBDAOUT, HOWOUT, SUCCESS] = ... MP_QP(H, f, A, b, VLB, VUB, X0, N, VERBOSE, ALG, OPT) A common wrapper for various QP solvers, using the calling syntax of QP from version 1 of the Optimization Toolbox, with the exception that verbose == 0 means no output. The optional argument alg determines the solver. alg = 100 : BPMPD_MEX alg = 200 : MIPS, MATLAB Interior Point Solver pure MATLAB implementation of a primal-dual interior point method alg = 250 : MIPS-sc, a step controlled variant of MIPS alg = 300 : Optimization Toolbox, QUADPROG or QP alg = 400 : IPOPT alg = 500 : CPLEX alg = 600 : MOSEK alg = 700 : Gurobi If ALG is missing or equal to zero, the first available solver is used. An additional optional argument OPT can be used to set algorithm specific options. From the Optimization Toolbox v.1 docs ... X=QP(H,f,A,b) solves the quadratic programming problem: min 0.5*x'Hx + f'x subject to: Ax <= b x X=QP(H,f,A,b,VLB,VUB) defines a set of lower and upper bounds on the design variables, X, so that the solution is always in the range VLB <= X <= VUB. X=QP(H,f,A,b,VLB,VUB,X0) sets the initial starting point to X0. X=QP(H,f,A,b,VLB,VUB,X0,N) indicates that the first N constraints defined by A and b are equality constraints. X=QP(H,f,A,b,VLB,VUB,X0,N,DISPLAY) controls the level of warning messages displayed. Warning messages can be turned off with DISPLAY = -1. [x,LAMBDA]=QP(H,f,A,b) returns the set of Lagrangian multipliers, LAMBDA, at the solution. [X,LAMBDA,HOW] = QP(H,f,A,b) also returns a string HOW that indicates error conditions at the final iteration. QP produces warning messages when the solution is either unbounded or infeasible.
0001 function [xout, lambdaout, howout, success] = mp_qp(H,f,A,b,VLB,VUB,x0,N,verbose,alg,opt) 0002 %------------------------------ deprecated ------------------------------ 0003 % Use QPS_MATPOWER instead. 0004 %-------------------------------------------------------------------------- 0005 %MP_QP Quadratic program solver. 0006 % [X, LAMBDAOUT, HOWOUT, SUCCESS] = ... 0007 % MP_QP(H, f, A, b, VLB, VUB, X0, N, VERBOSE, ALG, OPT) 0008 % 0009 % A common wrapper for various QP solvers, using the calling syntax of 0010 % QP from version 1 of the Optimization Toolbox, with the exception 0011 % that verbose == 0 means no output. The optional argument alg 0012 % determines the solver. 0013 % alg = 100 : BPMPD_MEX 0014 % alg = 200 : MIPS, MATLAB Interior Point Solver 0015 % pure MATLAB implementation of a primal-dual 0016 % interior point method 0017 % alg = 250 : MIPS-sc, a step controlled variant of MIPS 0018 % alg = 300 : Optimization Toolbox, QUADPROG or QP 0019 % alg = 400 : IPOPT 0020 % alg = 500 : CPLEX 0021 % alg = 600 : MOSEK 0022 % alg = 700 : Gurobi 0023 % If ALG is missing or equal to zero, the first available solver is used. 0024 % An additional optional argument OPT can be used to set algorithm 0025 % specific options. 0026 % 0027 % From the Optimization Toolbox v.1 docs ... 0028 % X=QP(H,f,A,b) solves the quadratic programming problem: 0029 % 0030 % min 0.5*x'Hx + f'x subject to: Ax <= b 0031 % x 0032 % 0033 % X=QP(H,f,A,b,VLB,VUB) defines a set of lower and upper 0034 % bounds on the design variables, X, so that the solution 0035 % is always in the range VLB <= X <= VUB. 0036 % 0037 % X=QP(H,f,A,b,VLB,VUB,X0) sets the initial starting point to X0. 0038 % 0039 % X=QP(H,f,A,b,VLB,VUB,X0,N) indicates that the first N constraints 0040 % defined by A and b are equality constraints. 0041 % 0042 % X=QP(H,f,A,b,VLB,VUB,X0,N,DISPLAY) controls the level of warning 0043 % messages displayed. Warning messages can be turned off with 0044 % DISPLAY = -1. 0045 % 0046 % [x,LAMBDA]=QP(H,f,A,b) returns the set of Lagrangian multipliers, 0047 % LAMBDA, at the solution. 0048 % 0049 % [X,LAMBDA,HOW] = QP(H,f,A,b) also returns a string HOW that 0050 % indicates error conditions at the final iteration. 0051 % 0052 % QP produces warning messages when the solution is either unbounded 0053 % or infeasible. 0054 0055 % MATPOWER 0056 % $Id: mp_qp.m,v 1.31 2011/11/11 16:08:11 cvs Exp $ 0057 % by Ray Zimmerman, PSERC Cornell 0058 % Copyright (c) 1996-2010 by Power System Engineering Research Center (PSERC) 0059 % 0060 % This file is part of MATPOWER. 0061 % See http://www.pserc.cornell.edu/matpower/ for more info. 0062 % 0063 % MATPOWER is free software: you can redistribute it and/or modify 0064 % it under the terms of the GNU General Public License as published 0065 % by the Free Software Foundation, either version 3 of the License, 0066 % or (at your option) any later version. 0067 % 0068 % MATPOWER is distributed in the hope that it will be useful, 0069 % but WITHOUT ANY WARRANTY; without even the implied warranty of 0070 % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 0071 % GNU General Public License for more details. 0072 % 0073 % You should have received a copy of the GNU General Public License 0074 % along with MATPOWER. If not, see <http://www.gnu.org/licenses/>. 0075 % 0076 % Additional permission under GNU GPL version 3 section 7 0077 % 0078 % If you modify MATPOWER, or any covered work, to interface with 0079 % other modules (such as MATLAB code and MEX-files) available in a 0080 % MATLAB(R) or comparable environment containing parts covered 0081 % under other licensing terms, the licensors of MATPOWER grant 0082 % you additional permission to convey the resulting work. 0083 0084 %% set up options 0085 if nargin < 11 0086 opt = []; 0087 if nargin < 10 0088 alg = 0; 0089 end 0090 end 0091 if verbose == -1 0092 verbose = 0; 0093 end 0094 qps_opt = struct('alg', alg, 'verbose', verbose); 0095 if ~isempty(opt) 0096 qps_opt.mips_opt = opt; 0097 end 0098 0099 %% create lower limit for linear constraints 0100 m = size(A, 1); 0101 l = b; 0102 l((N+1):m) = -Inf * ones(m-N, 1); 0103 0104 %% call solver 0105 [xout, fval, howout, output, lambda] = qps_matpower(H, f, A, l, b, VLB, VUB, x0, qps_opt); 0106 0107 %% prepare output 0108 if nargout > 1 0109 lambdaout = [ lambda.mu_u - lambda.mu_l; 0110 lambda.lower; 0111 lambda.upper ]; 0112 if nargout > 3 0113 success = (howout == 1); 0114 end 0115 end