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

gfd_vars_impose_domain(+Vars, ?Domain)

Restrict (if required) the domain of Var to the domain specified in Domain
Vars
Collection of (domain) variables or integers
Domain
List of domain specs or existing domain Variable or integer

Description

Primitive for restricting the domains of Vars to the domain specified by Domain.

Domain can be a list (note only a list is supported in this primitive, and not a collection) of domain specifications, a la the domain specifications of (::)/2 -- i.e. each element can be an integer, or an integer range in the form

Lo..Hi
. Alternatively, Domain can be an existing GFD domain variable, or an integer.

The domain update on Vars may fail (when the update empties the domain of any variables in Vars), succeed (possibly updating the variables' domain), or instantiate the variables (in the case where the domain gets restricted to a singleton value).

Note that this predicate is intended for use only in implementing constraint propagators, and should not be called from ordinary user code. It differs from the usual constraint in that the propagation is not performed immediately. Normally, propagation in gecode is performed by a suspended goal that is scheduled and woken after each constraint is posted. However, this predicate does not call the woken goal scheduler (wake/0), so the propagation goal may not be executed immediately. (It is possible that under some circumstances the goal will be executed, if wake/0 is called indirectly - one example would be by the unify handler if the variable becomes ground - but this should not be relied upon.) To ensure that the goals are eventually executed, the caller should arrange for wake/0 to be called at some appropriate point in the subsequent execution. Please see the "Advanced Control Features" section of the User Manual for more information about woken goal management.

This predicate is specific to lib(gfd).

Modes and Determinism

Modules

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

See Also

gfd_vars_impose_min / 2, gfd_vars_impose_max / 2, gfd_vars_impose_bounds / 3, gfd_vars_exclude / 2, gfd_vars_exclude_range / 3, gfd_vars_exclude_domain / 2