Package jpaul.Constraints.SetConstraints

Test of the generic constraint solver: set constraint solver.


Class Summary
CtDiffConstraint<T> CtDiffConstraint models a "difference with a constant set" constraint.
FilterConstraint<T> FilterConstraint models a filtering constraint.
IntersectConstraint<T> IntersectConstraint models a set intersection constraint.
SetConstraints<T> SetConstraints is a collection of set constraints.
SVar<T> SVar is a variable whose values are sets of Ts.

Package jpaul.Constraints.SetConstraints Description

Test of the generic constraint solver: set constraint solver.

This package tests the generic constraint solver from the package jpaul.Constraints by instantiating it for set constraints. It is mostly intended as a test case, but can also be used for set constraint solving in research prototypes.

To obtain a set constraint solver, the only important operation was to subclass Var into SVar. SVar models a set-valued variable; it implements implements the copy and join operations for elements of powerset lattices. SetConstraints is just a convenience class that eases the generation of common set constraints.

Five set constraints are available. Two of them are direct instances of more general constraints: inclusion between two set variables and inclusion between a constant set and a set variable (see SetConstraints.addInclusion and SetConstraints.addCtSource). We also have three more interesting ones: IntersectConstraint, FilterConstraint, and CtDiffConstraint. You can define other constraints by subclassing Constraint.

Example constraint code: simplified IntersectConstraint

Alexandru Salcianu -

Copyright 2005 Alexandru Salcianu -