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

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

Added original make3d

File size: 1.4 KB
Line 
1% *************************************************************************
2% Bound strengthening
3% *************************************************************************
4function [p,feasible,vol_reduction] = boxreduce(p,upper,lower,lpsolver,options);
5
6if options.bmibnb.lpreduce
7
8    vol_start    = prod(p.ub(p.branch_variables)-p.lb(p.branch_variables));
9    diag_before  =  sum(p.ub(p.branch_variables)-p.lb(p.branch_variables));
10
11    [pcut,feasible,lower] = lpbmitighten(p,lower,upper,lpsolver);
12    diag_after = sum(pcut.ub(p.branch_variables)-pcut.lb(p.branch_variables));
13    iterations = 0;
14    while (diag_after/(1e-18+diag_before) < 0.75    ) & feasible & iterations<4
15        [pcut,feasible,lower] = lpbmitighten(pcut,lower,upper,lpsolver);
16        diag_before = diag_after;
17        diag_after = sum(pcut.ub(p.branch_variables)-pcut.lb(p.branch_variables));
18        iterations = iterations + 1;
19    end
20
21    % Clean up...
22    for i = 1:length(pcut.lb)
23        if (pcut.lb(i)>pcut.ub(i)) & (pcut.lb-pcut.ub < 1e-3)
24            pcut.lb(i)=pcut.ub(i);
25            pcut = updatenonlinearbounds(pcut,i);
26        end
27    end
28    p.lb = pcut.lb;
29    p.ub = pcut.ub;
30
31    % Metric = (V0/V)^(1/n)
32    vol_reduction = 1;%max(0,min(1,(prod(p.ub(p.branch_variables)-p.lb(p.branch_variables))/(1e-7+vol_start))^(1/length(p.branch_variables))));
33    p.lb(p.lb<-1e12) = -inf;
34    p.ub(p.ub>1e12) = inf;
35else
36    vol_reduction = 1;
37    feasible = 1;
38end
Note: See TracBrowser for help on using the repository browser.