Rev | Line | |
---|
[37] | 1 | function varargout = bounds(x,lower,upper,aux) |
---|
| 2 | %BOUNDS Adds implicit bounds on variables. |
---|
| 3 | % |
---|
| 4 | % BOUNDS IS OBSOLETE: Use standard SET constraints |
---|
| 5 | % |
---|
| 6 | % BOUNDS(x,Lower,Upper) Adds bound constraints on variables. |
---|
| 7 | % These bounds are used when performing |
---|
| 8 | % big M formulations and similar things. |
---|
| 9 | |
---|
| 10 | % Author Johan Löfberg |
---|
| 11 | % $Id: bounds.m,v 1.6 2006/05/11 10:49:13 joloef Exp $ |
---|
| 12 | |
---|
| 13 | variables = getvariables(x); |
---|
| 14 | if nargin == 1 |
---|
| 15 | lb = yalmip('getbounds',variables); |
---|
| 16 | lower = lb(:,1); |
---|
| 17 | upper = lb(:,2); |
---|
| 18 | else |
---|
| 19 | lower = lower(:); |
---|
| 20 | upper = upper(:); |
---|
| 21 | if length(lower)==1 |
---|
| 22 | lower = repmat(lower,length(variables),1); |
---|
| 23 | end |
---|
| 24 | if length(upper)==1 |
---|
| 25 | upper = repmat(upper,length(variables),1); |
---|
| 26 | end |
---|
| 27 | % 0 - No problems |
---|
| 28 | % 1 - Trying to bound nonlinear variable |
---|
| 29 | % 2 - Trying to bound nonlinear operator |
---|
| 30 | fail = yalmip('setbounds',variables,lower,upper); |
---|
| 31 | switch fail |
---|
| 32 | case {1,2} |
---|
| 33 | error('BOUNDS can only be applied to linear unitary SDPVAR variables.') |
---|
| 34 | otherwise |
---|
| 35 | end |
---|
| 36 | end |
---|
| 37 | |
---|
| 38 | if nargout>0 |
---|
| 39 | varargout{1} = lower; |
---|
| 40 | varargout{2} = upper; |
---|
| 41 | end |
---|
Note: See
TracBrowser
for help on using the repository browser.