Skip to content

v2.20.0

Choose a tag to compare

@rcrida rcrida released this 18 Jun 16:22
· 25 commits to main since this release

BoundSolver API — factory-time chain construction

Solver.Factory.createSolver(csp) and createSolver(csp, objective) now return a BoundSolver with the CSP already bound, eliminating the redundant double-passing at call sites.

API changes

Before:

Solver solver = Solver.Factory.INSTANCE.createSolver();
solver.getSolutions(csp).forEach(...);
solver.getSolution(csp, objective);

After:

Solver.Factory.INSTANCE.createSolver(csp).getSolutions().forEach(...);
Solver.Factory.INSTANCE.createSolver(csp, objective).getSolution();

Details

  • createSolver(csp) — satisfaction chain; returns a lambda BoundSolver backed by the full decorator chain (NodeConsistency → PropagationFixpoint → IndependentSubproblems → TreeDecomposition → CutsetConditioning → BacktrackingSearch)
  • createSolver(csp, objective) — optimization chain; returns a BoundSolver whose getSolution() uses reduce((a,b) -> b) to return the global optimum (not the first improving candidate), and getSolutions() streams the improving sequence
  • Two distinct chains: satisfaction snaps non-singleton IntervalDomain variables to midpoints; optimization leaves intervals open for BisectionConditioningSolver
  • ConstraintSatisfactionProblem.isFullyDetermined() extracted from SolverDecorator for reuse in BisectionConditioningSolver