2.3.2.2. Elementary constraints attached to the arcs
This section describes the constraints that are associated with the arcs of the initial graph of a global constraint. These constraints are called arc constraints. To each arc one can associate one or several arc constraints. An arc will belong to the final graph if and only if all its arc constraints hold. An arc constraint from a vertex to a vertex mentions variables and/or values associated with and . Before defining an arc constraint, we first need to introduce simple arithmetic expressions as well as arithmetic expressions. Simple arithmetic expressions and arithmetic expressions are defined recursively.
Simple arithmetic expressions
A simple arithmetic expression is defined by one of the five following expressions.
: is an integer.
: is an argument of the global constraint of type or .
: is a formal parameter provided by the arc generatorArc generators are described in SectionΒ 2.3.2.3 on page 2.3.2.3. of the graph-constraint.
: is a formal parameter provided by the arc generator or the collection used in the iterator.The iterator is described in SectionΒ 2.3.3.1 on page 2.3.3.1. is an attribute of the collection referenced by .
EXAMPLE: As an example consider the first graph-constraint associated with the constraint and its arc constraint . Both, as well as are simple arithmetic expressions of the form :
In , corresponds to the formal parameter provided by the arc generator , while is an attribute of the collection.
In , corresponds to the collection denoted by the iterator, while is an attribute of the collection.
: is an argument of type , one attribute of and an arithmetic expression.
denotes the value of attribute of the item of the collection denoted by .
EXAMPLE: As an example consider the constraint and its second graph-constraint, which defines the variable. The expression is a simple arithmetic expression of the form :
is a collection of items where all items are sorted in increasing order on attributes (because of the restriction ).
denotes the value of attribute of an item of the collection. The position of this item within the collection depends on the position of a variable of the collectionThis position is denoted by the expression . As defined in SectionΒ 2.2.2 on page 2.2.2, is an implicit attribute corresponding to the position of an item within a collection. as well as on the position of a value of the collection.This position is denoted by the expression .
Arithmetic expressions
An arithmetic expression is recursively defined by one of the following expressions:
A simple arithmetic expression.
-
is an arithmetic expression,
is one of the following symbols , , , denotes an integer division, a division in which the fractional part is discarded.,
is an arithmetic expression.
-
is an argument of type and denotes the number of items of that collection.
-
is an arithmetic expression, and denotes the absolute value of this expression.
is an arithmetic expression, and the sign of ( if is negative, 0 if is equal to 0, 1 if is positive).
:
is a reference to a set of integers or to a set variable. denotes the number of elements of that set.
- ,
or
is a simple arithmetic expression,
is a simple arithmetic expression.
Arc constraints
Now that we have introduced simple arithmetic expressions as well as arithmetic expressions we define an arc constraint. An arc constraint is recursively defined by one of the following expressions:
This stands for an arc constraint that always holds. As a result, the corresponding arc always belongs to the final graph.
-
is an arithmetic expression,
is one of the comparison operators , , , , , ,
is an arithmetic expression.
EXAMPLE: As an example of such arc constraint, the second graph-constraint of the constraint uses the following arc constraints:
,
,
.
The conjunction of these three arc constraints can be interpreted in the following way: an arc from a task to a task will belong to the final graph if and only if overlaps the origin of .
-
is an arithmetic expression,
is an argument of type that can only take one of the values , , , , , ,
is an arithmetic expression.
-
is an arithmetic expression,
is an argument of type that can only take one of the values , , , , , ,
is an arithmetic expression.
-
is a global constraint defined in the catalogue for which there exists a graph-based and/or an automaton-based representation,
correspond to the arguments of the global constraint . Each argument should be a simple arithmetic expression that is compatible with the type declaration of the argument of .
-
is an arc constraint,
is one of the logical connectors , , , ,
is an arc constraint.