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

?Vars :: ++Domain

Constrain Vars to have the domain Domain.
Vars
Variable (array notation accepted) or collection (a la collection_to_list/2) of variables
Domain
Domain specification

Description

Constrains Vars to take only values from the domain specified by Domain. Vars may be a variable or a collection of variables (as accepted by collection_to_list/2). Domain can be specified as a simple range Lo .. Hi, or as a list of sub-ranges and/or individual elements. Each element of the specification is an integer, or is a ground expression that evaluates to an integer. All domain elements must be integers within the range allowed by gecode.

Modules

This predicate is sensitive to its module context (tool predicate, see @/2).

Examples

[eclipse 2]: X :: 0..1.

X = X{[0, 1]}

[eclipse 2]: X :: -1..5.

X = X{[-1 .. 5]}

[eclipse 2]: X :: 0.0..1.0.
type error in X :: 0.0 .. 1.0
Abort

[eclipse 2]: [X,Y] :: [1..10, -1, 0, 7, 21].

X = X{[-1 .. 10, 21]}
Y = Y{[-1 .. 10, 21]}

See Also

integers / 1, fd_sets : :: / 2, suspend : :: / 2, ic_sets : :: / 2, ic : :: / 2, ic_hybrid_sets : :: / 2, eplex : :: / 2, fd : :: / 2, :: / 3, #:: / 2