1 | % ************************************************************************* |
---|
2 | % Bound strengthening |
---|
3 | % ************************************************************************* |
---|
4 | function [p,feasible,vol_reduction] = boxreduce(p,upper,lower,lpsolver,options); |
---|
5 | |
---|
6 | if 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; |
---|
35 | else |
---|
36 | vol_reduction = 1; |
---|
37 | feasible = 1; |
---|
38 | end |
---|