Rev | Line | |
---|
[37] | 1 | % ************************************************************************* |
---|
| 2 | % Code for setting the numerical values of nonlinear terms |
---|
| 3 | % ************************************************************************* |
---|
| 4 | function p = updateonenonlinearbound(p,changed_var) |
---|
| 5 | if ~isempty(p.bilinears) |
---|
| 6 | impactedVariables = find((p.bilinears(:,2) == changed_var) | (p.bilinears(:,3) == changed_var)); |
---|
| 7 | x = p.bilinears(impactedVariables,2); |
---|
| 8 | y = p.bilinears(impactedVariables,3); |
---|
| 9 | z = p.bilinears(impactedVariables,1); |
---|
| 10 | x_lb = p.lb(x); |
---|
| 11 | x_ub = p.ub(x); |
---|
| 12 | y_lb = p.lb(y); |
---|
| 13 | y_ub = p.ub(y); |
---|
| 14 | bounds = [x_lb.*y_lb x_lb.*y_ub x_ub.*y_lb x_ub.*y_ub]; |
---|
| 15 | p.lb(z) = max([p.lb(z) min(bounds,[],2)],[],2); |
---|
| 16 | p.ub(z) = min([p.ub(z) max(bounds,[],2)],[],2)'; |
---|
| 17 | p.lb(impactedVariables(x==y)<0) = 0; |
---|
| 18 | end |
---|
Note: See
TracBrowser
for help on using the repository browser.