next up previous
Next: Map Colouring Up: Active Constraints Previous: Constraint Agents

Some Built-in Constraint Agents

The simplest constraint agent is one which adds a primitive constraint to the constraint store and then exits. The most fundamental example is assigning a value to a variable, eg. X=3. This agent adds X=3 to the constraint store and exits.

The next two examples are disequality constraints, which will be illustrated in the next section. The first disequality constraint is invoked by the syntax X~=Y. This agent does not do anything until both X and Y have a fixed value. Only when the primitive constraints in the store entail tex2html_wrap_inline700 and tex2html_wrap_inline702 for some unique values tex2html_wrap_inline704 and tex2html_wrap_inline706 , does the agent wake up. Then its behaviour is to check that tex2html_wrap_inline704 is different from tex2html_wrap_inline706 . In case they are the same, an inconsistency has been detected.

If the constraint store holds finite domain constraints, then the more powerful constraint agent invoked by the syntax X ## Y can be used. This agent wakes up as soon as either X or Y has a fixed value. It then removes this value from the finite domain of the other variable and exits.

Mark Wallace
Wed Sep 3 18:36:40 BST 1997