KAllDifferent

class KAllDifferent : public KConstraint

This class creates a X1 <> X2 <> … <> Xn constraint

Example :

KIntVarArray X(...);
// ...
// Strong propagation
problem.post(KAllDifferent("allDiff(X)",X,KAllDifferent::GENERALIZED_ARC_CONSISTENCY));
// Weak propagation
problem.post(KAllDifferent("allDiff(X)",X,KAllDifferent::FORWARD_CHECKING));

See

KConstraint

Since

2016.1

Public Types

enum PropagationLevel

Differents level of propagation for the constraints.

Values:

enumerator FORWARD_CHECKING
enumerator BOUND_CONSISTENCY
enumerator GENERALIZED_ARC_CONSISTENCY
enumerator USING_GCC

Public Functions

KAllDifferent(const char *name, KIntVarArray &vars, int propagationLevel = FORWARD_CHECKING)

Primary constructor for the all different constraint

Parameters
  • name – for pretty printing of the constraint

  • vars – array of variables that must take different values

  • propagationLevel – FORWARD_CHECKING for forward checking propagation

  • propagationLevel – BOUND_CONSISTENCY for bound consistency propagation

  • propagationLevel – GENERALIZED_ARC_CONSISTENCY for generalized arc consistency propagation

  • propagationLevel – USING_GCC for a similar propagation, internally using a Global Cardinality Constraint

KAllDifferent(const KAllDifferent &toCopy)

Copy constructor.