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

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

Added original make3d

File size: 3.0 KB
Line 
1function output = callcplexint(interfacedata)
2
3% Author Johan Löfberg
4% $Id: callcplexint.m,v 1.19 2006/07/13 14:48:55 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
20SENSE = 1;     
21C = full(c);   
22if K.l+K.f+K.q == 0
23    A = zeros(1,length(c));A(1)=1;
24    B = 1e6;
25 %   A = [];
26 %   b = [];
27else
28    A =-(F_struc(1:K.f+K.l,2:end));
29    B = full(F_struc(1:K.f+K.l,1));           
30end
31
32INDEQ = [];
33if K.f>0
34    INDEQ(1:K.f) = 1:K.f;
35end
36
37if K.q(1)>0
38    top = K.f+K.l + 1;
39    for i = 1:length(K.q)
40        % [cx+d;Ax+b]   |Ax+b|<cx+d, originally a QCQP
41        m = K.q(i);
42        ci = F_struc(top,2:end)';
43        di = F_struc(top,1);
44        Ai = F_struc(top+1:top+m-1,2:end);
45        bi = F_struc(top+1:top+m-1,1);       
46        QC(i).Q = full(Ai'*Ai - ci*ci');
47        QC(i).r = full(di'*di - bi'*bi);   
48        QC(i).L = full(2*bi'*Ai - 2*di*ci');
49        top = top+m;
50    end
51else
52    QC = [];
53end
54
55VARTYPE = repmat('C',size(A,2),1);
56VARTYPE(integer_variables)='I'; % Integer variables
57VARTYPE(binary_variables) ='B'; % Binary variables
58
59if nnz(Q)==0
60    H = [];
61else
62    H = full(2*Q);
63end
64
65PARAM = options.cplex.param;
66OPTIONS.verbose = options.verbose;
67OPTIONS.logfile = options.cplex.logfile;
68if ~isempty(x0)
69    OPTIONS.x0 = [(1:length(x0))' x0(:)];
70end
71
72if options.savedebug
73    save cplexintdebug H C A B LB UB QC VARTYPE INDEQ PARAM OPTIONS
74end
75
76% Call mex-interface
77solvertime = clock;
78[x,FMIN,SOLSTAT,DETAILS] = cplexint(H, C, A, B, INDEQ, QC, LB, UB,VARTYPE,PARAM,OPTIONS);
79if interfacedata.getsolvertime solvertime = etime(clock,solvertime);else solvertime = 0;end
80problem = 0;
81D_struc = -DETAILS.dual;   
82
83switch SOLSTAT
84    case {1,101,102}
85        problem = 0;
86    case {3,22}
87        problem = 1;
88    case 108
89        problem = 3;
90    case {2}
91        problem = 2;
92    case {4,119}
93        problem = 12;
94    otherwise
95        problem = -1;
96end
97infostr = yalmiperror(problem,'CPLEXINT');     
98
99% Save all data sent to solver?
100if options.savesolverinput
101    solverinput.H = H;
102    solverinput.A = A;
103    solverinput.C = C;
104    solverinput.INDEQ = INDEQ;
105    solverinput.QC = QC;
106    solverinput.B = B;
107    solverinput.CTYPE = CTYPE;
108    solverinput.LB = LB;
109    solverinput.UB = UB;
110else
111    solverinput = [];
112end
113
114% Save all data from the solver?
115if options.savesolveroutput
116    solveroutput.x = x;
117    solveroutput.FMIN = FMIN;
118    solveroutput.SOLSTAT = SOLSTAT;
119    solveroutput.DETAILS=DETAILS;
120else
121    solveroutput = [];
122end
123
124
125% Standard interface
126output.Primal      = x;
127output.Dual        = D_struc;
128output.Slack       = [];
129output.problem     = problem;
130output.infostr     = infostr;
131output.solverinput = solverinput;
132output.solveroutput= solveroutput;
133output.solvertime  = solvertime;
Note: See TracBrowser for help on using the repository browser.