Jérémie Vautard wrote:
Is there an implementation of the nvalues global constraint in
Gecode ? (This constraint is used to specify the number of different
values in an array of variables, and described in the Global
constraint catalog here : http://www.emn.fr/x-info/sdemasse/gccat/
sec5.186.html )

No, we don't have it yet. You can emulate it using set constraints. Here's the pseudo code:

IntVarArgs x;
SetVar y;
IntVar n;
rel(home, SOT_UNION, x, y);
cardinality(home, y, n);

The variable n is now equal to the number of different values in x. If the number of values is fixed, you can of course use a constant cardinality for y instead. This decomposition certainly doesn't achieve domain consistency, but it should work.

Cheers,
        Guido

Attachment: smime.p7s
Description: S/MIME cryptographic signature

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

Reply via email to