KElement

class KElement : public KConstraint

This class creates a X == Tab[I + cste] constraint

Example :

KIntArray Tab(...);
KIntVar X(...);
KIntVar I(...);
// ...
problem.post(KElement(Tab,I,X,4,"X == Tab[I + 4]"));

See

KConstraint

Since

2016.1

Public Functions

KElement(KIntArray &Tab, const KIntVar &I, const KIntVar &X, const int offset, char *name = 0)

Constructor for X == Tab[I + cste]

Parameters
  • Tab – the values

  • I – the index variable

  • X – the value variable

  • offset – constant offset of index

  • name – name of the constraint

KElement(KIntArray &Tab, const KIntVar &I, const int x, const int offset, char *name = 0)

Constructor for x == Tab[I + cste]

Parameters
  • Tab – the values

  • I – the index variable

  • x – the value constant

  • offset – constant offset of index

  • name – name of the constraint