IBM ILOG Solver User's Manual > Extending the Library > Writing a Constraint: Allocating Frequencies > Understanding constraints > Invariants: What to propagate?

A constraint that links variables is an object with a task: that of reducing the domains of those variables in terms of the semantics of those variables. For example, once you have posted the constraint x <= y, that constraint must insure that the values in the domains of x and y satisfy the constraint. From a working point of view, that constraint must eliminate values from the domains of the variables, values that are definitely inconsistent.

When you are writing a constraint, it is a good idea to start by defining the invariant of that constraint before you implement it by means of elementary modifiers. (The term invariant is used here in the usual sense of software engineering.)

Let's look again at the example of x <= y in this context. Its invariant is easy to determine, and can be expressed this way:

With elementary modifiers, this invariant can be translated this way:

x.setMax(y.getMax()); 
y.setMin(x.getMin()); 

The next section shows what Solver does with such an invariant.