1 | function F = set(F,tag) |
---|
2 | %set Defines a constraint (the feasible set) |
---|
3 | % |
---|
4 | % F = SET([]) Creates an empty SET-object |
---|
5 | % F = SET(X > Y) Constrains X-Y to be positive semi-definite if X-Y is Hermitian, |
---|
6 | % interpreted as element-wise constraint otherwise |
---|
7 | % F = SET(X==Y) Element-wise equality constraint |
---|
8 | % F = SET(CONE(X,Y)) Second order cone constraint ||X||<Y (X and Y column vectors) |
---|
9 | % |
---|
10 | % Constraints can also be generated using string notation (displays nicely with syntax high-lightning) |
---|
11 | % F = SET('X>Y') Constrains X-Y to be positive semi-definite if X-Y is Hermitian, |
---|
12 | % interpreted as element-wise constraint otherwise |
---|
13 | % F = SET('X==Y') Element-wise equality constraint |
---|
14 | % F = SET('||X||<Y') Create second order cone constraint (X and Y column vectors) |
---|
15 | % |
---|
16 | % One can also use overloaded >, < and == |
---|
17 | % |
---|
18 | % Variables can be constrained to be integer or binary |
---|
19 | % F = SET(INTEGER(X)) |
---|
20 | % F = SET(BINARY(X)) |
---|
21 | % |
---|
22 | % Multiple constraints are obtained with overloaded plus |
---|
23 | % F = set(X > 0) + set(CONE(X(:),1)) + SET(X(1,1) == 1/2) |
---|
24 | % |
---|
25 | % Double-sided constraint (and extensions) can easily be defined |
---|
26 | % The following two comands give equivalent problems |
---|
27 | % F = set(X > 0 > Y > Z < 5 < W) |
---|
28 | % F = set(X > 0) + set(0 > Y) + set(Y > Z) + set(Z < 5) + set(5 < W) |
---|
29 | % |
---|
30 | % A constraint can be tagged with a name or description |
---|
31 | % F = SET(X > Y,'tag') Gives the constraint a tag (used in display/checkset) |
---|
32 | % |
---|
33 | % General info |
---|
34 | % |
---|
35 | % The right-hand side and left-hand side can be interchanged. Supports {>,<,>=,<=,==}. |
---|
36 | % See FAQ for information on strict vs. non-strict inequalities. |
---|
37 | % |
---|
38 | % Any valid expression built using DOUBLEs & SDPVARs can be used on both sides. |
---|
39 | % |
---|
40 | % The advantage of using the string notation approach is that more information will be |
---|
41 | % shown when the SET is displayed (and in checkset) |
---|
42 | % |
---|
43 | % See also DUAL, SOLVESDP, INTEGER, BINARY |
---|
44 | if nargin == 2 |
---|
45 | for i = 1:length(F.clauses) |
---|
46 | F.clauses{i}.handle = tag; |
---|
47 | end |
---|
48 | end |
---|