public static Constraint atmost_nvalues(IntVar[] VARS, IntVar NVALUES, boolean GREEDY) {
TIntArrayList vals = getDomainUnion(VARS);
if (GREEDY) {
Gci gci = new Gci(VARS, new AutoDiffDetection(VARS));
R[] rules = new R[]{new R1(), new R3(VARS.length, NVALUES.getSolver())};
return new Constraint("AtMostNValues", new PropAtMostNValues(VARS, vals, NVALUES),
new PropAMNV(VARS, NVALUES, gci, new MDRk(gci), rules));
} else {
return new Constraint("AtMostNValues", new PropAtMostNValues(VARS, vals, NVALUES));
}
}