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

Variable to expression converter interface. More...

#include <VariableConverter.hpp>

Inheritance diagram for OneToExprVariableConverterIF:
Collaboration diagram for OneToExprVariableConverterIF:

Public Types

typedef map< string, ROCPPExpr_Ptr >::const_iterator const_iterator
 
- Public Types inherited from VariableConverterIF
typedef map< string, ROCPPVarIF_Ptr >::const_iterator const_iterator_inv
 Constant iterator into inverse map. More...
 

Public Member Functions

 OneToExprVariableConverterIF ()
 Constructor of OneToExprVariableConverterIF class. More...
 
 ~OneToExprVariableConverterIF ()
 Destructor of OneToExprVariableConverterIF class. More...
 
const_iterator find (string varName) const
 
const_iterator begin () const
 
const_iterator end () const
 
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)
 Map the original variable to an expression for all variables in the input model. More...
 
virtual void createTranslationMap (const dvContainer &tmpContainer, map< string, ROCPPExpr_Ptr > &translationMap, vector< ROCPPConstraintIF_Ptr > &toAdd)=0
 Create m_translationMap for the variables in the given container. More...
 
virtual void createInverseMap (const dvContainer &origDVContainer)
 Create the map m_inverseMap. More...
 
double evaluateVariableValue (string nme, const map< string, double > &binValuesMap) const
 Evaluate and return the value of the given variable after converting it. 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...
 
- Public Member Functions inherited from VariableConverterIF
 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 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, ROCPPExpr_Ptrm_translationMap
 Map from name of the original variable to the expression. More...
 
- Protected Attributes inherited from VariableConverterIF
map< string, ROCPPVarIF_Ptrm_inverseMap
 Map from the new variable name to old variable. More...
 

Detailed Description

Variable to expression converter interface.

Class for converting a variable to an expression

Member Typedef Documentation

◆ const_iterator

Constructor & Destructor Documentation

◆ OneToExprVariableConverterIF()

OneToExprVariableConverterIF::OneToExprVariableConverterIF ( )
inline

Constructor of OneToExprVariableConverterIF class.

◆ ~OneToExprVariableConverterIF()

OneToExprVariableConverterIF::~OneToExprVariableConverterIF ( )
inline

Destructor of OneToExprVariableConverterIF class.

Member Function Documentation

◆ begin()

const_iterator OneToExprVariableConverterIF::begin ( ) const
inline

◆ convertVar() [1/3]

ROCPPOptModelIF_Ptr VariableConverterIF::convertVar

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

◆ convertVar() [2/3]

void OneToExprVariableConverterIF::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 
)

Map the original variable to an expression for all variables in the input model.

◆ convertVar() [3/3]

virtual void VariableConverterIF::convertVar

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()

void OneToExprVariableConverterIF::createInverseMap ( const dvContainer origDVContainer)
virtual

Create the map m_inverseMap.

Implements VariableConverterIF.

◆ createTranslationMap()

virtual void OneToExprVariableConverterIF::createTranslationMap ( const dvContainer tmpContainer,
map< string, ROCPPExpr_Ptr > &  translationMap,
vector< ROCPPConstraintIF_Ptr > &  toAdd 
)
pure virtual

Create m_translationMap for the variables in the given container.

Parameters
tmpContainerContainer contains the variables to be approximated
translationMapMap from the name of the variable to the expression to which it will be mapped
toAddContains the upper and lower bounds of the original variables as constraints

Implemented in PredefO2EVariableConverter, RealVarDiscretizer, RealVarBilinearPosReformulator, BinaryConverter, UnaryConverter, and LinearDecisionRule.

◆ end()

const_iterator OneToExprVariableConverterIF::end ( ) const
inline

◆ evaluateVariableValue()

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

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

Implements VariableConverterIF.

◆ find()

const_iterator OneToExprVariableConverterIF::find ( string  varName) const
inline

Member Data Documentation

◆ m_translationMap

map<string, ROCPPExpr_Ptr> OneToExprVariableConverterIF::m_translationMap
protected

Map from name of the original variable to the expression.