source: proiecte/pmake3d/make3d_original/Make3dSingleImageStanford_version0.1/third_party/opt/yalmip/solvers/callsdpt331.m @ 37

Last change on this file since 37 was 37, checked in by (none), 14 years ago

Added original make3d

File size: 3.4 KB
Line 
1function output = callsdpt331(interfacedata)
2
3% Author Johan Löfberg
4% $Id: callsdpt331.m,v 1.9 2006/03/20 19:32:21 joloef Exp $
5
6% Retrieve needed data
7options = interfacedata.options;
8F_struc = interfacedata.F_struc;
9c       = interfacedata.c;
10K       = interfacedata.K;
11x0      = interfacedata.x0;
12ub      = interfacedata.ub;
13lb      = interfacedata.lb;
14
15% Bounded variables converted to constraints
16if ~isempty(ub)
17    [F_struc,K] = addbounds(F_struc,K,ub,lb);
18end
19
20% Convert from internal (sedumi-like) format
21[blk,A,C,b,oldKs]=sedumi2sdpt3(F_struc(:,1),F_struc(:,2:end),c,K,options.sdpt3.smallblkdim);
22
23options.sdpt3.printyes=double(options.verbose);
24options.sdpt3.expon=options.sdpt3.expon(1);
25if options.savedebug
26    ops = options.sdpt3;
27    save sdpt3debug blk A C b ops x0
28end
29
30if options.showprogress;showprogress(['Calling ' interfacedata.solver.tag],options.showprogress);end
31solvertime = clock;
32if options.verbose==0 % SDPT3 does not run silent despite printyes=0!
33   evalc('[obj,X,y,Z,info,runhist] =  sqlp(blk,A,C,b,options.sdpt3,[],x0,[]);');
34else
35    [obj,X,y,Z,info,runhist] =  sqlp(blk,A,C,b,options.sdpt3,[],x0,[]);   
36end
37
38% Create YALMIP dual variable and slack
39Dual = [];
40Slack = [];
41top = 1;
42if K.f>0
43    Dual = [Dual;X{top}(:)];
44    Slack = [Slack;Z{top}(:)];
45    top = top+1;
46end
47if K.l>0
48    Dual = [Dual;X{top}(:)];
49    Slack = [Slack;Z{top}(:)];
50    top = top + 1;
51end
52if K.q(1)>0
53    Dual = [Dual;X{top}(:)];
54    Slack = [Slack;Z{top}(:)];
55    top = top + 1;
56end
57if K.s(1)>0 
58    % Messy format in SDPT3 to block and sort small SDPs
59    u = blk(:,1);
60    u = find([u{:}]=='s');
61    s = 1;
62    for top = u
63        ns = blk(top,2);ns = ns{1};
64        k = 1;
65        for i = 1:length(ns)
66            Xi{oldKs(s)} = X{top}(k:k+ns(i)-1,k:k+ns(i)-1);
67            Zi{oldKs(s)} = Z{top}(k:k+ns(i)-1,k:k+ns(i)-1);
68            s = s + 1;                 
69            k = k+ns(i);
70        end
71    end
72    for i = 1:length(Xi)
73        Dual = [Dual;Xi{i}(:)];     
74        Slack = [Slack;Zi{i}(:)];     
75    end
76end
77
78solvertime = etime(clock,solvertime);
79Primal = -y;  % Primal variable in YALMIP
80
81% Convert error code
82switch info.termcode
83    case 0
84        problem = 0; % No problems detected
85    case {-1,-5}
86        problem = 5; % Lack of progress
87    case {-2,-3,-4,-7}
88        problem = 4; % Numerical problems
89    case -6
90        problem = 3; % Maximum iterations exceeded
91    case -10
92        problem = 7; % YALMIP sent incorrect input to solver
93    case 1
94        problem = 2; % Dual feasibility
95    case 2
96        problem = 1; % Primal infeasibility
97    otherwise
98        problem = -1; % Unknown error
99end
100infostr = yalmiperror(problem,interfacedata.solver.tag);
101
102if options.savesolveroutput
103    solveroutput.obj = obj;
104    solveroutput.X = X;
105    solveroutput.y = y;
106    solveroutput.Z = Z;
107    solveroutput.info = info;
108    solveroutput.runhist = runhist;
109 else
110    solveroutput = [];
111end
112
113if options.savesolverinput
114    solverinput.blk = blk;
115    solverinput.A   = A;
116    solverinput.C   = C;
117    solverinput.b   = b;
118    solverinput.X0   = [];
119    solverinput.y0   = x0;
120    solverinput.Z0   = [];
121    solverinput.options   = options.sdpt3;
122else
123    solverinput = [];
124end
125
126% Standard interface
127output.Primal      = Primal;
128output.Dual        = Dual;
129output.Slack       = Slack;
130output.problem     = problem;
131output.infostr     = infostr;
132output.solverinput = solverinput;
133output.solveroutput= solveroutput;
134output.solvertime  = solvertime;
Note: See TracBrowser for help on using the repository browser.