Skip to content

v2.11.0

Choose a tag to compare

@rcrida rcrida released this 01 Jun 10:26
· 116 commits to main since this release

What's new

SumConstraint

  • New SumConstraint<N extends Number>: constrains the sum of a set of numeric variables against a fixed bound using any Operator (==, <=, >=, etc.)
  • csp.sumConstraint(Set.of(v1, v2, v3), Operator.EQ, 15)v1 + v2 + v3 == 15
  • MagicSquareTest now uses sumConstraint for all 8 line sums (rows, columns, diagonals)

Static factory methods for binary constraints

  • Added of() factory methods to all binary constraint classes: BinaryEqualsConstraint, BinaryNotEqualsConstraint, BinaryOffsetConstraint, BinaryPredicateConstraint, BinaryTuplesConstraint, BinaryAtMostOneConstraint, BinaryReifiedUnaryConstraint
  • BinaryOffsetConstraint.of(left, offset, operator, right) — parameter order matches csp.offsetConstraint()
  • All internal builder usages replaced with of() calls

Constraint toString improvements

  • UnaryValueConstraint: variable == value (was {(value)})
  • ReifiedConstraint / ImplicationConstraint / BinaryReifiedUnaryConstraint: body rendered via getRelation() for consistent nested output

Documentation

  • README: complete constraint builder method reference (unary, binary, n-ary, reification)
  • README: Local Search solver chain section with usage examples and factory descriptions