Rev | Line | |
---|
[37] | 1 | function [M,m,infbound] = derivebounds(f) |
---|
| 2 | % Code to compute estimates of max and min |
---|
| 3 | % of the linear vector f |
---|
| 4 | basis = getbase(f); |
---|
| 5 | fvars = getvariables(f); |
---|
| 6 | lowerupper = yalmip('getbounds',fvars); |
---|
| 7 | |
---|
| 8 | if any(any(isinf(lowerupper))) |
---|
| 9 | infbound = 1; |
---|
| 10 | else |
---|
| 11 | infbound = 0; |
---|
| 12 | end |
---|
| 13 | |
---|
| 14 | b = basis(:,1); |
---|
| 15 | A = basis(:,2:end); |
---|
| 16 | M = repmat(-inf,size(b,1),1); |
---|
| 17 | m = -M; |
---|
| 18 | if all(all(isinf(lowerupper))) |
---|
| 19 | M = repmat(inf,length(b),1); |
---|
| 20 | m = repmat(-inf,length(b),1); |
---|
| 21 | else |
---|
| 22 | lower = lowerupper(:,1); |
---|
| 23 | upper = lowerupper(:,2); |
---|
| 24 | for i = 1:length(b) |
---|
| 25 | ind = A(i,:)>0; |
---|
| 26 | i1 = find(ind); |
---|
| 27 | i2 = find(~ind); |
---|
| 28 | a = A(i,[i1 i2]); |
---|
| 29 | M(i) = a*[upper(i1);lower(i2)]; |
---|
| 30 | m(i) = a*[lower(i1);upper(i2)]; |
---|
| 31 | end |
---|
| 32 | end |
---|
| 33 | M(isnan(M)) = inf; |
---|
| 34 | M(isinf(M)) = 1e4; M = M+b;%+0.01; |
---|
| 35 | m(isnan(m)) = -inf; |
---|
| 36 | m(isinf(m)) = -1e4;m = m+b;%-0.01; |
---|
Note: See
TracBrowser
for help on using the repository browser.