Skip to content

v2.17.0

Choose a tag to compare

@rcrida rcrida released this 05 Jun 15:48
· 43 commits to main since this release

New Constraints

  • InverseConstraint — enforces f[i]==j ↔ invf[j-1]==i+1 (MiniZinc inverse); with two-pass pairwise arc-consistency propagation
  • AmongConstraint — counts variables whose value falls in a set S and compares to a bound (MiniZinc among); generalises CountConstraint from one value to a set

New Propagators (Propagatable)

All new propagators are registered in PropagationFixpointSolver and LocalSolver via the FixpointConsistency.of(Constraint.class) pattern — adding a new propagator to either chain is now a one-line change.

  • LinearConstraint — weighted-sum bounds propagation (handles negative coefficients)
  • CountConstraint — classifies variables as definite/possible/impossible; prunes when quota is filled (EQ/LEQ) or must be reached (EQ/GEQ)
  • InverseConstraint — arc consistency between f and invf arrays
  • AmongConstraint — same definite/possible/impossible logic as CountConstraint but over a set of values
  • AtLeastNConstraint — forces possibly-true booleans to true when exactly enough remain
  • AtMostNConstraint — forces possibly-true booleans to false when the quota is filled
  • CumulativeConstraint — moved from a separate decorator into the combined fixpoint loop so it interacts with AC3, AllDiff GAC, and other propagators

API Additions

  • EnumDomain.of(E first, E... rest) — varargs factory for restricted enum domains
  • CSP.Builder.inverseConstraint(f, invf) and CSP.Builder.amongConstraint(vars, values, op, n)

Infrastructure

  • ConstraintConsistency @FunctionalInterface — common contract for all propagation passes
  • FixpointConsistency.of(Class) — replaces the seven deleted per-type consistency classes (SumConsistency, AllDiffConsistency, etc.) and the ConsistencyFixpoint utility; filters by constraint type and runs to fixpoint
  • BinaryDecomposable interface — replaces the Optional-based getAsBinaryConstraints() on NaryConstraint
  • Deleted vestigial solver decorators: ArcConsistentSolver, AllDiffConsistentSolver, CumulativeConsistentSolver
  • Integration tests: TaskAssignmentInverseTest, MealPlanningTest

Installation

<dependency>
    <groupId>io.github.rcrida</groupId>
    <artifactId>jcsp</artifactId>
    <version>2.17.0</version>
</dependency>