ROC++  v1.2
Automatic Robust Optimization in C++
DecisionVariableIF Class Referenceabstract

Decision variable interface class. More...

#include <DecisionVariable.hpp>

Inheritance diagram for DecisionVariableIF:

Public Member Functions

 DecisionVariableIF (string name, decVariableType type, double lb, double ub)
 Constructor of the DecisionVariableIF class. More...
 
virtual ~DecisionVariableIF ()
 Destructor of the DecisionVariableIF class. More...
 
decVariableType getType () const
 Get the variable type. More...
 
string getName () const
 Return the name of the decision variable. More...
 
virtual uint getTimeStage () const =0
 Return the time-stage when the decision is made. More...
 
virtual bool isAdaptive () const =0
 Return indicator of adaptability, return value equals true if and only if the decision variable can adapt to the history of observations. More...
 
virtual bool isBooleanVar () const =0
 Return true if and only if the decision variable is of boolean type. More...
 
virtual bool isIntegerVar () const =0
 Return true if and only if the decision variable is of integer type. More...
 
virtual bool isRealVar () const =0
 Return true if and only if the decision variable is of real-valued type. More...
 
double getLB () const
 Return the lower bound of the decision variable. More...
 
double getUB () const
 Return the upper bound of the decision variable. More...
 
virtual void setLB (double lb)
 Set lower bound of the variable. More...
 
virtual void setUB (double ub)
 Set upper bound of the variable. More...
 
virtual ROCPPVarIF_Ptr Clone ()=0
 Return a copy of the decision variable. More...
 
string writeLB () const
 Return the lower bound of the decision variable as a string. More...
 
string writeUB () const
 Return the upper bound of the decision variable as a string. More...
 

Private Attributes

string m_name
 Name of the decision variable. More...
 
const decVariableType m_type
 Type of the decision variable. More...
 
double m_lb
 Lower bound of the decision variable. More...
 
double m_ub
 Upper bound of the decision variable. More...
 

Detailed Description

Decision variable interface class.

Constructor & Destructor Documentation

◆ DecisionVariableIF()

DecisionVariableIF::DecisionVariableIF ( string  name,
decVariableType  type,
double  lb,
double  ub 
)

Constructor of the DecisionVariableIF class.

Parameters
namename of the decision variable
typetype of the decision variable
lblower bound of the variable
ubupper bound of the variable
Note
The time-stage of an adaptive variable must greater than 1 (strictly).

◆ ~DecisionVariableIF()

virtual DecisionVariableIF::~DecisionVariableIF ( )
inlinevirtual

Destructor of the DecisionVariableIF class.

Member Function Documentation

◆ Clone()

virtual ROCPPVarIF_Ptr DecisionVariableIF::Clone ( )
pure virtual

Return a copy of the decision variable.

Implemented in AdaptiveVariableIF, AdaptVarDouble, AdaptVarInt, AdaptVarBool, VariableDouble, VariableInt, and VariableBool.

◆ getLB()

double DecisionVariableIF::getLB ( ) const
inline

Return the lower bound of the decision variable.

Returns
lower bound, double type

◆ getName()

string DecisionVariableIF::getName ( ) const
inline

Return the name of the decision variable.

Returns
name of the decision variable, string type

◆ getTimeStage()

virtual uint DecisionVariableIF::getTimeStage ( ) const
pure virtual

Return the time-stage when the decision is made.

Returns
time-stage, uint type

An adaptive decision taken at time-stage t can depend on all uncertain parameters revealed up to and including time t

Implemented in AdaptiveVariableIF, and VariableIF.

◆ getType()

decVariableType DecisionVariableIF::getType ( ) const
inline

Get the variable type.

Returns
type of the decision variable

◆ getUB()

double DecisionVariableIF::getUB ( ) const
inline

Return the upper bound of the decision variable.

Returns
upper bound, double type

◆ isAdaptive()

virtual bool DecisionVariableIF::isAdaptive ( ) const
pure virtual

Return indicator of adaptability, return value equals true if and only if the decision variable can adapt to the history of observations.

Returns
adaptability indicator, boolean type

Implemented in AdaptiveVariableIF, and VariableIF.

◆ isBooleanVar()

virtual bool DecisionVariableIF::isBooleanVar ( ) const
pure virtual

Return true if and only if the decision variable is of boolean type.

Implemented in AdaptVarDouble, AdaptVarInt, AdaptVarBool, VariableDouble, VariableInt, and VariableBool.

◆ isIntegerVar()

virtual bool DecisionVariableIF::isIntegerVar ( ) const
pure virtual

Return true if and only if the decision variable is of integer type.

Implemented in AdaptVarDouble, AdaptVarInt, AdaptVarBool, VariableDouble, VariableInt, and VariableBool.

◆ isRealVar()

virtual bool DecisionVariableIF::isRealVar ( ) const
pure virtual

Return true if and only if the decision variable is of real-valued type.

Implemented in AdaptVarDouble, AdaptVarInt, AdaptVarBool, VariableDouble, VariableInt, and VariableBool.

◆ setLB()

void DecisionVariableIF::setLB ( double  lb)
virtual

Set lower bound of the variable.

Reimplemented in AdaptVarBool, and VariableBool.

◆ setUB()

void DecisionVariableIF::setUB ( double  ub)
virtual

Set upper bound of the variable.

Reimplemented in AdaptVarBool, and VariableBool.

◆ writeLB()

string DecisionVariableIF::writeLB ( ) const

Return the lower bound of the decision variable as a string.

Returns
lower bound, string type

◆ writeUB()

string DecisionVariableIF::writeUB ( ) const

Return the upper bound of the decision variable as a string.

Returns
upper bound, string type

Member Data Documentation

◆ m_lb

double DecisionVariableIF::m_lb
private

Lower bound of the decision variable.

◆ m_name

string DecisionVariableIF::m_name
private

Name of the decision variable.

◆ m_type

const decVariableType DecisionVariableIF::m_type
private

Type of the decision variable.

◆ m_ub

double DecisionVariableIF::m_ub
private

Upper bound of the decision variable.