Skip to content

v2.3.0

Choose a tag to compare

@rcrida rcrida released this 13 May 14:35
· 170 commits to main since this release

New features

  • GreedyAssignmentFactory — initial assignment factory for MinConflictsSolver that assigns each variable the least-conflicting value from its domain given already-assigned variables; ties broken randomly. Typically produces far fewer starting conflicts than random, reducing local search steps. Available as GreedyAssignmentFactory.INSTANCE.
  • Domain.toList() — default method on the Domain interface returning the domain values as a List<?>. DomainObjectSet overrides for efficiency.

Bug fix

DomainObjectSet.contains(null) no longer throws NullPointerException when the backing set is a Java immutable Set.of(...). The method now returns false for null, honouring the @Nullable contract.

Breaking changes

ConstraintSatisfactionProblem.getDomain(Variable) now returns Domain directly and throws NoSuchElementException if the variable is not present. The previous Optional-returning behaviour is available as findDomain(Variable), following the find/get convention (findDomain = maybe, getDomain = always present).

// before → after
csp.getDomain(v).get()          → csp.getDomain(v)
csp.getDomain(v).orElseThrow()  → csp.getDomain(v)
csp.getDomain(v).isPresent()    → csp.findDomain(v).isPresent()
csp.getDomain(v).map(...)       → csp.findDomain(v).map(...)

RandomAssignmentFactory constructor is now private. Use RandomAssignmentFactory.INSTANCE instead of new RandomAssignmentFactory().