# Constraint maximum

The constraint maximum ensures that the minimum value among those assigned to variables of list respects a numerical condition ($\odot$, $k$) composed of an operator in {lt,le,ge,gt,eq,ne,in,notin} and a right operand which is an integer value, a variable or an integer interval.

maximum($X$, ($\odot$, $k$) with $X=\langle x_1,x_2,\ldots\rangle$, iff $\max\{x_i : 1 \leq i \leq |X|\} \odot k$

#### Syntax

<maximum>
<list> (intVar wspace)2+ </list>
<condition> "(" operator "," operand ")" </condition>
</maximum>


In the following example, the first constraint states that max{x1, x2, x3, x4} = y whereas the second constraint states that max{z1, z2, z3, z4, z5} < w.

#### Example

<maximum>
<list> x1 x2 x3 x4 </list>
<condition> (eq,y) </condition>
</maximum>
<maximum>
<list> z1 z2 z3 z4 z5 </list>
<condition> (lt,w) </condition>
</maximum>


Another form of maximum, sometimes called arg_max, ensures that index is the index of a variable in list that respect the numerical condition. The optional attribute startIndex of list gives the number used for indexing the first variable in list (0, by default). The optional attribute rank of index indicates if index is the first index, the last index or any index of a variable of list that respect the numerical condition (any, by default). The element condition becomes optional.

We give the semantics for rank=any, with indexing assumed to start at 1 for simplicity.

• maximum($X$, $i$) with $X=\langle x_1,x_2,\ldots \rangle$, iff $i \in \{j : 1 \leq j \leq |X| \land x_j = \max\{x_k : 1 \leq k \leq |X|\}\}$
• maximum($X$, $i$, ($\odot$, $k$)), iff maximum($X$, $i$) and maximum($X$, ($\odot$, $k$)

#### Syntax

<maximum>
<list  [ startIndex="integer" ]> (intVar wspace)2+ </list>
<index  [ rank="rankType" ]> intVar </index>
[ <condition> "(" operator "," operand ")" </condition> ]
</maximum>