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

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

Added original make3d

File size: 2.3 KB
Line 
1function output = calldsdp(interfacedata)
2
3% Author Johan Löfberg
4% $Id: calldsdp.m,v 1.4 2005/05/07 13:53:20 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 SeDuMi format
21[C,A,b,blk] = sedumi2dsdp(F_struc,c,K);
22
23% Quadratic not yet implemented?
24options.dsdp.dual_quadratic=spalloc(length(c),length(c),0);
25
26options.dsdp.printyes = (options.verbose>0);
27solvertime = clock;
28if options.showprogress;showprogress(['Calling ' interfacedata.solver.tag],options.showprogress);end
29
30if options.savedebug
31    save dsdpdebug A C b options.dsdp
32end
33
34if isempty(x0)
35  if options.saveduals | options.savesolveroutput
36    [STAT,y,X] =  dsdp(A,C,b,options.dsdp);
37  else
38    [STAT,y] =  dsdp(A,C,b,options.dsdp);
39  end
40else
41  if options.saveduals | options.savesolveroutput
42    [STAT,y,X] =  dsdp(A,C,b,options.dsdp,x0); 
43  else
44    [STAT,y] =  dsdp(A,C,b,options.dsdp,x0);
45  end
46end
47solvertime = etime(clock,solvertime);
48
49% Create dual variable in internal format
50if options.saveduals
51    D_struc = [];
52    for i = 1:length(X)
53        D_struc = [D_struc;X{i}(:)];
54    end
55else
56    D_struc = [];
57end
58
59x = y;  % Our notation do not coincide ...
60switch STAT.termcode
61case 0
62        if STAT.iterates>=options.dsdp.maxit
63                problem = 3;
64        else
65                problem = 0;
66        end
67%     if STAT.gaphist (end) > options.dsdp.gaptol
68%         problem = 5;
69%     end
70case 1
71        problem = 2;
72case 2
73        problem = 1;
74case -3
75    problem = 3;
76otherwise
77        problem = -1;
78end
79infostr = yalmiperror(problem,interfacedata.solver.tag);
80
81if options.savesolveroutput
82        solveroutput.STAT = STAT;
83        solveroutput.X = X;
84        solveroutput.y = y;
85else
86        solveroutput = [];
87end
88
89if options.savesolverinput
90        solverinput.A = A;
91        solverinput.C = C;
92        solverinput.b = c;
93        solverinput.pars = options.dsdp;
94else
95        solverinput = [];
96end
97
98% Standard interface
99output.Primal      = x;
100output.Dual        = D_struc;
101output.Slack       = [];
102output.problem     = problem;
103output.infostr     = infostr;
104output.solverinput = solverinput;
105output.solveroutput= solveroutput;
106output.solvertime  = solvertime;
Note: See TracBrowser for help on using the repository browser.