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

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

Added original make3d

File size: 3.1 KB
Line 
1function output = callmexpress(interfacedata)
2
3% Author Johan Löfberg
4% $Id: callmexpress11.m,v 1.1 2006/08/07 11:31:25 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 XPRESS',options.showprogress);
19
20SENSE = 1;     
21C = full(c);   
22if isempty(F_struc)
23    A = zeros(1,length(c));A(1)=1;
24    B = 1e6;
25else
26    A =-(F_struc(:,2:end));
27    B = full(F_struc(:,1));           
28end
29
30% XPRESS complains about large bounds
31if isempty(LB)
32  %  LB = repmat(-2147483647,length(c),1);
33else
34    LB(LB<-2147483647) = -2147483647;
35end
36if isempty(UB)
37  %  UB = repmat(2147483647,length(c),1);
38else
39    UB(UB>2147483647) = 2147483647;
40end
41
42CTYPE = repmat('L',K.l+K.f,1);  % Inequalities
43CTYPE(1:K.f) = 'E';             % Equality constraints
44VARTYPE = repmat('C',size(A,2),1);
45VARTYPE(integer_variables)='I'; % Integer variables
46VARTYPE(binary_variables) ='B'; % Binary variables
47
48if nnz(Q)==0
49    H = [];
50else
51    H = full(2*Q);   
52end
53
54if options.verbose==0
55    options.xpress.msglev = 0;
56else
57    options.xpress.msglev = 1;
58end
59
60if options.savedebug
61    save mexpressdebug SENSE H C A B CTYPE LB UB VARTYPE options
62end
63
64% Call mex-interface
65solvertime = clock;
66[x,FMIN,STATUS,EXTRA] = xpress(H,C,A,B,LB,UB,CTYPE,VARTYPE,SENSE,options.xpress);
67solvertime = etime(clock,solvertime);
68problem = 0;
69if isstruct(EXTRA)
70    D_struc = -EXTRA.lambda;   
71else
72    D_struc = [];
73end
74
75% Check (error code depends on problem type!)
76if isempty(union(binary_variables,integer_variables))
77    switch STATUS
78        case 1
79            problem = 0;
80        case 2
81            problem = 1;
82        case 5
83            problem = 2;
84        case 4
85            problem = 3;
86        case {0,3,6}
87            problem = 11;
88        otherwise
89            problem = -1;
90    end
91else
92    switch STATUS
93        case 6
94            problem = 0;
95        case 5
96            problem = 1;
97        case 4
98            problem = 2;
99        case {4,3}
100            problem = 3;
101        case {0,1,2}
102            problem = 11;
103        otherwise
104            problem = -1;
105    end
106   
107end
108infostr = yalmiperror(problem,'MEXPRESS');     
109
110% Save all data sent to solver?
111if options.savesolverinput
112        solverinput.H = H;
113    solverinput.A = A;
114        solverinput.C = C;
115        solverinput.B = B;
116        solverinput.CTYPE = CTYPE;
117        solverinput.LB = LB;
118        solverinput.UB = UB;
119else
120        solverinput = [];
121end
122
123% Save all data from the solver?
124if options.savesolveroutput
125        solveroutput.x = x;
126    solveroutput.FMIN = FMIN;
127    solveroutput.STATUS = STATUS;
128    solveroutput.EXTRA=EXTRA;
129else
130        solveroutput = [];
131end
132
133
134% Standard interface
135output.Primal      = x;
136output.Dual        = D_struc;
137output.Slack       = [];
138output.problem     = problem;
139output.infostr     = infostr;
140output.solverinput = solverinput;
141output.solveroutput= solveroutput;
142output.solvertime  = solvertime;
Note: See TracBrowser for help on using the repository browser.