All different constraint

The all different constraint is a specialized constraint which forces every decision variable in a given group to assume a value different from the value of every other decision variable in that group.

An all different constraint forces every decision variable in a given group to assume a value different from the value of every other decision variable in that group. In other words, no two of those decision variables will have the same integer value when this constraint is satisfied.

For example, if the decision variables x, y and z share the domain of integers from 1 through 10, inclusive, then an all different constraint applied to x, y and z could return such solutions as 1, 2, 3 or 4, 6, 8 or 9, 5, 2. However, 1,1, 2 would not be a solution to an all different constraint over those three variables.

In the C++ API of CP Optimizer, the class IloAllDiff represents all different constraints. For samples of this constraint, see teambuilding.cpp or sports.cpp.

In the Java™ API of CP Optimizer, the method IloCP.allDiff represents all different constraints. For samples of this constraint, see Teambuilding.java or Sports.java.

In the C# API of CP Optimizer, the method CP.AllDiff represents all different constraints. For samples of this constraint, see Teambuilding.cs or Sports.cs.