Skip to content

Commit af234d6

Browse files
committed
Fix conf when not all vars are enumerated => this can lead to errors in explanation generation
1 parent e22de5a commit af234d6

File tree

1 file changed

+8
-0
lines changed
  • solver/src/main/java/org/chocosolver/solver/constraints/nary/alldifferent

1 file changed

+8
-0
lines changed

solver/src/main/java/org/chocosolver/solver/constraints/nary/alldifferent/AllDifferent.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,14 @@ private static Propagator[] createPropagators(IntVar[] VARS, String consistency)
5151
message = "Warning: Adjust consistency level of AllDifferent from \"AC_ZHANG\" to " +
5252
"\"AC_TUNED\" due to LCG.";
5353
}
54+
boolean allEnum = Arrays.stream(VARS).allMatch(IntVar::hasEnumeratedDomain);
55+
if (!allEnum) {
56+
if (consistency.startsWith("AC") || consistency.equals("DEFAULT")) {
57+
consistency = "BC";
58+
message = "Warning: Adjust consistency level of AllDifferent to \"BC\" due to LCG" +
59+
"because not all variables are enumerated.";
60+
}
61+
}
5462
if (!message.isEmpty() && model.getSettings().warnUser()) {
5563
model.getSolver().log().white().println(message);
5664
}

0 commit comments

Comments
 (0)