Overview | Group | Tree | Graph | Index | Concepts |
A generic constraint is a constraint shared by an array of variables. For example, IlcAllDiff is a generic constraint that insures that all the elements of a given array are different from one another. Solver provides generic constraints to save memory since, if you use them, you can avoid allocating one object per variable.
The array makes it easier to implement generic constraints. In fact, member functions of Solver array classes are available to post such generic constraints. A generic constraint is then allocated and recorded only once for all the variables in a given array. This fact represents a significant economy in memory, compared to allocating and recording one constraint per variable.
You create a generic constraint simply by stating the constraint over generic variables. Each generic variable stands for all the elements of an array of constrained variables. In order to create generic variables for an array of constrained expressions, Solver provides the class IlcIndex.
See Also