### 2.1.4. Declaring a global constraint

Declaring a global constraint consists of providing the following information:

• A term $\mathrm{\pi \pi \pi \pi \pi \pi \pi \pi \pi \pi }\left({A}_{1},{A}_{2},...,{A}_{n}\right)$, where $\mathrm{\pi \pi \pi \pi \pi \pi \pi \pi \pi \pi }$ corresponds to the name of the global constraint and ${A}_{1},{A}_{2},...,{A}_{n}$ to its arguments.

• A possibly empty list of type declarations, where each declaration has the form $\mathrm{\pi \pi ’\pi \pi }$:$\mathrm{\pi \pi ’\pi \pi }_\mathrm{\pi \pi \pi \pi \pi \pi \pi \pi \pi \pi \pi }$; $\mathrm{\pi \pi ’\pi \pi }$ is the name of the new type we define and $\mathrm{\pi \pi ’\pi \pi }_\mathrm{\pi \pi \pi \pi \pi \pi \pi \pi \pi \pi \pi }$ is a basic data type, a compound data type or a type previously defined.

• An argument declaration ${A}_{1}$:${T}_{1},{A}_{2}$:${T}_{2},...,{A}_{n}$:${T}_{n}$ giving for each argument ${A}_{1},{A}_{2},$ $...,{A}_{n}$ of the global constraint $\mathrm{\pi \pi \pi \pi \pi \pi \pi \pi \pi \pi }$ its type. Each type is a basic data type, a compound data type, or a type that was declared in the list of type declarations.

• A possibly empty list of restrictions, where each restriction is one of the restrictions described in SectionΒ 2.1.3 on page 2.1.3.

Β Β ConstraintΒ Β Β

$\mathrm{\pi \pi \pi }_\mathrm{\pi \pi \pi \pi \pi \pi }_\mathrm{\pi \pi \pi \pi }_\mathrm{\pi \pi }_\mathrm{\pi \pi \pi \pi \pi }_\mathrm{\pi }_\mathrm{\pi \pi \pi }$$\left(\mathrm{\pi Ί},\mathrm{\pi  \pi ΄\pi ²\pi \pi Ύ\pi \pi }\right)$

Β Β Type(s)Β Β Β Β Β Β

$\mathrm{\pi  \pi ΄\pi ²\pi \pi Ύ\pi }-\mathrm{\pi \pi \pi \pi \pi \pi \pi \pi \pi \pi }\left(\mathrm{\pi \pi \pi }-\mathrm{\pi \pi \pi \pi }\right)$

Β Β Argument(s)Β

$\mathrm{\pi Ί}-\mathrm{\pi \pi \pi }$

$\mathrm{\pi  \pi ΄\pi ²\pi \pi Ύ\pi \pi }-\mathrm{\pi \pi \pi \pi \pi \pi \pi \pi \pi \pi }\left(\mathrm{\pi \pi \pi }-\mathrm{\pi  \pi ΄\pi ²\pi \pi Ύ\pi }\right)$

Β Β Restriction(s)Β

$\mathrm{\pi \pi \pi \pi \pi \pi \pi \pi }\left(\mathrm{\pi  \pi ΄\pi ²\pi \pi Ύ\pi },\mathrm{\pi \pi \pi }\right)$

$\mathrm{\pi Ί}\beta ₯0$

$\mathrm{\pi \pi \pi \pi \pi \pi \pi \pi }\left(\mathrm{\pi  \pi ΄\pi ²\pi \pi Ύ\pi \pi },\mathrm{\pi \pi \pi }\right)$

$\mathrm{\pi \pi \pi \pi }_\mathrm{\pi \pi \pi £\pi }\left(\mathrm{\pi  \pi ΄\pi ²\pi \pi Ύ\pi \pi },\mathrm{\pi \pi \pi }\right)$

The first line indicates that the $\mathrm{\pi \pi \pi }_\mathrm{\pi \pi \pi \pi \pi \pi }_\mathrm{\pi \pi \pi \pi }_\mathrm{\pi \pi }_\mathrm{\pi \pi \pi \pi \pi }_\mathrm{\pi }_\mathrm{\pi \pi \pi }$ constraint has two arguments: $\mathrm{\pi Ί}$ and $\mathrm{\pi  \pi ΄\pi ²\pi \pi Ύ\pi \pi }$. The second line declares a new type $\mathrm{\pi  \pi ΄\pi ²\pi \pi Ύ\pi }$, which corresponds to a collection of variables. The third line indicates that the first argument $\mathrm{\pi Ί}$ is an integer, while the fourth line tells that the second argument $\mathrm{\pi  \pi ΄\pi ²\pi \pi Ύ\pi \pi }$ corresponds to a collection of vectors of type $\mathrm{\pi  \pi ΄\pi ²\pi \pi Ύ\pi }$. Finally the four restrictions respectively enforce that:

• All the items of the $\mathrm{\pi  \pi ΄\pi ²\pi \pi Ύ\pi }$ collection mention the $\mathrm{\pi \pi \pi }$ attribute,

• $\mathrm{\pi Ί}$ be greater than or equal to 0,

• All the items of the $\mathrm{\pi  \pi ΄\pi ²\pi \pi Ύ\pi \pi }$ collection mention the $\mathrm{\pi \pi \pi }$ attribute,

• All the vectors have the same number of components.