Constrains Vars to take only integer or real values from the domain specified by Domain. Vars may be a variable, a list, or a submatrix (e.g. M[1..4, 3..6]); for a list or a submatrix, the domain is applied recursively so that one can apply a domain to, for instance, a list of lists of variables. Domain can be specified as a simple range Lo .. Hi, or as a list of subranges and/or individual elements (integer variables only). The type of the bounds determines the type of the variable (real or integer). Also allowed are the (untyped) symbolic bound values inf, +inf and -inf. For instance:
X :: 0..1 % boolean X :: -1..5 % integer between -1 and 5 X :: 1..inf % strictly positive integer X :: 0.0..10.0 % real between 0.0 and 10.0 X :: 1.5..3.7 % real between 1.5 and 3.7 X :: 1.4__1.6..3.6__3.8 % real where the bounds aren't known exactly X :: breal(0)..inf % nonnegative real X :: [0..3, 5, 8..10] % any integer from 0 to 10 except 4 and 6 [X, Y, Z] :: 1..8 % (recursively) apply domain to X, Y and Z M[2..4, 5] :: 1..8 % apply to rows 2..4, column 5 of matrix M X :: 0.0..5 % Type error X :: [0.0..5.0, 7.0..9.0] % Type error X :: [a, b, c] % Type error
[eclipse 2]: X :: 0..1. X = X{[0, 1]} Yes (0.00s cpu) [eclipse 3]: X :: -1..5. X = X{-1 .. 5} Yes (0.00s cpu) [eclipse 4]: X :: 1..inf. X = X{1 .. 1.0Inf} Yes (0.00s cpu) [eclipse 5]: X :: 0.0..10.0. X = X{0.0 .. 10.0} Yes (0.00s cpu) [eclipse 6]: X :: 1.5..3.7. X = X{1.5 .. 3.7} Yes (0.00s cpu) [eclipse 7]: X :: 1.4__1.6..3.6__3.8. X = X{1.4 .. 3.8} Delayed goals: ic : (-(X{1.4 .. 3.8}) =< -1.6__-1.4) ic : (X{1.4 .. 3.8} =< 3.6__3.8) Yes (0.00s cpu) [eclipse 8]: X :: [0..3, 5, 8..10]. X = X{[0 .. 3, 5, 8 .. 10]} Yes (0.00s cpu)