### 2.2.2. Compound data types

We provide the following compound data types:

• $\mathrm{𝚕𝚒𝚜𝚝}\left(T\right)$ corresponds to a list of elements of type $T$, where $T$ is a basic or a compound data type.

• $\mathrm{𝚌𝚘𝚕𝚕𝚎𝚌𝚝𝚒𝚘𝚗}\left({A}_{1},{A}_{2},\cdots ,{A}_{n}\right)$ corresponds to a collection of ordered items, where each item consists of $n>0$ attributes ${A}_{1},{A}_{2},\cdots ,{A}_{n}$. Each attribute is an expression of the form $𝚊-T$, where $𝚊$ is the name of the attribute and $T$ the type of the attribute (a basic or a compound data type). All names of the attributes of a given collection should be distinct and different from the keyword $\mathrm{𝚔𝚎𝚢}$, which corresponds to an implicitThis attribute is not explicitly defined. attribute. Its value is the position of an item within the collection. The first item of a collection is associated with position 1.

The following notations are used for instantiated arguments:

• A list of elements ${e}_{1},{e}_{2},\cdots ,{e}_{n}$ is denoted $\left[{e}_{1},{e}_{2},\cdots ,{e}_{n}\right]$.

• A finite set of integers ${i}_{1},{i}_{2},\cdots ,{i}_{n}$ is denoted $\left\{{i}_{1},{i}_{2},\cdots ,{i}_{n}\right\}$.

• A multiset of integers ${i}_{1},{i}_{2},\cdots ,{i}_{n}$ is denoted $\left\{\left\{{i}_{1},{i}_{2},\cdots ,{i}_{n}\right\}\right\}$.

• A collection of $n$ items, each item having $m$ attributes, is denoted by

$〈{𝚊}_{1}-{v}_{11}\cdots {𝚊}_{m}-{v}_{1m},{𝚊}_{1}-{v}_{21}\cdots {𝚊}_{m}-{v}_{2m},\cdots ,{𝚊}_{1}-{v}_{n1}\cdots {𝚊}_{m}-{v}_{nm}〉$. Each item is separated from the previous item by a comma. When the items of the collection involve a single attribute ${𝚊}_{1}$, $〈{v}_{11},{v}_{21},\cdots ,{v}_{n1}〉$ can possibly be used as a shortcut for $〈{𝚊}_{1}-{v}_{11},{𝚊}_{1}-{v}_{21},\cdots ,{𝚊}_{1}-{v}_{n1}〉$.

• The ${i}^{th}$ item of a collection $𝚌$ is denoted $𝚌\left[i\right]$.

• The value of the attribute $𝚊$ of the ${i}^{th}$ item of a collection $𝚌$ is denoted $𝚌\left[i\right].𝚊$. Note that, within an arithmetic expression, we can use the shortcut $𝚌\left[i\right]$ when the collection $𝚌$ involves a single attribute.

• The number of items of a collection $𝚌$ is denoted $|𝚌|$.

EXAMPLE: Let us illustrate with four examples, the types one can create. These examples concern the creation of a collection of variables, a collection of tasks, a graph variable [Dooms06] and a collection of orthotopes.An orthotope corresponds to the generalisation of a segment, a rectangle and a box to the $n$-dimensional case.

• In the first example we define $\mathrm{𝚅𝙰𝚁𝙸𝙰𝙱𝙻𝙴𝚂}$ so that it corresponds to a collection of variables. $\mathrm{𝚅𝙰𝚁𝙸𝙰𝙱𝙻𝙴𝚂}$ is for instance used in the $\mathrm{𝚊𝚕𝚕𝚍𝚒𝚏𝚏𝚎𝚛𝚎𝚗𝚝}$ constraint. The declaration $\mathrm{𝚅𝙰𝚁𝙸𝙰𝙱𝙻𝙴𝚂}:\mathrm{𝚌𝚘𝚕𝚕𝚎𝚌𝚝𝚒𝚘𝚗}\left(\mathrm{𝚟𝚊𝚛}-\mathrm{𝚍𝚟𝚊𝚛}\right)$ defines a collection of items, each of which having one attribute $\mathrm{𝚟𝚊𝚛}$ that is a domain variable.

• In the second example we define $\mathrm{𝚃𝙰𝚂𝙺𝚂}$ so that it corresponds to a collection of tasks, each task being defined by its origin, its duration, its end and its resource consumption. Such a collection is for instance used in the $\mathrm{𝚌𝚞𝚖𝚞𝚕𝚊𝚝𝚒𝚟𝚎}$ constraint. The declaration $\mathrm{𝚃𝙰𝚂𝙺𝚂}:\mathrm{𝚌𝚘𝚕𝚕𝚎𝚌𝚝𝚒𝚘𝚗}\left(\mathrm{𝚘𝚛𝚒𝚐𝚒𝚗}-\mathrm{𝚍𝚟𝚊𝚛},\mathrm{𝚍𝚞𝚛𝚊𝚝𝚒𝚘𝚗}-\mathrm{𝚍𝚟𝚊𝚛},\mathrm{𝚎𝚗𝚍}-\mathrm{𝚍𝚟𝚊𝚛},\mathrm{𝚑𝚎𝚒𝚐𝚑𝚝}-\mathrm{𝚍𝚟𝚊𝚛}\right)$ defines a collection of items, each of which having the four attributes $\mathrm{𝚘𝚛𝚒𝚐𝚒𝚗}$, $\mathrm{𝚍𝚞𝚛𝚊𝚝𝚒𝚘𝚗}$, $\mathrm{𝚎𝚗𝚍}$ and $\mathrm{𝚑𝚎𝚒𝚐𝚑𝚝}$ which all are domain variables.

• In the third example we define a graph as a collection of nodes $\mathrm{𝙽𝙾𝙳𝙴𝚂}$, each node being defined by its index (i.e., identifier) and its successors. Such a collection is for instance used in the $\mathrm{𝚍𝚊𝚐}$ constraint. The declaration $\mathrm{𝙽𝙾𝙳𝙴𝚂}:\mathrm{𝚌𝚘𝚕𝚕𝚎𝚌𝚝𝚒𝚘𝚗}\left(\mathrm{𝚒𝚗𝚍𝚎𝚡}-\mathrm{𝚒𝚗𝚝},\mathrm{𝚜𝚞𝚌𝚌}-\mathrm{𝚜𝚟𝚊𝚛}\right)$ defines a collection of items, each of which having the two attributes $\mathrm{𝚒𝚗𝚍𝚎𝚡}$ and $\mathrm{𝚜𝚞𝚌𝚌}$ which respectively are integers and set variables.

• In the last example we define $\mathrm{𝙾𝚁𝚃𝙷𝙾𝚃𝙾𝙿𝙴𝚂}$ so that is corresponds to a collection of orthotopes. Each orthotope is described by an attribute $\mathrm{𝚘𝚛𝚝𝚑}$. Unlike the previous examples, the type of this attribute does not correspond any more to a basic data type but rather to a collection of $n$ items, where $n$ is the number of dimensions of the orthotope.1 for a segment, 2 for a rectangle, 3 for a box, ... . This collection, named $\mathrm{𝙾𝚁𝚃𝙷𝙾𝚃𝙾𝙿𝙴}$, defines for a given dimension the origin, the size and the end of the object in this dimension. This leads to the two declarations:

• $\mathrm{𝙾𝚁𝚃𝙷𝙾𝚃𝙾𝙿𝙴}-\mathrm{𝚌𝚘𝚕𝚕𝚎𝚌𝚝𝚒𝚘𝚗}\left(\mathrm{𝚘𝚛𝚒}-\mathrm{𝚍𝚟𝚊𝚛},\mathrm{𝚜𝚒𝚣}-\mathrm{𝚍𝚟𝚊𝚛},\mathrm{𝚎𝚗𝚍}-\mathrm{𝚍𝚟𝚊𝚛}\right)$,

• $\mathrm{𝙾𝚁𝚃𝙷𝙾𝚃𝙾𝙿𝙴𝚂}-\mathrm{𝚌𝚘𝚕𝚕𝚎𝚌𝚝𝚒𝚘𝚗}\left(\mathrm{𝚘𝚛𝚝𝚑}-\mathrm{𝙾𝚁𝚃𝙷𝙾𝚃𝙾𝙿𝙴}\right)$.

$\mathrm{𝙾𝚁𝚃𝙷𝙾𝚃𝙾𝙿𝙴𝚂}$ is for instance used in the $\mathrm{𝚍𝚒𝚏𝚏𝚗}$ constraint.