source: proiecte/pmake3d/make3d_original/Make3dSingleImageStanford_version0.1/third_party/opt/yalmip/modules/parametric/mpt_de_mpmilp.m @ 37

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

Added original make3d

File size: 2.1 KB
Line 
1function model = mpt_de_mpmilp(Matrices,options,model)
2                       
3% Since we are recursively fixing binaries, big-M
4% constraints will get active/inactive
5[equalities,redundant] = mpt_detect_fixed_rows(Matrices);
6if ~isempty(equalities)
7    Matrices.Aeq = [Matrices.Aeq;Matrices.G(equalities,:)];
8    Matrices.Beq = [Matrices.Beq;-Matrices.E(equalities,:)];
9    Matrices.beq = [Matrices.beq;Matrices.W(equalities,:)];
10    redundant = [redundant;equalities];
11end
12if ~isempty(redundant)
13    Matrices.G(redundant,:) = [];
14    Matrices.W(redundant,:) = [];
15    Matrices.E(redundant,:) = [];
16end
17
18if all(Matrices.lb(Matrices.binary_var_index) == Matrices.ub(Matrices.binary_var_index))
19    % Ok, we reached a node 
20    model = mpt_solvenode(Matrices,Matrices.lb,Matrices.ub,Matrices,model,options);
21else   
22    % Find a non-fixed binary variable
23    j = find(Matrices.lb(Matrices.binary_var_index) < Matrices.ub(Matrices.binary_var_index));
24    j = Matrices.binary_var_index(j(1));
25
26    % Solve up
27    M = Matrices;
28    M.lb(j) = 1;
29    M.ub(j) = 1;
30   % [Matrices.lb(Matrices.binary_var_index) Matrices.ub(Matrices.binary_var_index)]
31    % Simple bound tightening
32    A = [Matrices.G -Matrices.E;Matrices.Aeq Matrices.Beq;-Matrices.Aeq -Matrices.Beq];
33    b = [Matrices.W;Matrices.beq;Matrices.beq];
34    [M.lb,M.ub,redundant,psstruct,infeasible] = tightenbounds(A,b,M.lb,M.ub,[],Matrices.binary_var_index,1:length(Matrices.lb));
35   
36    %M.ub(end-3:end) - M.lb(end-3:end)
37   
38    if any(M.lb(end-M.nx+1:end) >= M.ub(end-M.nx+1:end))     
39        infeasible = 1;
40    end
41    if ~infeasible
42        model = mpt_de_mpmilp(M,options,model);
43    end
44
45    % Solve down
46    M = Matrices;
47    M.lb(j) = 0;
48    M.ub(j) = 0;
49   %  [Matrices.lb(Matrices.binary_var_index) Matrices.ub(Matrices.binary_var_index)]
50    [M.lb,M.ub,redundant,psstruct,infeasible] = tightenbounds(A,b,M.lb,M.ub,[],Matrices.binary_var_index,1:length(Matrices.lb));
51    if any(M.lb(end-M.nx+1:end) >= M.ub(end-M.nx+1:end))         
52        infeasible = 1;
53    end
54    if ~infeasible
55        model = mpt_de_mpmilp(M,options,model);
56    end
57end
Note: See TracBrowser for help on using the repository browser.