[ library(ic) | Reference Manual | Alphabetic Index ]

$::(?Var, ++Lo..++Hi, ?Bool)

Reflect into Bool the truth of Var having the domain Domain. Does not impose integrality.
Var
Variable
Domain
Domain in the form Lo..Hi
Bool
Reified truth value

Description

Provides a reified form of the $::/2 domain assignment predicate. This reified $::/3 is defined only to work for one variable and real variables, so the Domain must be in the form Lo..Hi.

The Bool will be instantiated to 0 if the current domain of Var does not intersect with Domain. It will be instantiated to 1 iff the domain of Var is wholly contained within Domain. Finally the Boolean will remain an integer variable in the range 0..1, if neither of the above two conditions hold.

Instantiating Bool to 1, will cause the constraint to behave exactly like $::/2. Instantiating Bool to 0 will cause a set of delayed goals to excluded the range from the domain of the variable where such an exclusion is representable.

Var will be constrained to be a real variable even if Bool is uninstantiated. Integrality is not imposed.

Further note that, like other reified predicates, $:: can be used infix in an IC expression, e.g. B #= (X $:: [1..10]) is equivalent to $::(X, [1..10], B).

Examples

[eclipse 2]: $::(X, 1..30,1).

X = X{1.0 .. 30.0}
Yes (0.00s cpu)

[eclipse 3]: $::(X, [1..10, 12..30],0).

Abort
type error in $::(X, [1 .. 10, 12 .. 30], 0)

[eclipse 4]: $::(X, 1.0..30.0,B).

X = X{-1.0Inf .. 1.0Inf}
B = B{[0, 1]}
There are 3 delayed goals.
Yes (0.00s cpu)

See Also

integers / 1, reals / 1, suspend : $:: / 2, eplex : $:: / 2, $:: / 2, :: / 3