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

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

Added original make3d

File size: 3.3 KB
Line 
1function output = callmpt(interfacedata)
2
3% Author Johan Löfberg
4% $Id: callmplcp.m,v 1.1 2006/03/30 13:28:06 joloef Exp $
5
6% Speeds up solving LPs in mpmilp
7global mptOptions
8if ~isstruct(mptOptions)
9    mpt_error
10end
11
12% Convert to MPT
13Matrices = yalmip2mpt(interfacedata);
14
15% % Convert to colin
16% parametric = find(~any(Matrices.G,2) & any(Matrices.E,2));
17% nonparametric = find(~(~any(Matrices.G,2) & any(Matrices.E,2)));
18% [M,Q,q,T,Tth,t] = lcp_mpqp(Matrices.H,Matrices.F',Matrices.Cf',Matrices.G(nonparametric,:),Matrices.E(nonparametric,:),Matrices.W(nonparametric,:));
19% Ht = [Matrices.E(parametric,:) Matrices.W(parametric)];
20% [BB,dPiv,dkPiv] = mplcp(M,q,Q,[Matrices.E(parametric,:) Matrices.W(parametric)]);
21
22%
23% m = size(M,1);
24% A  = [eye(m) -M];
25% [At,bt] = a2s(Ht);
26% bases = BB.bases;
27% for i=[1:size(bases,1)]
28%   iB = inv(A(:,bases(i,:)));
29%   P(i) = polytope([At;-iB*Q],[bt;iB*q]);
30% end;
31%
32% model{1}.Pn = P;
33
34%model = mpt_solvenode(Matrices,Matrices.lb,Matrices.ub,Matrices,[],options);
35
36
37% Get some MPT options
38options = interfacedata.options;
39options.mpt.lpsolver = mptOptions.lpsolver;
40options.mpt.milpsolver = mptOptions.milpsolver;
41options.mpt.verbose = options.verbose;
42
43if options.savedebug
44    save mptdebug Matrices
45end
46
47if isempty(Matrices.binary_var_index)
48
49    showprogress('Calling MPT',options.showprogress);
50    solvertime = clock;
51    if options.mp.presolve       
52        [Matrices.lb,Matrices.ub] = mpt_detect_and_improve_bounds(Matrices,Matrices.lb,Matrices.ub,Matrices.binary_var_index,options);
53    end       
54
55    model = mpt_solvenode(Matrices,Matrices.lb,Matrices.ub,Matrices,[],options);
56    solvertime = etime(clock,solvertime);
57
58else 
59    % Pre-solve required on binary problems
60    options.mp.presolve = 1;
61
62    solvertime = clock;   
63    switch options.mp.algorithm
64        case 1
65            showprogress('Calling MPT via enumeration',options.showprogress);
66            model = mpt_enumeration_mpmilp(Matrices,options);
67        case 2
68            showprogress('Calling MPT via parametric B&B',options.showprogress);
69            model = bb_mpmilp(Matrices,Matrices,[],options)
70        case 3
71            showprogress('Calling MPT via delayed enumeration',options.showprogress);
72            model = mpt_de_mpmilp(Matrices,options,[]);
73           
74        otherwise
75    end
76    solvertime = etime(clock,solvertime);
77end
78
79if isempty(model)
80    model = {model};
81end
82
83if options.verbose
84    if ~isempty(model{1})
85    disp(['-> Generated ' num2str(length(model)) ' partitions.'])
86    end
87end
88
89
90problem = 0;
91infostr = yalmiperror(problem,'MPT');
92
93% Save all data sent to solver?
94if options.savesolverinput
95    solverinput.Matrices = Matrices;
96    solverinput.options  = [];
97else
98    solverinput = [];
99end
100
101% Save all data from the solver?
102% This always done
103if options.savesolveroutput
104    solveroutput.model = model;
105    solveroutput.U = interfacedata.used_variables(Matrices.free_var);
106    solveroutput.x = interfacedata.used_variables(Matrices.param_var);
107else
108    solveroutput = [];
109end
110
111% Standard interface
112output.Primal      = nan*ones(length(interfacedata.c),1);
113output.Dual        = [];
114output.Slack       = [];
115output.problem     = problem;
116output.infostr     = infostr;
117output.solverinput = solverinput;
118output.solveroutput= solveroutput;
119output.solvertime  = solvertime;
120
121
122
123
Note: See TracBrowser for help on using the repository browser.