Rev | Line | |
---|
[37] | 1 | function p = updatenonlinearbounds(p,changed_var,keepbest); |
---|
| 2 | if ~isempty(p.bilinears) |
---|
| 3 | x = p.bilinears(:,2); |
---|
| 4 | y = p.bilinears(:,3); |
---|
| 5 | z = p.bilinears(:,1); |
---|
| 6 | x_lb = p.lb(x); |
---|
| 7 | x_ub = p.ub(x); |
---|
| 8 | y_lb = p.lb(y); |
---|
| 9 | y_ub = p.ub(y); |
---|
| 10 | bounds = [x_lb.*y_lb x_lb.*y_ub x_ub.*y_lb x_ub.*y_ub]; |
---|
| 11 | new_lb = max([p.lb(z) min(bounds,[],2)],[],2); |
---|
| 12 | new_ub = min([p.ub(z) max(bounds,[],2)],[],2); |
---|
| 13 | % Avoid updating small bounds (numerical reasons) |
---|
| 14 | update = find(p.lb(z) < p.ub(z)-1e-4); |
---|
| 15 | p.lb(z(update)) = new_lb(update); |
---|
| 16 | p.ub(z(update)) = new_ub(update); |
---|
| 17 | |
---|
| 18 | p.lb(p.integer_variables) = fix(p.lb(p.integer_variables)); |
---|
| 19 | p.ub(p.integer_variables) = fix(p.ub(p.integer_variables)); |
---|
| 20 | p.lb(p.binary_variables) = fix(p.lb(p.binary_variables)); |
---|
| 21 | p.ub(p.binary_variables) = fix(p.ub(p.binary_variables)); |
---|
| 22 | |
---|
| 23 | quadratic_variables = p.bilinears(x==y,1); |
---|
| 24 | p.lb(quadratic_variables(p.lb(quadratic_variables)<0)) = 0; |
---|
| 25 | end |
---|
Note: See
TracBrowser
for help on using the repository browser.