Link Search Menu Expand Document
Specifications PyCSP3 Tools Instances Competitions About

Constraint instantiation

The constraint instantiation represents a set of unary constraints corresponding to variable assignments. There are three main interests in introducing it. First, when modeling, rather often we need to instantiate a subset of variables (for example, for taking some hints/clues into consideration, or for breaking some symmetries). It is simpler, more natural and informative to post a constraint instantiation than a set of unary constraints intension. Second, instantiations can be used to represent partial search instantiations that can be directly injected into XCSP3 instances. Third, instantiations allow us to represent solutions, as explained in another section, having this way the output of the format made compatible with the input.

The constraint instantiation ensures that the ith variable x of list is assigned the ith value of values. Every variable can only occur once in list.

Syntax

instantiation>
    <list> (intVar wspace)+ </list>
    <values> (intVal wspace)+ </values>
</instantiation>
instantiation($X$,$V$) with $X=\langle x_1,\ldots,x_r \rangle$ and $V=\langle v_1,\ldots,v_r \rangle$, iff $\forall i : 1 \leq i \lt |X|, x_i = v_i$

In our example below, we have a first constraint that enforces x=12, y=4 and z=30, and a second constraint involving an array w of 6 variables such that w[0]=1, w[1]=0, w[2]=2, w[3]=1, w[4]=3, w[5]=1.

Example

<instantiation>
    <list> x y z </list>
    <values> 12 4 30 </values>
</instantiation>
<instantiation>
<list> w[] </list>
<values> 1 0 2 1 3 1 </values>
</instantiation>