For the more complex constraint behaviours (beyond those waiting for
instantiations), we need to employ lower-level primitives of the ECLiPSe
kernel (suspensions and priorities).
If we want to add a new constraint to an existing solver, we also
need to use the lower-level interface that the particular solver
provides.
Apart from the delay clauses used above,
ECLiPSe also provides a more powerful (though less declarative) way of
causing a goal to delay.
The following is another implementation of the constraint checking behaviour,
this time using the suspend/3 built-in predicate to create a delayed goal for
capacity/2:
Creates Goal as a delayed goal with a given waking priority and
triggering conditions.
Triggers is a list of Variables->Conditions terms, specifying
under which conditions the goal will be woken up.
The priority specifies with which priority the goal will be scheduled
after it has been triggered.
A priority of 0 selects the default for the predicate.
Otherwise, valid priorities range are from
1 (most urgent, reserved for debugging purposes) to 12 (least urgent).
Some valid triggers:
X->inst
wake when the variable becomes instantiated (most specific)
X->constrained
wake when the variable becomes constrained somehow
(most general)
X->ic:min
wake when the lower bound of an ic-variable changes
X->ic:max
wake when the upper bound of an ic-variable changes