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

Variable converter interface class Use to map variables to other variables or to expressions. More...

#include <VariableConverter.hpp>

Inheritance diagram for VariableConverterIF:

Public Types

typedef map< string, ROCPPVarIF_Ptr >::const_iterator const_iterator_inv
 Constant iterator into inverse map. More...
 

Public Member Functions

 VariableConverterIF ()
 Constructor of VariableConverterIF class. More...
 
 ~VariableConverterIF ()
 Destructor of VariableConverterIF class. More...
 
const_iterator_inv findInv (string varName) const
 Return a constant iterator pointing to the pair of the given variable and the old variable associated with it. More...
 
const_iterator_inv beginInv () const
 Return a constant iterator pointing to the beginning of the inverse map (m_inverseMap) More...
 
const_iterator_inv endInv () const
 Return a constant iterator pointing to the end of the inverse map (m_inverseMap) More...
 
virtual ROCPPOptModelIF_Ptr convertVar (ROCPPOptModelIF_Ptr pIn, bool resetAndSave=false)
 Get the objective and constraints in the input model and then convert the variables. More...
 
virtual void convertVar (vector< ROCPPConstraintIF_Ptr >::const_iterator first, vector< ROCPPConstraintIF_Ptr >::const_iterator last, ROCPPObjectiveIF_Ptr obj, const dvContainer &origDVContainer, vector< ROCPPConstraintIF_Ptr > &toAdd, ROCPPObjectiveIF_Ptr &toSet, bool resetAndSave=false)=0
 Approximate each variable in the given objective and contraints. More...
 
virtual void findVarsToTranslate (vector< ROCPPConstraintIF_Ptr >::const_iterator first, vector< ROCPPConstraintIF_Ptr >::const_iterator last, ROCPPObjectiveIF_Ptr obj, dvContainer &container)=0
 Find the variable in the given ocnstraints and objective to be mapped and store them in the container. More...
 
virtual void createInverseMap (const dvContainer &origDVContainer)=0
 Create the map m_inverseMap. More...
 
virtual double evaluateVariableValue (string nme, const map< string, double > &binValuesMap) const =0
 Evaluate and return the value of the given variable after converting it. More...
 
virtual void printOut (const ROCPPOptModelIF_Ptr pIn, const map< string, double > &variableValue, ROCPPVarIF_Ptr dv)
 Print the solution of the given decision variable. More...
 

Protected Attributes

map< string, ROCPPVarIF_Ptrm_inverseMap
 Map from the new variable name to old variable. More...
 

Detailed Description

Variable converter interface class Use to map variables to other variables or to expressions.

Member Typedef Documentation

◆ const_iterator_inv

typedef map<string, ROCPPVarIF_Ptr>::const_iterator VariableConverterIF::const_iterator_inv

Constant iterator into inverse map.

Constructor & Destructor Documentation

◆ VariableConverterIF()

VariableConverterIF::VariableConverterIF ( )
inline

Constructor of VariableConverterIF class.

◆ ~VariableConverterIF()

VariableConverterIF::~VariableConverterIF ( )
inline

Destructor of VariableConverterIF class.

Member Function Documentation

◆ beginInv()

const_iterator_inv VariableConverterIF::beginInv ( ) const
inline

Return a constant iterator pointing to the beginning of the inverse map (m_inverseMap)

◆ convertVar() [1/2]

ROCPPOptModelIF_Ptr VariableConverterIF::convertVar ( ROCPPOptModelIF_Ptr  pIn,
bool  resetAndSave = false 
)
virtual

Get the objective and constraints in the input model and then convert the variables.

Parameters
pInModel to be approximated
resetAndSaveWhether to set the translation map in class OneToExprVariableConverterIF

Reimplemented in LinearDecisionRule.

◆ convertVar() [2/2]

virtual void VariableConverterIF::convertVar ( vector< ROCPPConstraintIF_Ptr >::const_iterator  first,
vector< ROCPPConstraintIF_Ptr >::const_iterator  last,
ROCPPObjectiveIF_Ptr  obj,
const dvContainer origDVContainer,
vector< ROCPPConstraintIF_Ptr > &  toAdd,
ROCPPObjectiveIF_Ptr toSet,
bool  resetAndSave = false 
)
pure virtual

Approximate each variable in the given objective and contraints.

Parameters
firstConstant iterator pointing to the beginning of the vector of constraints to be mapped
lastConstant iterator pointing to the end of the vector of constraints to be mapped
objObjective to be mapped
origDVContainerContainer of decision variables to be approximated
toAddConstraints after mapping
toSetObjective after mapping

◆ createInverseMap()

virtual void VariableConverterIF::createInverseMap ( const dvContainer origDVContainer)
pure virtual

Create the map m_inverseMap.

Implemented in OneToExprVariableConverterIF, and OneToOneVariableConverterIF.

◆ endInv()

const_iterator_inv VariableConverterIF::endInv ( ) const
inline

Return a constant iterator pointing to the end of the inverse map (m_inverseMap)

◆ evaluateVariableValue()

virtual double VariableConverterIF::evaluateVariableValue ( string  nme,
const map< string, double > &  binValuesMap 
) const
pure virtual

Evaluate and return the value of the given variable after converting it.

Implemented in OneToExprVariableConverterIF, and OneToOneVariableConverterIF.

◆ findInv()

const_iterator_inv VariableConverterIF::findInv ( string  varName) const
inline

Return a constant iterator pointing to the pair of the given variable and the old variable associated with it.

◆ findVarsToTranslate()

virtual void VariableConverterIF::findVarsToTranslate ( vector< ROCPPConstraintIF_Ptr >::const_iterator  first,
vector< ROCPPConstraintIF_Ptr >::const_iterator  last,
ROCPPObjectiveIF_Ptr  obj,
dvContainer container 
)
pure virtual

Find the variable in the given ocnstraints and objective to be mapped and store them in the container.

◆ printOut()

virtual void VariableConverterIF::printOut ( const ROCPPOptModelIF_Ptr  pIn,
const map< string, double > &  variableValue,
ROCPPVarIF_Ptr  dv 
)
inlinevirtual

Print the solution of the given decision variable.

Reimplemented in ConstantDecisionRule, and LinearDecisionRule.

Member Data Documentation

◆ m_inverseMap

map<string, ROCPPVarIF_Ptr> VariableConverterIF::m_inverseMap
protected

Map from the new variable name to old variable.