Skip to content

v2.26.0

Latest

Choose a tag to compare

@rcrida rcrida released this 27 Jun 13:41
· 3 commits to main since this release

What's new

Search limits (SolverLimits + LimitExceededException)

Cap the amount of backtracking search with node-count and/or wall-clock time limits:

BoundSolver solver = Solver.Factory.INSTANCE.createSolver(csp, SolverLimits.ofNodes(10_000));
BoundSolver solver = Solver.Factory.INSTANCE.createSolver(csp, SolverLimits.ofTime(Duration.ofSeconds(5)));
BoundSolver solver = Solver.Factory.INSTANCE.createSolver(csp, SolverLimits.of(10_000, Duration.ofSeconds(5)));

getSolution() now throws LimitExceededException (carrying a Statistics snapshot) when a limit is hit, distinguishing that case from genuine UNSAT (Optional.empty()). getSolutions() truncates the stream silently for anytime-search use cases.

try {
    Optional<Assignment> solution = solver.getSolution();
    // Optional.empty() → genuinely UNSAT
} catch (LimitExceededException e) {
    System.out.println("Explored " + e.getStatistics().getNodesExplored() + " nodes");
}

Other changes

  • Dependency bumps (Lombok, JUnit Jupiter, Mockito, SLF4J, central-publishing-maven-plugin)