KUserNumConstraint

class KUserNumConstraint : public KConstraint

The KUserNumConstraint is the generic counterpart to the KUserConstraint for implementing user constraints when using numeric variables.

Public Types

enum askRet

askIfEntailed return values

Values:

enumerator CUNKNOWN
enumerator CFALSE
enumerator CTRUE

Public Functions

KUserNumConstraint(KNumVar &v1)

Constructor for unary constraints.

KUserNumConstraint(KNumVar &v1, KNumVar &v2)

Constructor for binary constraints.

KUserNumConstraint(KNumVarArray &vars)

Constructor for n-ary constraints.

KUserNumConstraint(const KUserNumConstraint &toCopy)

Copy constructor.

virtual KConstraint *getCopyPtr() const

Virtual copy method. Must be implemented by the user.

virtual KConstraint *getInstanceCopyPtr(const KProblem &problem) const

Virtual instance copy method. Each modeling elements stored (and used) in the user constraint must be copied using the KProblem::getCopyPtr() method. Must be implemented by the user when solving problems in parallel.

virtual void propagate(void)

Virtual method called when the domain of some or several variables has changed.

virtual void awake(void)

Virtual method called upon initialization of the constraint.

virtual void awakeOnInf(KNumVar &var)

Virtual method called when the lower bound of var has been raised.

virtual void awakeOnSup(KNumVar &var)

Virtual method called when the upper bound of var has been lowered

Parameters

var – the variable with modified domain

virtual void awakeOnInst(KNumVar &var)

Virtual method called when the variable var has been instantiated

Parameters

var – the variable with modified domain

virtual void awakeOnRem(KIntVar &var, int removedValue)

Virtual method called when the value removedValue has been removed from the domain of var

Parameters
  • var – the variable with modified domain

  • removedValue – the value that has been removed from the domain of var

virtual void awakeOnVar(KNumVar &var)

Virtual method called when the domain of variable var has changed

Parameters

var – the variable with modified domain

virtual int askIfEntailed(void)

Virtual method for use within boolean connectors

Returns

CTRUE whenever the constraint is definitively satisfied

Returns

CFALSE whenever the constraint is definitively violated

Returns

CUNKNOWN otherwhise

virtual void print(std::ostream &fout) const

Pretty printing of the constraint