Skip to content

v2.6.0

Choose a tag to compare

@rcrida rcrida released this 19 May 19:07
· 149 commits to main since this release

New Features

Boolean cardinality constraints

Three new n-ary constraint types for boolean variable formulations, with corresponding CSP.Builder helpers:

  • atLeastNConstraint(vars, n) — at least n variables are true; satisfied on partial assignments as long as n true values are still reachable
  • atMostNConstraint(vars, n) — at most n variables are true
  • exactlyOneConstraint(vars) — exactly one variable is true; enforces both the upper and lower bound on full assignments

Local search optimization

LocalSolver now has a default getLocalSolution(csp, factory, objective) overload. MinConflictsSolver overrides it with:

  • Best-feasible solution tracking across all steps
  • Lexicographic value selection: violations minimised first, objective as tie-breaker (no fragile scaling constant)
  • Constraint weights updated only during the infeasible repair phase, preventing bias when perturbing feasible assignments

Pluggable variable selectors

ConflictedVariableSelector and RandomVariableSelector are now standalone UnassignedVariableSelector implementations injectable into MinConflictsSolver via builder. The default uses conflicted selection during repair and random selection when feasible.

BranchAndBoundSolver strategies

BranchAndBoundSolver now accepts pluggable UnassignedVariableSelector, DomainValuesOrderer, and Inference strategies, mirroring BacktrackingSearch. MAC propagation after each assignment is particularly effective for boolean variable formulations.