2.2.4. Declaring a global constraint

Declaring a global constraint consists of providing the following information:

  • A term πšŒπš˜πš—πšœπšπš›πšŠπš’πš—πš(A 1 ,A 2 ,β‹―,A n ), where πšŒπš˜πš—πšœπšπš›πšŠπš’πš—πš 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 πšπš’πš™πšŽ:πšπš’πš™πšŽ_πšπšŽπšŒπš•πšŠπš›πšŠπšπš’πš˜πš—; πšπš’πš™πšŽ is the name of the new type we define and πšπš’πš™πšŽ_πšπšŽπšŒπš•πšŠπš›πšŠπšπš’πš˜πš— 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 πšŒπš˜πš—πšœπšπš›πšŠπš’πš—πš 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.2.3 on page 2.2.3.

EXAMPLE: The arguments of the πšŠπš•πš•_πšπš’πšπšπšŽπš›_πšπš›πš˜πš–_𝚊𝚝_πš•πšŽπšŠπšœπš_πš”_πš™πš˜πšœ constraint are described by:

Β Β ConstraintΒ Β Β 

πšŠπš•πš•_πšπš’πšπšπšŽπš›_πšπš›πš˜πš–_𝚊𝚝_πš•πšŽπšŠπšœπš_πš”_πš™πš˜πšœ(𝙺,πš…π™΄π™²πšƒπ™Ύπšπš‚)

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

πš…π™΄π™²πšƒπ™Ύπš-πšŒπš˜πš•πš•πšŽπšŒπšπš’πš˜πš—(πšŸπšŠπš›-πšπšŸπšŠπš›)

Β Β Argument(s)Β 

𝙺-πš’πš—πš

πš…π™΄π™²πšƒπ™Ύπšπš‚-πšŒπš˜πš•πš•πšŽπšŒπšπš’πš˜πš—(𝚟𝚎𝚌-πš…π™΄π™²πšƒπ™Ύπš)

Β Β Restriction(s)Β 

πš›πšŽπššπšžπš’πš›πšŽπš(πš…π™΄π™²πšƒπ™Ύπš,πšŸπšŠπš›)

𝙺β‰₯0

πš›πšŽπššπšžπš’πš›πšŽπš(πš…π™΄π™²πšƒπ™Ύπšπš‚,𝚟𝚎𝚌)

πšœπšŠπš–πšŽ_πšœπš’πš£πšŽ(πš…π™΄π™²πšƒπ™Ύπšπš‚,𝚟𝚎𝚌)

The first line indicates that the πšŠπš•πš•_πšπš’πšπšπšŽπš›_πšπš›πš˜πš–_𝚊𝚝_πš•πšŽπšŠπšœπš_πš”_πš™πš˜πšœ constraint has two arguments: 𝙺 and πš…π™΄π™²πšƒπ™Ύπšπš‚. The second line declares a new type πš…π™΄π™²πšƒπ™Ύπš, which corresponds to a collection of variables. The third line indicates that the first argument 𝙺 is an integer, while the fourth line tells that the second argument πš…π™΄π™²πšƒπ™Ύπšπš‚ corresponds to a collection of vectors of type πš…π™΄π™²πšƒπ™Ύπš. Finally the four restrictions respectively enforce that:

  • All the items of the πš…π™΄π™²πšƒπ™Ύπš collection mention the πšŸπšŠπš› attribute,

  • 𝙺 be greater than or equal to 0,

  • All the items of the πš…π™΄π™²πšƒπ™Ύπšπš‚ collection mention the 𝚟𝚎𝚌 attribute,

  • All the vectors have the same number of components.