Rev | Line | |
---|
[37] | 1 | function F = constraint(X,quantifier,Y) |
---|
| 2 | % Internal class for constraint list |
---|
| 3 | |
---|
| 4 | % Author Johan Löfberg |
---|
| 5 | % $Id: constraint.m,v 1.5 2005/06/02 13:40:00 joloef Exp $ |
---|
| 6 | |
---|
| 7 | superiorto('sdpvar'); |
---|
| 8 | superiorto('double'); |
---|
| 9 | |
---|
| 10 | if isa(X,'blkvar') |
---|
| 11 | X = sdpvar(X); |
---|
| 12 | end |
---|
| 13 | if isa(Y,'blkvar') |
---|
| 14 | Y = sdpvar(Y); |
---|
| 15 | end |
---|
| 16 | |
---|
| 17 | % Try to evaluate |
---|
| 18 | switch quantifier |
---|
| 19 | case {'>','>='} |
---|
| 20 | Z = X - Y; |
---|
| 21 | case {'<','<=','=='} |
---|
| 22 | Z = Y - X; |
---|
| 23 | otherwise |
---|
| 24 | error('Quantifier not supported') |
---|
| 25 | end |
---|
| 26 | |
---|
| 27 | F.List={X,quantifier,Y}; |
---|
| 28 | F.Evaluated{1} = Z; |
---|
| 29 | |
---|
| 30 | switch quantifier |
---|
| 31 | case {'>','<'} |
---|
| 32 | F.strict(1) = 1; |
---|
| 33 | case {'>=','<=','=='} |
---|
| 34 | F.strict(1) = 0; |
---|
| 35 | otherwise |
---|
| 36 | error('Quantifier not supported') |
---|
| 37 | end |
---|
| 38 | |
---|
| 39 | F = class(F,'constraint'); |
---|
| 40 | |
---|
Note: See
TracBrowser
for help on using the repository browser.