On 21 Jun 2011, at 13:51, Johannes Inführ wrote:
> Is it possible in Gecode to channel two SetVarArrays A and B, so that when 
> A[3] contains 5, B[5] contains 3?

There is no specialized propagator for this, but you can implement a 
decomposition using element intersection constraints:

    for (int i=0; i<A.size(); i++) {
      SetVar z0(*this, i,i, Set::Limits::min, Set::Limits::max);
      element(*this, SOT_INTER, B, A[i], z0);
    }

This propagates that the intersection of all B[j] for j in A[i] is z0, which 
contains at least i.

Note that the reverse implication is not propagated: if A[3] does not contain 
5, then B[5] can still contain 3.  You can add
      SetVar z1(*this, i,i, Set::Limits::min, Set::Limits::max);
      element(*this, SOT_INTER, A, B[i], z1);
inside the loop to get both directions.

Cheers,
        Guido

-- 
Guido Tack, http://people.cs.kuleuven.be/~guido.tack/





_______________________________________________
Gecode users mailing list
[email protected]
https://www.gecode.org/mailman/listinfo/gecode-users

Reply via email to