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

<ConsistencyModule:> inverse(+Succ,+Pred)

Constrains elements of Succ to be the successors and Pred to be the predecessors of nodes in a digraph
Succ
A collection of N different (domain) variables or integers
Pred
A collection of N different (domain) variables or integers

Description

Succ and Pred are collections of N elements, representing a digraph of N nodes, where the i'th element of Succ and Pred represents the successor and predecessor of the node i respectively. The constraint enforces each node in the digraph to have one successor and one predecessor node, and that if node y is the successor of node x, then node x is the predecessor of node y.

One of the two arguments can be uninstantiated or partial list at call time.

Note that the Gecode implementation of this constraint actually index from 0. A dummy element is added to the start of Succ and Pred so that the indices returned corresponds to ECLiPSe's (starting from 1). A version of this constraint using native Gecode indexing is available as inverse_g/2.

ConsistencyModule is the optional module specification to give the consistency level for the propagation for this constraint: gfd_gac for generalised arc consistency (domain consistency), and gfd_vc for value consistency.

This constraint is known as inverse in the global constraint catalog, but with implicit node index based on the position in the list, and is implemented using Gecode's channel() constraint (variant with two IntVarArgs).

See Also

inverse_g / 2, inverse / 2