What's new
GlobalCardinalityConstraint
GlobalCardinalityConstraint<T> — open GCC: for each entry in a Map<T, Integer>, exactly that many variables must take that value; unlisted values are unconstrained. csp.globalCardinalityConstraint(vars, Map.of(RED, 3, GREEN, 2, BLUE, 2)).
- Early failure detection: if any tracked value already exceeds its count during search, fails immediately without waiting for a complete assignment.
- Integration:
AustraliaMapColouringTest narrows 18 valid 3-colorings to the 2 that have the exact distribution RED=3, GREEN=2, BLUE=2.
LexConstraint
LexConstraint<T extends Comparable<T>> — lexicographic ordering between two equal-length variable sequences: [a1, a2, ...] <op> [b1, b2, ...]. Supports all six Operator values; typically LT (strict lex-less, MiniZinc lex_less) or LEQ (lex-less-or-equal, MiniZinc lex_lesseq). csp.lexConstraint(left, Operator.LEQ, right).
- Integration:
MagicSquareTest adds lex(row0 ≤ row2) symmetry breaking — eliminates the top-bottom reflection from each pair, halving 8 solutions to 4.
New csp builder methods
csp.globalCardinalityConstraint(Set.of(v1, v2, v3, v4), Map.of(RED, 2, GREEN, 1, BLUE, 1))
csp.lexConstraint(List.of(a1, a2, a3), Operator.LEQ, List.of(b1, b2, b3))