Skip to content

v2.13.0

Choose a tag to compare

@rcrida rcrida released this 01 Jun 14:13
· 103 commits to main since this release

What's new

MiniZinc-compatible constraints

  • IncreasingConstraint / DecreasingConstraintvars[0] <= vars[1] <= ... / vars[0] >= vars[1] >= ... for any Comparable type, with AC3 decomposition via the new BinaryComparatorConstraint. Integration: N-Queens symmetry breaking halves 92 solutions to 46.

  • BinaryComparatorConstraintleft <op> right for any Comparable type (not just Number). Overloads the existing csp.comparatorConstraint(v1, op, v2) builder method. Enables getAsBinaryConstraints() in ordering constraints.

  • LinearConstraint — weighted sum a1*v1 + a2*v2 + ... <op> bound via csp.linearConstraint(Map.of(v1, a1, v2, a2, ...), op, bound). Uses type-specific arithmetic (same switch pattern as SumConstraint). Integration: binary knapsack — feasibility and optimisation.

  • LogicOperator enum + BinaryLogicConstraint — all six symmetric binary boolean connectives (AND, OR, XOR, NAND, NOR, XNOR) via csp.logicConstraint(b1, LogicOperator.OR, b2). Replaces BinaryAtMostOneConstraint (NAND is now BinaryLogicConstraint(a, NAND, b)).

  • SumConstraint fixsum() now uses a type-dispatch switch (Byte/Short/Integer/Long/Float/Double) matching BinaryOffsetConstraint, avoiding double precision loss.

Breaking changes

  • BinaryAtMostOneConstraint removed — use BinaryLogicConstraint.of(a, LogicOperator.NAND, b).

New csp builder methods

csp.increasingConstraint(List.of(v1, v2, v3))               // v1 <= v2 <= v3
csp.decreasingConstraint(List.of(v1, v2, v3))               // v1 >= v2 >= v3
csp.comparatorConstraint(v1, Operator.LEQ, v2)              // v1 <= v2  (any Comparable)
csp.linearConstraint(Map.of(v1, 2, v2, 3), Operator.LEQ, 10) // 2*v1 + 3*v2 <= 10
csp.logicConstraint(b1, LogicOperator.OR, b2)               // b1 || b2