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
- 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 KIntVar &x, char *name = 0)¶
Constructor for
x == tab[i]
- Parameters
tab – the values
i – the index variable
x – the value variable
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
-
KElement(KIntArray &tab, const KIntVar &i, const int x, char *name = 0)¶
Constructor for
x == tab[i]
- Parameters
tab – the values
i – the index variable
x – the value constant
name – name of the constraint
-
KElement(const KIntVar &i, const KIntVar &x, const KIntArray &starts, const KIntArray &ends, const KIntArray &values, const int offset = 0, const char *name = 0)¶
Constructor for
x = D[i + offset]
withD
being a sparse interval map.Given a list of intervals
[s_i, e_i)
with associated valuesv_i
, thens_i <= y < e_i => D[y] = v_i
- Parameters
i – t
x – the value variable
starts – Interval starts
s_i
ends – Interval ends
e_i
values – Interval values
v_i
offset – potential offset for the indxing variable
name – name of the constraint