1 | function output = callsdpt330(interfacedata) |
---|
2 | |
---|
3 | % Author Johan Löfberg |
---|
4 | % $Id: callsdpt330.m,v 1.3 2005/05/07 13:53:20 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 | [C,A,b,blk] = sdpt3struct2sdpt3block(F_struc,c,K); |
---|
22 | |
---|
23 | % To be sure |
---|
24 | global CACHE_SIZE % cache size in kbytes |
---|
25 | global LOOP_LEVEL % loop unrolling level |
---|
26 | CACHE_SIZE = options.sdpt3.CACHE_SIZE; |
---|
27 | LOOP_LEVEL = options.sdpt3.LOOP_LEVEL; |
---|
28 | |
---|
29 | solvertime = clock; |
---|
30 | A = svec(blk,A,ones(size(blk,1),1)); |
---|
31 | |
---|
32 | if options.savedebug |
---|
33 | save sdpt3debug blk A C b x0 options.sdpt3 |
---|
34 | end |
---|
35 | |
---|
36 | showprogress('Calling SDPT3',options.showprogress); |
---|
37 | if options.verbose==0 |
---|
38 | evalc('[obj,X,y,Z,gaphist,infeashist,info,Xiter,yiter,Ziter] = sqlp(blk,A,C,b,[],x0,[],options.sdpt3);'); |
---|
39 | else |
---|
40 | [obj,X,y,Z,gaphist,infeashist,info,Xiter,yiter,Ziter] = sqlp(blk,A,C,b,[],x0,[],options.sdpt3); |
---|
41 | end |
---|
42 | solvertime = etime(clock,solvertime); |
---|
43 | |
---|
44 | % Create dual variable in internal format |
---|
45 | D_struc = []; |
---|
46 | if K.l>0 |
---|
47 | D_struc = [D_struc;X{1}(:)]; |
---|
48 | if length(X)>1 |
---|
49 | X = {X{2:end}}; |
---|
50 | end |
---|
51 | end |
---|
52 | if K.q(1)>0 |
---|
53 | D_struc = [D_struc;X{1}(:)]; |
---|
54 | if length(X)>1 |
---|
55 | X = {X{2:end}}; |
---|
56 | end |
---|
57 | end |
---|
58 | if K.r(1)>0 |
---|
59 | D_struc = [D_struc;X{1}(:)]; |
---|
60 | if length(X)>1 |
---|
61 | X = {X{2:end}}; |
---|
62 | end |
---|
63 | end |
---|
64 | if K.s(1)>0 |
---|
65 | top = 1; |
---|
66 | j = 1; |
---|
67 | for i = 1:1:length(K.s) |
---|
68 | Xi = X{j}(top:top+K.s(i)-1,top:top+K.s(i)-1); |
---|
69 | D_struc = [D_struc;Xi(:)]; |
---|
70 | top = top + K.s(i); |
---|
71 | if top>length(X{j}) |
---|
72 | j = j + 1; |
---|
73 | top = 1; |
---|
74 | end |
---|
75 | end |
---|
76 | end |
---|
77 | |
---|
78 | x = y; % Our notation do not coincide ... |
---|
79 | |
---|
80 | % Convert error code |
---|
81 | switch info(1) |
---|
82 | case 0 |
---|
83 | problem = 0; % No problems detected |
---|
84 | case -1 |
---|
85 | problem = 5; % Lack of progress |
---|
86 | case {-2,-3,-4,-5} |
---|
87 | problem = 4; % Numerical problems |
---|
88 | case -6 |
---|
89 | problem = 3; % Maximum iterations exceeded |
---|
90 | case -10 |
---|
91 | problem = 7; % YALMIP sent incorrect input to solver |
---|
92 | case 1 |
---|
93 | problem = 2; % Dual feasibility |
---|
94 | case 2 |
---|
95 | problem = 1; % Primal infeasibility |
---|
96 | otherwise |
---|
97 | problem = -1; % Unknown error |
---|
98 | end |
---|
99 | infostr = yalmiperror(problem,interfacedata.solver.tag); |
---|
100 | |
---|
101 | if options.savesolveroutput |
---|
102 | solveroutput.obj = obj; |
---|
103 | solveroutput.X = X; |
---|
104 | solveroutput.y = y; |
---|
105 | solveroutput.Z = Z; |
---|
106 | solveroutput.gaphist = gaphist; |
---|
107 | solveroutput.infeashist = infeashist; |
---|
108 | solveroutput.info = info; |
---|
109 | solveroutput.Xiter = Xiter; |
---|
110 | solveroutput.yiter = yiter; |
---|
111 | solveroutput.Ziter = Ziter; |
---|
112 | else |
---|
113 | solveroutput = []; |
---|
114 | end |
---|
115 | |
---|
116 | if options.savesolverinput |
---|
117 | solverinput.blk = blk; |
---|
118 | solverinput.A = A; |
---|
119 | solverinput.C = C; |
---|
120 | solverinput.b = b; |
---|
121 | solverinput.X0 = []; |
---|
122 | solverinput.y0 = x0; |
---|
123 | solverinput.Z0 = []; |
---|
124 | solverinput.options = options.sdpt3; |
---|
125 | else |
---|
126 | solverinput = []; |
---|
127 | end |
---|
128 | |
---|
129 | |
---|
130 | % Standard interface |
---|
131 | output.Primal = x(:); |
---|
132 | output.Dual = D_struc; |
---|
133 | output.Slack = []; |
---|
134 | output.problem = problem; |
---|
135 | output.infostr = infostr; |
---|
136 | output.solverinput = solverinput; |
---|
137 | output.solveroutput= solveroutput; |
---|
138 | output.solvertime = solvertime; |
---|