2.1.2. Compound data types
We provide the following compound data types:
corresponds to a list of elements of type , where is a basic or a compound data type.
corresponds to a collection of ordered items, where each item consists of attributes . Each attribute is an expression of the form , where is the name of the attribute and 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 , 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 is denoted .
A finite set of integers is denoted .
A multiset of integers is denoted .
A collection of items, each item having attributes, is denoted by
. Each item is separated from the previous item by a comma. When the items of the collection involve one single attribute , can eventually be used as a shortcut for .
The item of a collection is denoted .
The value of the attribute of the item of a collection is denoted . Note that, within an arithmetic expression, we can use the shortcut when the collection involves one 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 -dimensional case.
In the first example we define so that it corresponds to a collection of variables. is for instance used in the constraint. The declaration defines a collection of items, each of which having one attribute that is a domain variable.
In the second example we define 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 constraint. The declaration defines a collection of items, each of which having the four attributes , , and which all are domain variables.
In the third example we define a graph as a collection of nodes , each node being defined by its index (i.e., identifier) and its successors. Such a collection is for instance used in the constraint. The declaration defines a collection of items, each of which having the two attributes and which respectively are integers and set variables.
In the last example we define so that is corresponds to a collection of orthotopes. Each orthotope is described by an attribute . 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 items, where is the number of dimensions of the orthotope.1 for a segment, 2 for a rectangle, 3 for a box, ... . This collection, named , defines for a given dimension the origin, the size and the end of the object in this dimension. This leads to the two declarations: