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