Link Search Menu Expand Document
Specifications PyCSP3 Tools Instances Competitions About

Constraint minimum

The constraint minimum 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.

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

Syntax

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

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

Example

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

Another form of minimum, sometimes called arg_min, 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.

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

Syntax

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