Next: Forgetting Constraints, Up: CLPFD Interface [Contents][Index]
A constraint is called as any other Prolog predicate. When called, the constraint is posted to the store. For example:
| ?- X in 1..5, Y in 2..8, X+Y #= T. X in 1..5, Y in 2..8, T in 3..13 | ?- X in 1..5, T in 3..13, X+Y #= T. X in 1..5, T in 3..13, Y in -2..12
Note that the answer constraint shows the domains of nonground query variables, but does not show any constraints that may be attached to them.
Normally, after posting a constraint, propagation to fixpoint is performed, which can be an overkill. The following provides a means of posting a set of constraints in one batch, suspending all propagation until the whole set has been posted. Suspending propagation can significantly reduce posting overhead.
fd_batch(+Goals) since release 4.2.1
where Goals should be a list of constraints, or Prolog goals posting such constraints. Please note: Every constraint posting must be deterministic and must not be backtracked over. A posting that is backtracked over leads to undefined behavior.