IBM ILOG Solver User's Manual > Developing Solver Applications > Designing Models > Use objects > Exploit generic and class constraints

Often, in a problem, a set of objects must satisfy similar constraints. In these cases, it is worth trying to use generic constraints, that is, constraints that are shared by several constrained variables. Since generic constraints are shared, they may save a lot of memory. For instance, the constraint IloAllDiff is a generic constraint: only one constraint is allocated, whatever the number of variables in the array it constrains.

In fact, there are two ways in Solver to implement such a constraint: as a generic constraint or as a class constraint.