3.5. Constraints argument patterns
If you do not know the name of the global constraint you are looking for, but you know the types of its arguments this section allows to find out all global constraints which have similar arguments. For this purpose we associate to each global constraint of the catalogue a unique normalised signature tree derived from the types of its arguments.An informal rule used in the catalogue about the order of the arguments of a constraint is that we usually first mention a domain variable which represents a result computed from one or several collections that occur just after. Finally, eventual parameters are put as the last arguments of the constraint. The purpose of this normalised signature tree is to get a concise normal form of the arguments of a global constraint that does not depend of the order in which these arguments are defined.
Figure 3.5.1. Illustrating steps (2), (3) and (4) for computing the normalised signature tree
The normalisation takes as input the slots Type(s) and Argument(s) of the description of a global constraintSee Section 2.2.4 for the description of these slots. and computes the normalised signature tree in four steps:
The first step converts all types related to variables to their corresponding ground counterparts: the types , , and are respectively transformed to , , and .
The second step builds a tree of types by exploring the slot Argument(s) and by developing the compound data types possibly used. The root of this tree is the type and represents the name of the global constraint.
The third step normalises the tree of types by first normalising each subtree of and then by sorting the children of . We assume the following ordering on the different types: . Let denote the normalised tree obtained at this third step.
Finally the last step tries to reduce the size of the normalised tree by identifying children of a vertex of for which the subtrees are identical. When such a configuration is identified the subtrees of are replaced by a single subtree and the integer is put as an exponent of .
The three rows of Figure 3.5.1 illustrate respectively the second, third and fourth steps for computing the normalised signature tree associated with the arguments of the constraints , , , , , and .
The next sections provide for each possible constraints arity all existing normalised signature trees together with the corresponding list of global constraints of the catalogue. The leftmost part of an entry corresponds to a normalised signature tree, while the rightmost upper part gives the corresponding list of global constraints. Finally the rightmost lower part describes the dependency between the constraints of the list: there is an edge from a constraint to a constraint if and only if the fact that holds implies that also holds. For instance, consider the constraints associated with the normalised signature tree corresponding to two collections of integers depicted by Table 3.5.1. There is an edge from 16 (i.e., ) to 14 (i.e., ) since the fact that a constraint holds implies that a constraint also holds.