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

Linear decision rule. More...

#include <DecisionRule.hpp>

Inheritance diagram for LinearDecisionRule:
Collaboration diagram for LinearDecisionRule:

Public Member Functions

 LinearDecisionRule (ROCPPuncContainer_Ptr UC, uint memory=1000, double bigM=100.)
 Constructor of the LinearDecisionRule class. More...
 
 LinearDecisionRule (uint memory=1000, double bigM=100.)
 Constructor of the LinearDecisionRule class. More...
 
 ~LinearDecisionRule ()
 Destructor of the LinearDecisionRule class. More...
 
ROCPPOptModelIF_Ptr convertVar (ROCPPOptModelIF_Ptr pIn, bool resetAndSave=false)
 Approximated the real-valued adaptive decisions in the given model by linear desicion rules First set the uncertainty container and then do the approximation. More...
 
ROCPPOptModelIF_Ptr approximate (ROCPPOptModelIF_Ptr pIn)
 
void createTranslationMap (const dvContainer &tmpContainer, map< string, ROCPPExpr_Ptr > &translationMap, vector< ROCPPConstraintIF_Ptr > &toAdd)
 Create the map from the original decision variable to decisions that are affine in the history of observations. More...
 
void setUncContainer (ROCPPuncContainer_Ptr UC)
 Set the uncertainty container of this class. More...
 
ROCPPVarIF_Ptr getCoeffDV (string dvName, string uncName) const
 Get the coefficient decision variable associated with the given uncertain parameter in the approximation for the given decision variable. More...
 
map< pair< string, string >, ROCPPVarIF_PtrgetLDRCoeff () const
 Return map m_mapOrigDVUncPairToCoeffDV. More...
 
multimap< string, pair< string, ROCPPVarIF_Ptr > > getLDRExpr () const
 Return map m_mapOrigDVToUncAndCoeffDV. More...
 
void printOut (const ROCPPOptModelIF_Ptr pIn, const map< string, double > &variableValue, ROCPPVarIF_Ptr dv)
 Print the solution (in the form of an expression) for the given variable. More...
 
void printOut (const ROCPPOptModelIF_Ptr pIn, const map< string, double > &resultIn, ROCPPUnc_Ptr unc)
 
ROCPPOptModelIF_Ptr Reformulate (ROCPPOptModelIF_Ptr pIn)
 
bool isApplicable (ROCPPOptModelIF_Ptr pIn) const
 
string getName () const
 
- Public Member Functions inherited from ContinuousVarsDRIF
 ContinuousVarsDRIF (uint memory=1000)
 Constructor of the continuous variable decision rule interface class. More...
 
virtual ~ContinuousVarsDRIF ()
 Destructor of the continuous variable decision rule interface class. More...
 
void findVarsToTranslate (vector< ROCPPConstraintIF_Ptr >::const_iterator first, vector< ROCPPConstraintIF_Ptr >::const_iterator last, ROCPPObjectiveIF_Ptr obj, dvContainer &container)
 Find all adaptive continuous variable in the given constraints and objective. More...
 
- Public Member Functions inherited from OneToExprVariableConverterIF
 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 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 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...
 
- Public Member Functions inherited from DecisionRuleIF
 DecisionRuleIF (uint memory=1000)
 Constructor of the DecisionRuleIF class. More...
 
virtual ~DecisionRuleIF ()
 Destructor of the DecisionRuleIF class. More...
 
uint getMemory () const
 
- Public Member Functions inherited from ReformulationStrategyIF
 ReformulationStrategyIF ()
 
 ~ReformulationStrategyIF ()
 

Private Attributes

ROCPPuncContainer_Ptr m_UC
 Uncertain parameter container of this approximator. More...
 
bool m_uncContSet
 
map< pair< string, string >, ROCPPVarIF_Ptrm_mapOrigDVUncPairToCoeffDV
 Map of pair of original variable name and uncertainty name to the coefficient variable. More...
 
multimap< string, pair< string, ROCPPVarIF_Ptr > > m_mapOrigDVToUncAndCoeffDV
 Map of original variable name to the pair of uncertainty name and the coefficient variable. More...
 
map< string, string > m_cst
 Map of original variable name to the name of decision variable representing the constant term in the linear decision rule. More...
 
double m_bigM
 Value of the big M constant. More...
 

Additional Inherited Members

- Public Types inherited from OneToExprVariableConverterIF
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...
 
- Protected Attributes inherited from OneToExprVariableConverterIF
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...
 
- Protected Attributes inherited from DecisionRuleIF
uint m_memory
 Memory of this approximator. More...
 

Detailed Description

Linear decision rule.

Class for approximating continuous variable by linear function of the uncertain parameters

Constructor & Destructor Documentation

◆ LinearDecisionRule() [1/2]

LinearDecisionRule::LinearDecisionRule ( ROCPPuncContainer_Ptr  UC,
uint  memory = 1000,
double  bigM = 100. 
)
inline

Constructor of the LinearDecisionRule class.

Parameters
UCContainer that contains all uncertainty being used to approximate the decision variable in this problem

◆ LinearDecisionRule() [2/2]

LinearDecisionRule::LinearDecisionRule ( uint  memory = 1000,
double  bigM = 100. 
)
inline

Constructor of the LinearDecisionRule class.

◆ ~LinearDecisionRule()

LinearDecisionRule::~LinearDecisionRule ( )
inline

Destructor of the LinearDecisionRule class.

Member Function Documentation

◆ approximate()

ROCPPOptModelIF_Ptr LinearDecisionRule::approximate ( ROCPPOptModelIF_Ptr  pIn)
virtual

Implements DecisionRuleIF.

◆ convertVar()

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

Approximated the real-valued adaptive decisions in the given model by linear desicion rules First set the uncertainty container and then do the approximation.

Parameters
pInModel to be approximated
resetAndSaveIndicates whether to reset the translation map in class OneToExprVariableConverterIF
See also
VariableConverterIF::convertVar(ROCPPOptModelIF_Ptr, bool)

Reimplemented from VariableConverterIF.

◆ createTranslationMap()

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

Create the map from the original decision variable to decisions that are affine in the history of observations.

Implements OneToExprVariableConverterIF.

◆ getCoeffDV()

ROCPPVarIF_Ptr LinearDecisionRule::getCoeffDV ( string  dvName,
string  uncName 
) const

Get the coefficient decision variable associated with the given uncertain parameter in the approximation for the given decision variable.

◆ getLDRCoeff()

map<pair<string,string>, ROCPPVarIF_Ptr> LinearDecisionRule::getLDRCoeff ( ) const
inline

Return map m_mapOrigDVUncPairToCoeffDV.

◆ getLDRExpr()

multimap<string, pair<string, ROCPPVarIF_Ptr> > LinearDecisionRule::getLDRExpr ( ) const
inline

Return map m_mapOrigDVToUncAndCoeffDV.

◆ getName()

string LinearDecisionRule::getName ( ) const
inlinevirtual

◆ isApplicable()

bool LinearDecisionRule::isApplicable ( ROCPPOptModelIF_Ptr  pIn) const
virtual

◆ printOut() [1/2]

void LinearDecisionRule::printOut ( const ROCPPOptModelIF_Ptr  pIn,
const map< string, double > &  resultIn,
ROCPPUnc_Ptr  unc 
)

◆ printOut() [2/2]

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

Print the solution (in the form of an expression) for the given variable.

Reimplemented from VariableConverterIF.

◆ Reformulate()

ROCPPOptModelIF_Ptr LinearDecisionRule::Reformulate ( ROCPPOptModelIF_Ptr  pIn)
inlinevirtual

◆ setUncContainer()

void LinearDecisionRule::setUncContainer ( ROCPPuncContainer_Ptr  UC)
inline

Set the uncertainty container of this class.

Member Data Documentation

◆ m_bigM

double LinearDecisionRule::m_bigM
private

Value of the big M constant.

◆ m_cst

map<string, string> LinearDecisionRule::m_cst
private

Map of original variable name to the name of decision variable representing the constant term in the linear decision rule.

◆ m_mapOrigDVToUncAndCoeffDV

multimap<string, pair<string, ROCPPVarIF_Ptr> > LinearDecisionRule::m_mapOrigDVToUncAndCoeffDV
private

Map of original variable name to the pair of uncertainty name and the coefficient variable.

◆ m_mapOrigDVUncPairToCoeffDV

map<pair<string,string>, ROCPPVarIF_Ptr> LinearDecisionRule::m_mapOrigDVUncPairToCoeffDV
private

Map of pair of original variable name and uncertainty name to the coefficient variable.

◆ m_UC

ROCPPuncContainer_Ptr LinearDecisionRule::m_UC
private

Uncertain parameter container of this approximator.

◆ m_uncContSet

bool LinearDecisionRule::m_uncContSet
private