FRAMES NO FRAMES

IlcAllDiff

public IlcConstraint IlcAllDiff(const IlcAnyVarArray array)
public IlcConstraint IlcAllDiff(const IlcAnyVarArray array, IlcFilterLevel level)
public IlcConstraint IlcAllDiff(const IlcIntVarArray array, IlcFilterLevel level)
public IlcConstraint IlcAllDiff(const IlcIntVarArray array)
Definition file: ilsolver/ilcany.h
Include file: <ilsolver/ilosolver.h>

This function creates and returns a constraint stating that the constrained enumerated variables of array must take different values from each other when they are bound. In other words, this constraint extends the operator != for an array of constrained variables. This constraint is for use during a Solver search, for example, inside a goal (an instance of IlcGoal) or inside a constraint (an instance of IlcConstraint). If you are looking for similar functionality for use in an IBM® ILOG® Concert Technology model, see IloAllDiff.

If you do not explicitly state a filter level, then Solver uses the default filter level for this constraint (that is, IlcBasic). The optional argument level may take one of the values of the enumeration IlcFilterLevel, with the exception of the value IlcLow. See IlcFilterLevel for an explanation of filter levels and their effect on constraint propagation.

You must post the returned constraint in order for it to be taken into account, for example, by adding it to an instance of IloSolver.

Example

For example, if you are looking for a Hamiltonian path in a graph that contains no directed cycles, (that is, you are looking for a path that visits each node exactly once) then IlcAllDiff with the parameter IlcExtended applied to an array consisting of the next nodes in the graph will produce the best propagation. In fact, it will achieve arc consistency in the search.

For more information, see IloAllDiff.

See Also: