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

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

Added original make3d

File size: 2.5 KB
Line 
1function output = callcplexmex(interfacedata)
2
3% Author Johan Löfberg
4% $Id: callcplexmex.m,v 1.4 2006/05/03 07:58:45 joloef Exp $
5
6% Retrieve needed data
7options = interfacedata.options;
8F_struc = interfacedata.F_struc;
9c       = interfacedata.c;
10Q       = interfacedata.Q;
11K       = interfacedata.K;
12x0      = interfacedata.x0;
13integer_variables = interfacedata.integer_variables;
14binary_variables = interfacedata.binary_variables;
15LB      = interfacedata.lb;
16UB      = interfacedata.ub;
17
18showprogress('Calling CPLEXMEX',options.showprogress);
19
20if ~isempty(LB)
21    LB(isinf(LB)) = -1e12;
22    UB(isinf(UB)) = 1e12;
23end
24
25SENSE = 1;   
26C = c(:);
27if ~isempty(F_struc)
28    A =-F_struc(:,2:end);
29    B = full(F_struc(:,1));
30else
31    A = zeros(1,length(c));A(1)=1;
32    B = 1e6;
33end
34
35H = 2*full(Q);
36if nnz(H)==0
37    H = [];
38end
39
40CTYPE = repmat('L',K.l+K.f,1);  % Standard variables
41CTYPE(1:K.f) = 'E';             % Equality constrained variables
42VARTYPE = repmat('C',size(A,2),1);
43VARTYPE(binary_variables)  = 'B';
44VARTYPE(integer_variables) = 'I';
45
46options.cplexmex.msglev = options.verbose;
47if options.cplexmex.msglev>1
48    options.cplexmex.msglev = 1;
49end
50
51% Call mex-interface
52solvertime = clock;
53if options.savedebug
54save cplexmexdebug
55end
56
57[x,OPT,STATUS,EXTRA]= cplexmex(SENSE,H,C,A,B,CTYPE,LB,UB,VARTYPE,x0,options.cplexmex);
58solvertime = etime(clock,solvertime);
59problem = 0;
60
61D_struc = -EXTRA.lambda;
62
63% Check, currently not exhaustive...
64switch STATUS
65    case {1,101,102}
66        problem = 0;
67    case {3,103}
68        problem = 1;
69    case {2,118}
70        problem = 2;
71    case {4,119}
72        problem = 12;
73    otherwise
74        problem = -1;
75end
76infostr = yalmiperror(problem,'CPLEXMEX');     
77
78% Save all data sent to solver?
79if options.savesolverinput
80    solverinput.SENSE = SENSE;   
81    solverinput.H = H;
82        solverinput.A = A;
83        solverinput.C = C;
84        solverinput.B = B;
85        solverinput.CTYPE = CTYPE;
86        solverinput.LB = LB;
87        solverinput.UB = UB;
88        solverinput.VARTYPE = VARTYPE;
89    solverinput.x0 = x0;   
90    solverinput.param = options.cplexmex;
91else
92        solverinput = [];
93end
94
95% Save all data from the solver?
96if options.savesolveroutput
97        solveroutput.X = x;
98    solveroutput.OPT = OPT;
99    solveroutput.STATUS = STATUS;
100    solveroutput.EXTRA = EXTRA;
101else
102        solveroutput = [];
103end
104
105% Standard interface
106output.Primal      = x;
107output.Dual        = D_struc;
108output.Slack       = [];
109output.problem     = problem;
110output.infostr     = infostr;
111output.solverinput = solverinput;
112output.solveroutput= solveroutput;
113output.solvertime  = solvertime;
Note: See TracBrowser for help on using the repository browser.