IBM ILOG Solver User's Manual > Developing Solver Applications > Designing Models > Introduce redundant constraints > Example

The problem of the magic sequence is described Chapter 4, Searching with Predefined Goals: Magic Square. Let's describe it again briefly. Let's assume that we have n+1 unknowns, namely, x0, x1, . . . , xn. These xi must respect the following constraints:

The constraint of this problem can easily be written, using the symbolic counting constraint IloDistribute. However, the search for a solution can be greatly accelerated by introducing the following redundant constraint that expresses the fact that n+1 numbers are counted.

1.x1 + 2.x2 + . . . + n.xn = n+1.