1 | function output = callsdpa(interfacedata) |
---|
2 | |
---|
3 | % Author Johan Löfberg |
---|
4 | % $Id: callsdpa.m,v 1.4 2005/06/08 13:52:18 joloef Exp $ |
---|
5 | |
---|
6 | % Retrieve needed data |
---|
7 | options = interfacedata.options; |
---|
8 | F_struc = interfacedata.F_struc; |
---|
9 | c = interfacedata.c; |
---|
10 | K = interfacedata.K; |
---|
11 | x0 = interfacedata.x0; |
---|
12 | ub = interfacedata.ub; |
---|
13 | lb = interfacedata.lb; |
---|
14 | |
---|
15 | % Bounded variables converted to constraints |
---|
16 | if ~isempty(ub) |
---|
17 | [F_struc,K] = addbounds(F_struc,K,ub,lb); |
---|
18 | end |
---|
19 | |
---|
20 | % Convert from internal (sedumi) format |
---|
21 | [mDIM,nBLOCK,bLOCKsTRUCT,c,F] = sedumi2sdpa(F_struc,c,K); |
---|
22 | |
---|
23 | solvertime = clock; |
---|
24 | |
---|
25 | if options.verbose==0 |
---|
26 | options.sdpa.print = 'no'; |
---|
27 | else |
---|
28 | options.sdpa.print = 'display'; |
---|
29 | end |
---|
30 | |
---|
31 | if options.savedebug |
---|
32 | ops = options.sdpa; |
---|
33 | save sdpadebug mDIM nBLOCK bLOCKsTRUCT c F ops |
---|
34 | end |
---|
35 | |
---|
36 | if options.showprogress;showprogress(['Calling ' interfacedata.solver.tag],options.showprogress);end |
---|
37 | |
---|
38 | solvertime = clock; |
---|
39 | [objVal,x,X,Y,INFO]=sdpam(mDIM,nBLOCK,bLOCKsTRUCT,c,F,[],[],[],options.sdpa); |
---|
40 | solvertime = etime(clock,solvertime); |
---|
41 | |
---|
42 | % Create variables in YALMIP internal format |
---|
43 | Primal = x; |
---|
44 | |
---|
45 | Dual = []; |
---|
46 | for i = 1:length(Y) |
---|
47 | Dual = [Dual;Y{i}(:)]; |
---|
48 | end |
---|
49 | |
---|
50 | Slack = []; |
---|
51 | if options.saveduals |
---|
52 | for i = 1:length(X) |
---|
53 | Slack = [Slack;X{i}(:)]; |
---|
54 | end |
---|
55 | end |
---|
56 | |
---|
57 | switch (INFO.phasevalue) |
---|
58 | case 'pdOPT' |
---|
59 | problem = 0; |
---|
60 | case {'noINFO','pFEAS','dFEAS','pdFEAS'} |
---|
61 | problem = 3; |
---|
62 | case 'pFEAS_dINF' |
---|
63 | problem = 2; |
---|
64 | case 'pINF_dFEAS' |
---|
65 | problem = 1; |
---|
66 | case 'pUNBD' |
---|
67 | problem = 2; |
---|
68 | case 'dUNBD' |
---|
69 | problem = 1; |
---|
70 | case 'pdINF' |
---|
71 | problem = 12; |
---|
72 | otherwise |
---|
73 | problem = -1; |
---|
74 | end |
---|
75 | infostr = yalmiperror(problem,interfacedata.solver.tag); |
---|
76 | |
---|
77 | if options.savesolveroutput |
---|
78 | solveroutput.objVal = objVal; |
---|
79 | solveroutput.x = x; |
---|
80 | solveroutput.X = X; |
---|
81 | solveroutput.Y = Y; |
---|
82 | solveroutput.INFO = INFO; |
---|
83 | else |
---|
84 | solveroutput = []; |
---|
85 | end |
---|
86 | |
---|
87 | if options.savesolverinput |
---|
88 | solverinput.mDIM = mDIM; |
---|
89 | solverinput.nBLOCK=nBLOCK; |
---|
90 | solverinput.bLOCKsTRUCT=bLOCKsTRUCT; |
---|
91 | solverinput.c=c; |
---|
92 | solverinput.F=F; |
---|
93 | else |
---|
94 | solverinput = []; |
---|
95 | end |
---|
96 | |
---|
97 | % Standard interface |
---|
98 | output.Primal = Primal; |
---|
99 | output.Dual = Dual; |
---|
100 | output.Slack = Slack; |
---|
101 | output.problem = problem; |
---|
102 | output.infostr = infostr; |
---|
103 | output.solverinput = solverinput; |
---|
104 | output.solveroutput= solveroutput; |
---|
105 | output.solvertime = solvertime; |
---|