source: proiecte/pmake3d/make3d_original/Make3dSingleImageStanford_version0.1/third_party/opt/yalmip/solvers/calllindo_miqp.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 = calllindo_miqp(interfacedata)
2
3global MY_LICENSE_FILE
4lindo
5
6% Retrieve needed data
7options = interfacedata.options;
8F_struc = interfacedata.F_struc;
9c       = interfacedata.c;
10K       = interfacedata.K;
11x0      = interfacedata.x0;
12Q       = interfacedata.Q;
13lb      = interfacedata.lb;
14ub      = interfacedata.ub;
15monomtable = interfacedata.monomtable;
16
17lindo;
18
19if ~isempty(F_struc)
20    A = -F_struc(:,2:end);
21    b = F_struc(:,1);   
22    csense = [repmat('E',1,K.f) repmat('L',1,K.l)];
23else
24    A = [];
25    b = [];
26    csense = [];
27   
28    A = ones(1,length(c));
29    b = 1e6;
30    csense = 'L';
31end
32
33% Specifying variable types...
34vtype = repmat('C',1,length(c));
35vtype(interfacedata.integer_variables) = 'I';
36
37% Specifying the quadratic portion of the problem data
38[QCvar1,QCvar2,QCcoef] = find(triu(Q));
39QCrows = zeros(1,length(QCvar1));
40QCvar1 = QCvar1 - 1;
41QCvar2 = QCvar2 - 1;
42
43% Solve the problem using the generic QP/LP/MIP/MIQP solver (lmsolvemp.m)
44objsen=LS_MIN;
45solver=eval(options.lindo.LS_METHOD);
46
47solvertime = clock;
48if nnz(Q)>0
49    [x,D_struc,s,dj,pobj,solstat,nErr]  = LMsolvem(A,full(b),full(c),csense,lb,ub,vtype,QCrows-1,QCvar1,QCvar2,2*QCcoef,objsen,solver,options.verbose);
50else
51    [x,D_struc,s,dj,pobj,solstat,nErr]  = LMsolvem(A,full(b),full(c),csense,lb,ub,vtype,[],[],[],[],objsen,solver,options.verbose);
52end
53if interfacedata.getsolvertime solvertime = etime(clock,solvertime);else solvertime = 0;end
54   
55switch solstat
56    case {LS_STATUS_OPTIMAL,LS_STATUS_BASIC_OPTIMAL,7,8}
57        problem = 0;
58    case {LS_STATUS_INFEASIBLE}
59        problem = 1;
60    case {LS_STATUS_UNBOUNDED}
61        problem = 2;
62    otherwise
63        problem = 11;
64end
65infostr = yalmiperror(problem,'LINDO-QP');
66
67% Save all data sent to solver?
68if options.savesolverinput
69    solverinput.A = A;
70    solverinput.b = b;
71    solverinput.c = c;
72    solverinput.csense = csense;
73    solverinput.vtype = vtype;   
74    solverinput.lb = lb;   
75    solverinput.vtype = vtype;   
76    solverinput.objsen = objsen;   
77    solverinput.solver = solver;   
78    solverinput.options = options.fmincon;
79else
80    solverinput = [];
81end
82
83% Save all data from the solver?
84if options.savesolveroutput
85    solveroutput.w = x;
86    solveroutput.y = D_struc;
87    solveroutput.s = s;
88    solveroutput.pobj=pobj;
89    solveroutput.solstat=solstat;
90    solveroutput.nErr=nErr;
91else
92    solveroutput = [];
93end
94
95% Standard interface
96output = createoutput(x,D_struc,[],problem,'LINDO',solverinput,solveroutput,solvertime);
Note: See TracBrowser for help on using the repository browser.