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