Link Search Menu Expand Document
Specifications PyCSP3 Tools Instances Competitions About

Constraint channel

The constraint channel ensures that if the ith variable is assigned the value j, then the jth variable must be assigned the value i. The optional attribute startIndex of list gives the number used for indexing the first variable in this list (0, by default).

For the semantics, indexing assumed to start at 1 for simplicity.

channel($X$) with $X=\langle x_1,x_2,\ldots \rangle$, iff $\forall i : 1 \leq i \leq |X|, x_i =j \Rightarrow x_j=i$

Syntax

<channel>
   <list  [ startIndex="integer" ]> (intVar wspace)2+ </list>
</channel>

Note that the opening and closing tags of list are optional when, of course, the attribute startIndex is not necessary, which gives:

Syntax

<channel> (intVar wspace)2+ </channel>  <!-- Simplified Form -->

Another classical form of channel, sometimes called inverse or assignment in the literature, is defined from two separate lists of variables (that must be of same size). It ensures that the value assigned to the ith variable of the first element list gives the position of the variable of the second element list that is assigned to i, and vice versa. For each list, the optional attribute startIndex gives the number used for indexing the first variable in this list (0, by default).

channel($X$, $Y$) with $X=\langle x_1,x_2,\ldots \rangle$ and $Y=\langle y_1,y_2,\ldots \rangle$, iff $\forall i : 1 \leq i \leq |X|, x_i = j \Leftrightarrow y_j = i$

Syntax

<channel>
  <list  [ startIndex="integer" ]> (intVar wspace)2+ </list>
  <list  [ startIndex="integer" ]> (intVar wspace)2+ </list>
</channel>

Example

<channel>
  <list> x1 x2 x3 x4 </list>
  <list> y1 y2 y3 y4 </list>
</channel>

Another form is obtained by considering a list of 0/1 variables to be channeled with an integer variable. This third form of constraint channel ensures that the only variable of list that is assigned to 1 is at an index (position) that corresponds to the value assigned to the variable in value.

For the semantics, indexing assumed to start at 1 for simplicity.

channel($X$, $v$) with $X=\langle x_1,x_2,\ldots \rangle$</Latex> iff
  • $\forall i : 1 \leq i \leq |X|, x_i = 1 \Leftrightarrow v = i$
  • $\exists i : 1 \leq i \leq |X| \land x_i = 1$

Syntax

<channel>
  <list  [ startIndex="integer" ]> (01Var wspace)2+ </list>
  <value> intVar </value>
</channel>

Example

<channel>
  <list> z1 z2 z3 z4 z5 </list>
  <value> v </value>
</channel>