ROC++  v1.2
Automatic Robust Optimization in C++
dvContainer Class Reference

Decision variable container. More...

#include <DecisionVariable.hpp>

Public Types

typedef dvMapType::const_iterator const_iterator
 Constant iterator for decision variable map. More...
 

Public Member Functions

 dvContainer ()
 Constructor of the dvContainer class. More...
 
 ~dvContainer ()
 Destructor of the dvContainer class. More...
 
void operator+= (const dvContainer &a)
 Add non-overlapping decision variables from container a to this container. More...
 
void operator+= (const ROCPPVarIF_Ptr &dv)
 Add another decision variable to this container If the variable already exist, it will be ignored. More...
 
void add_int_vars (dvContainer &dvs) const
 Add integer type variables from this container into the dvs object. More...
 
const_iterator begin () const
 Return a constant iterator pointing to the beginning of the decision variable map. More...
 
const_iterator end () const
 Return a constant iterator pointing to the end of the decision variable map. More...
 
const_iterator find (string varName) const
 Return a constant iterator pointing the variable called varName or to the end of the decision variable map if the variable does not exist. More...
 
const_iterator findthrow (string varName) const
 Find the variable with name varName in this object. If there is no such variable, throw an exception. More...
 
uint getNumContVars () const
 Get the number of real-valued static variables in this container. More...
 
uint getNumIntVars () const
 Get the number of integer static variables in this container. More...
 
uint getNumBoolVars () const
 Get the number of boolean static variables in this container. More...
 
uint getNumAdaptiveContVars () const
 Get the number of real-valued adaptive variables in this container. More...
 
uint getNumAdaptiveVars () const
 Get the number of adaptive variables (of any type) in this container. More...
 
size_t getNumVars () const
 Get the number of decision variables in this container. More...
 
uint getTimeStage () const
 Get the maximum time-stage of any decision-variable in this container. More...
 
bool AnyVarIsInvolved (dvContainer &dvs) const
 Return true if any decision variable in the container dvs exists in this object. More...
 
bool varIsInvolved (ROCPPVarIF_Ptr dv) const
 Find if the decision variable dv exists in this object. More...
 

Private Attributes

uint m_numContVars
 Number of continuous variables in this container. More...
 
uint m_numIntVars
 Number of integer variables in this container. More...
 
uint m_numBoolVars
 Number of boolean variables in this container. More...
 
uint m_adaptiveContVarsCnt
 Number of adaptive continuous variables in this container. More...
 
uint m_adaptiveVarsCnt
 Number of adaptive variables in this container. More...
 
uint m_timeStage
 Max time stage of variables in this container. More...
 
dvMapType m_DVMap
 Map from name to the decision variable. More...
 

Detailed Description

Decision variable container.

Used to store decision variables for classes ConstraintTermIF, LHSExpression, etc

Member Typedef Documentation

◆ const_iterator

typedef dvMapType::const_iterator dvContainer::const_iterator

Constant iterator for decision variable map.

Constructor & Destructor Documentation

◆ dvContainer()

dvContainer::dvContainer ( )
inline

Constructor of the dvContainer class.

Builds an empty container

◆ ~dvContainer()

dvContainer::~dvContainer ( )
inline

Destructor of the dvContainer class.

Member Function Documentation

◆ add_int_vars()

void dvContainer::add_int_vars ( dvContainer dvs) const

Add integer type variables from this container into the dvs object.

◆ AnyVarIsInvolved()

bool dvContainer::AnyVarIsInvolved ( dvContainer dvs) const

Return true if any decision variable in the container dvs exists in this object.

◆ begin()

const_iterator dvContainer::begin ( ) const
inline

Return a constant iterator pointing to the beginning of the decision variable map.

◆ end()

const_iterator dvContainer::end ( ) const
inline

Return a constant iterator pointing to the end of the decision variable map.

◆ find()

dvContainer::const_iterator dvContainer::find ( string  varName) const

Return a constant iterator pointing the variable called varName or to the end of the decision variable map if the variable does not exist.

◆ findthrow()

dvContainer::const_iterator dvContainer::findthrow ( string  varName) const

Find the variable with name varName in this object. If there is no such variable, throw an exception.

◆ getNumAdaptiveContVars()

uint dvContainer::getNumAdaptiveContVars ( ) const
inline

Get the number of real-valued adaptive variables in this container.

◆ getNumAdaptiveVars()

uint dvContainer::getNumAdaptiveVars ( ) const
inline

Get the number of adaptive variables (of any type) in this container.

◆ getNumBoolVars()

uint dvContainer::getNumBoolVars ( ) const
inline

Get the number of boolean static variables in this container.

◆ getNumContVars()

uint dvContainer::getNumContVars ( ) const
inline

Get the number of real-valued static variables in this container.

◆ getNumIntVars()

uint dvContainer::getNumIntVars ( ) const
inline

Get the number of integer static variables in this container.

◆ getNumVars()

size_t dvContainer::getNumVars ( ) const
inline

Get the number of decision variables in this container.

◆ getTimeStage()

uint dvContainer::getTimeStage ( ) const
inline

Get the maximum time-stage of any decision-variable in this container.

◆ operator+=() [1/2]

void dvContainer::operator+= ( const dvContainer a)

Add non-overlapping decision variables from container a to this container.

◆ operator+=() [2/2]

void dvContainer::operator+= ( const ROCPPVarIF_Ptr dv)

Add another decision variable to this container If the variable already exist, it will be ignored.

Note
Adding different variables with same name is not allowed

◆ varIsInvolved()

bool dvContainer::varIsInvolved ( ROCPPVarIF_Ptr  dv) const

Find if the decision variable dv exists in this object.

Returns true if a variable with the same name exists in this container

Member Data Documentation

◆ m_adaptiveContVarsCnt

uint dvContainer::m_adaptiveContVarsCnt
private

Number of adaptive continuous variables in this container.

◆ m_adaptiveVarsCnt

uint dvContainer::m_adaptiveVarsCnt
private

Number of adaptive variables in this container.

◆ m_DVMap

dvMapType dvContainer::m_DVMap
private

Map from name to the decision variable.

◆ m_numBoolVars

uint dvContainer::m_numBoolVars
private

Number of boolean variables in this container.

◆ m_numContVars

uint dvContainer::m_numContVars
private

Number of continuous variables in this container.

◆ m_numIntVars

uint dvContainer::m_numIntVars
private

Number of integer variables in this container.

◆ m_timeStage

uint dvContainer::m_timeStage
private

Max time stage of variables in this container.