KNumVar

class KNumVar : public KPtrArray<KNumVar>

Superclass of decision variables

Subclassed by KFloatVar, KIntVar

Public Types

enum Type

Variable types

Values:

enumerator IsKNumVar

Numeric variables.

enumerator IsKIntVar

Floating-point (continuous) variables.

enumerator IsKFloatVar

Integer variables.

Public Functions

KNumVar()

Default constructor.

KNumVar(KProblem &problem)

main constructor

KNumVar(KProblem *problem, KNumVar_I *numVar)

Constructor with KProblem and KNumVar_I.

KNumVar(KNumVar_I *numVar)

Constructor with KNumVar_I.

KNumVar(const KNumVar &toCopy)

Copy constructor.

KNumVar &operator=(const KNumVar &toCopy)

Assignment copy constructor.

virtual ~KNumVar()

Destructor.

virtual void instantiate(const double value)

Instantiate the variable to value.

KProblem *getProblem() const

returns the KProblem associated with this variable

virtual void setName(const char *name)

Set the name of the variable.

virtual double getInf() const

returns lower bound of this variable

virtual double getSup() const

returns upper bound of this variable

virtual double getValue(void) const

returns current instantiation of the variable (when the variable is not instantiated the returned value is undefined)

virtual bool getIsInstantiated() const

returns true if the variable has been assigned a value, false otherwhise

virtual int getDegree() const

returns the number of constraints where this variable appears

virtual double getTarget() const

get target value

virtual void setInf(double value)

set the lower bound to value

virtual void setSup(double value)

set the upper bound to value

virtual void setTarget(double value)

set the target value

virtual bool canBeInstantiatedTo(double value)

Return true if this variable can be instantiated to ‘value’.

virtual void useShaving(bool use)

activate shaving Y/N

virtual void setHidden(bool hidden)

Hidden variable Y/N.

virtual bool isHidden(void)

Return true iff this variable is hidden.

KNumVar *getCopyPtr() const

Return a copy of this object.

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

Pretty printing.

virtual void print(void *ctx, PrintFunctionPtr *pfp) const

Pretty printing.

virtual int instanceof(void) const

Return the type of this variable

Parameters
  • KNumVar::IsKNumVar – for an instance of the class KNumVar

  • KNumVar::IsKIntVar – for an instance of the class KNumVar

  • KNumVar::IsKFloatVar – for an instance of the class KNumVar