[37] | 1 | function output = callipqp(varargin) |
---|
| 2 | % Author Johan Löfberg |
---|
| 3 | % $Id: callipqp.m,v 1.2 2004/06/30 07:37:03 johanl Exp $ |
---|
| 4 | |
---|
| 5 | |
---|
| 6 | % Retrieve needed data |
---|
| 7 | interfacedata = varargin{1}; |
---|
| 8 | options = interfacedata.options; |
---|
| 9 | F_struc = interfacedata.F_struc; |
---|
| 10 | c = interfacedata.c; |
---|
| 11 | K = interfacedata.K; |
---|
| 12 | x0 = interfacedata.x0; |
---|
| 13 | Q = 2*interfacedata.Q; |
---|
| 14 | ub = interfacedata.ub; |
---|
| 15 | lb = interfacedata.lb; |
---|
| 16 | |
---|
| 17 | |
---|
| 18 | showprogress('Calling IPQP',options.showprogress); |
---|
| 19 | |
---|
| 20 | if K.f>0 |
---|
| 21 | A = -F_struc(1:K.f,2:end); |
---|
| 22 | b = F_struc(1:K.f,1); |
---|
| 23 | else |
---|
| 24 | A = []; |
---|
| 25 | b = []; |
---|
| 26 | end |
---|
| 27 | |
---|
| 28 | if K.l>0 |
---|
| 29 | C = -F_struc(1+K.f:K.f+K.l,2:end); |
---|
| 30 | d = F_struc(1+K.f:K.f+K.l,1); |
---|
| 31 | else |
---|
| 32 | C = []; |
---|
| 33 | d = []; |
---|
| 34 | end |
---|
| 35 | |
---|
| 36 | if ~isempty(ub) |
---|
| 37 | C = [C;eye(length(c))]; |
---|
| 38 | d = [d;ub]; |
---|
| 39 | end |
---|
| 40 | if ~isempty(lb) |
---|
| 41 | C = [C;-eye(length(c))]; |
---|
| 42 | d = [d;-lb]; |
---|
| 43 | end |
---|
| 44 | |
---|
| 45 | solvertime = clock; |
---|
| 46 | [x,problem] = ipqp(2*Q,c,C,d,A,b); |
---|
| 47 | solvertime = etime(clock,solvertime); |
---|
| 48 | |
---|
| 49 | % Internal format for duals |
---|
| 50 | D_struc = []; |
---|
| 51 | |
---|
| 52 | switch problem |
---|
| 53 | case 0 |
---|
| 54 | problem = 0; |
---|
| 55 | infostr = yalmiperror(problem,'IPQP'); |
---|
| 56 | case 1 |
---|
| 57 | problem = 1; |
---|
| 58 | infostr = yalmiperror(problem,'IPQP'); |
---|
| 59 | otherwise |
---|
| 60 | |
---|
| 61 | problem = 2; |
---|
| 62 | infostr = yalmiperror(problem,'IPQP'); |
---|
| 63 | end |
---|
| 64 | |
---|
| 65 | % Save all data sent to solver? |
---|
| 66 | if options.savesolverinput |
---|
| 67 | % solverinput.A = A; |
---|
| 68 | % solverinput.b = b; |
---|
| 69 | % solverinput.C = Aq; |
---|
| 70 | % solverinput.q = beq; |
---|
| 71 | % solverinput.c = c; |
---|
| 72 | % solverinput.H = Q; |
---|
| 73 | % solverinput.options = options.nag; |
---|
| 74 | else |
---|
| 75 | solverinput = []; |
---|
| 76 | end |
---|
| 77 | |
---|
| 78 | % Save all data from the solver? |
---|
| 79 | if options.savesolveroutput |
---|
| 80 | % solveroutput.x = x; |
---|
| 81 | % solveroutput.fmin = fmin; |
---|
| 82 | % solveroutput.flag = flag; |
---|
| 83 | % solveroutput.output=output; |
---|
| 84 | % solveroutput.lambda=lambda; |
---|
| 85 | else |
---|
| 86 | solveroutput = []; |
---|
| 87 | end |
---|
| 88 | |
---|
| 89 | |
---|
| 90 | |
---|
| 91 | % Standard interface |
---|
| 92 | output.x = x; |
---|
| 93 | output.problem = problem; |
---|
| 94 | output.infostr = infostr; |
---|
| 95 | output.solverinput = solverinput; |
---|
| 96 | output.solveroutput= solveroutput; |
---|
| 97 | output.solvertime = solvertime; |
---|
| 98 | output.D_struc = D_struc; |
---|