 Integer Variables

Integer variables are given a domain of values by listing them, using whitespace as separator. More precisely, the content of an element var that represents an integer variable is an ordered sequence of integer values and integer intervals. We have for example:

• 1 5 10 that corresponds to the set {1,5,10}.
• 1..3 7 10..14 that corresponds to the set {1,2,3,7,10,11,12,13,14}.

Syntax

<var id="identifier"  [ type="integer" ]>
((intVal | intIntvl) wspace)*
</var>

As an illustration, below, both variables foo and bar exhibit the same domain, whereas qux mixes integer and integer intervals:

Example

<var id="foo"> 0 1 2 3 4 5 6 </var>
<var id="bar"> 0..6 </var>
<var id="qux"> -6..-2 0 1..3 4 7 8..11 </var>

Declaring a 0/1 variable is made explicitly, i.e, with the same syntax as an ordinary’’ integer variable. For example, b1 and b2 are two 0/1 variables that can be served as Boolean variables in logical expressions:

Example

<var id="b1"> 0 1 </var>
<var id="b2"> 0 1 </var>

Not all domains of integer variables are necessarily finite. Indeed, it is possible to use the special value infinity, preceded by the mandatory sign + or - (necessarily, as a bound of an integer interval). For example:

Example

<var id="x"> 0..+infinity </var>
<var id="y"> -infinity..+infinity </var>

Finally, when domains of certain variables are similar, and it appears that declaring array(s) is not appropriate, we can use the optional attribute as to indicate that an element has the same content as another one; the value of as must be the value of an attribute id, s explained in the specifications (pdf document). Below, v2 is a variable with the same domain as v1.

Example

<var id="v1"> 2 5 8 9 12 15 22 25 30 50 </var>
<var id="v2" as="v1" />

As shown by the syntax, for an integer variable, the attribute type is optional: if present, its value must be integer.

The integer values and intervals listed in the domain of an integer variable must always be in increasing order, without several occurences of the same value. For example, 0..10 10 is forbidden to be the content of an element var.