source: proiecte/pmake3d/make3d_original/Make3dSingleImageStanford_version0.1/third_party/opt/yalmip/solvers/callmiqp_cplex.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 = callqp_cplex(interfacedata)
2
3% Author Johan Löfberg
4% $Id: callmiqp_cplex.m,v 1.2 2005/05/07 13:53:20 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;
15ub      = interfacedata.ub;
16lb      = interfacedata.lb;
17
18showprogress('Calling CPLEXINT',options.showprogress);
19
20% Notation used
21C = full(c);                   
22if ~isempty(F_struc)
23    A = (-F_struc(:,2:end)); 
24    B = full(F_struc(:,1));       
25else
26    A = zeros(0,length(c))
27    B = zeros(0,0);
28end
29CTYPE = repmat('L',K.l+K.f,1);  % Standard variables
30CTYPE(1:K.f) = 'E';             % Equality constrained variables
31
32VARTYPE = repmat('C',length(C),1);  % Standard variables
33VARTYPE(integer_variables) = 'I';           
34VARTYPE(binary_variables)  = 'B';           
35
36% Call mex-interface
37solvertime = clock;
38
39if options.savedebug
40    save cplexdebug
41end
42
43try
44    [x,FMIN,QPSOLVED,STATUS,SLACK] = miqp_cplex(1,2*(Q),C,A,B,CTYPE,lb,ub,[],VARTYPE,[],[],options.verbose);
45    D_struc = [];
46catch
47    D_struc = [];
48    x = nan*ones(length(c),1);
49    STATUS = 32201; 
50    FMIN = [];
51    SLACK = [];
52end
53solvertime = etime(clock,solvertime);
54problem = 0;
55
56% Check, currently not exhaustive...
57switch STATUS
58case {1,101,102}
59    problem = 0;
60case {0,3}
61    problem = 1;
62case {2}
63    problem = 2;
64case {4,119}
65    problem = 12;
66case 32201
67    problem = -5;       
68otherwise
69    problem = -1;
70end
71infostr = yalmiperror(problem,'CPLEXINT');     
72
73% Save all data sent to solver?
74if options.savesolverinput
75    solverinput.SENSE = 1;
76    solverinput.A = A;
77    solverinput.C = C;
78    solverinput.B = B;
79    solverinput.CTYPE = CTYPE;
80    solverinput.LB = [];
81    solverinput.UB = [];
82    solverinput.X0 = [];
83    solverinput.SLACK = [];
84else
85    solverinput = [];
86end
87
88% Save all data from the solver?
89if options.savesolveroutput
90    solveroutput.XMIN = x;
91    solveroutput.FMIN = FMIN;
92    solveroutput.QPSOLVED = QPSOLVED;
93    solveroutput.STATUS = STATUS;
94    solveroutput.SLACK = SLACK;
95else
96    solveroutput = [];
97end
98
99% Standard interface
100output.Primal      = x(:);
101output.Dual        = D_struc;
102output.Slack       = [];
103output.problem     = problem;
104output.infostr     = infostr;
105output.solverinput = solverinput;
106output.solveroutput= solveroutput;
107output.solvertime  = solvertime;
Note: See TracBrowser for help on using the repository browser.