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

Optimization model interface class. More...

#include <OptimizationModel.hpp>

Inheritance diagram for OptimizationModelIF:

Public Types

typedef vector< ROCPPConstraintIF_Ptr >::const_iterator constraintIterator
 Constant iterator for optimization model constraints. More...
 
typedef dvMapType::const_iterator varsIterator
 Constant iterator for optimization model decision variable map. More...
 
typedef map< string, ROCPPUnc_Ptr >::const_iterator uncertaintiesIterator
 Constant iterator for optimization model uncertain parameter map. More...
 

Public Member Functions

 OptimizationModelIF (uint numTimeStages=1)
 Constructor of OptimizationModelIF. More...
 
virtual ~OptimizationModelIF ()
 Destructor of OptimizationModelIF. More...
 
constraintIterator constraintBegin () const
 Return a constant iterator pointing to the beginning of the constraint vector. More...
 
constraintIterator constraintEnd () const
 Return a constant iterator pointing to the end of the constraint vector. More...
 
varsIterator varsBegin () const
 Return a constant iterator pointing to the beginning of the decision variable map (m_pDVContainer) More...
 
varsIterator varsEnd () const
 Return a constant iterator pointing to the end of the decision variable map (m_pDVContainer) More...
 
virtual uncertaintiesIterator uncertaintiesBegin () const
 Return a constant iterator pointing to the beginning of the uncertain parameter map (m_pUncContainer) More...
 
virtual uncertaintiesIterator uncertaintiesEnd () const
 Return a constant iterator pointing to the end of the uncertain parameter map (m_pUncContainer) More...
 
map< string, vector< ROCPPConstraintIF_Ptr > >::const_iterator blockMapBegin () const
 Return a constant iterator pointing to the begining of the block map. More...
 
map< string, vector< ROCPPConstraintIF_Ptr > >::const_iterator blockMapEnd () const
 Return a constant iterator pointing to the end of the block map. More...
 
virtual void checkCompatibility (ROCPPConstraintIF_Ptr pConstraint) const
 Check compatibility for the given constraint of this optimization model. More...
 
virtual void checkCompatibility (ROCPPVarIF_Ptr pVariable) const
 Check compatibility for the given decision variable of this optimization model. More...
 
virtual void checkCompatibility (ROCPPObjectiveIF_Ptr pObjFun) const
 Check compatibility for the given objective function of this optimization model. More...
 
void add_constraint (ROCPPConstraintIF_Ptr pConstraint, string blockNme="main")
 Add a constraint into the optimization model after setting the constraint attributes. More...
 
void add_soc_constraint (ROCPPVarIF_Ptr coneHead, const vector< ROCPPVarIF_Ptr > &otherVars, string blockNme="main")
 Add a soc constraint into the optimization model. More...
 
void add_constraints (vector< ROCPPConstraintIF_Ptr >::const_iterator first, vector< ROCPPConstraintIF_Ptr >::const_iterator last, string blockNme="main")
 Add constraints into the optimization model. More...
 
void add_constraint_uncset (ROCPPConstraintIF_Ptr pUncCstr, string blockNme="main")
 Add a constraint defining the uncertainty set into the model. More...
 
void add_epigraph ()
 Add an epipragh variable as the objective function and an epigraph constraint into this model. More...
 
virtual void add_ddu (ROCPPUnc_Ptr pUncertainty, uint firstTimeStageObservable, uint lastTimeStageObservable, const map< uint, double > &obsCosts)
 
virtual void set_objective (ROCPPObjectiveIF_Ptr pObj)
 Set the given objective as the objective function of the model. More...
 
void set_objective (ROCPPExpr_Ptr objFun)
 Create an objective function using the given expression and add it to the optimization model. More...
 
void set_objective (vector< ROCPPExpr_Ptr > objFuns)
 Create an objective function using the given expressions and add it to the optimization model. More...
 
ROCPPOptModelIF_Ptr replaceTermWithVar (const multimap< string, ROCPPVarIF_Ptr > &term, ROCPPVarIF_Ptr var) const
 Replace the given term in this model with the given decision variable. More...
 
virtual void set_ddu (ROCPPOptModelIF_Ptr pIn)
 Copy the information in the given model and set it to this one, make sure the information of ddu is kept after clone or reformulation. More...
 
virtual void set_ddu (const map< pair< string, uint >, measPair > &dduToMeasMap, const map< string, pair< uint, uint > > &dduStagesObs)
 Copy the information in the given maps and set it to this one, make sure the information of ddu is kept after clone or reformulation. More...
 
virtual void set_objType (uncOptModelObjType pType)
 
map< string, ROCPPVarIF_PtrcreateVarMap (ROCPPConstraintIF_Ptr pConstraint)
 Create the variable map for the given constraint Iterate through all variables in the given constraint. More...
 
map< string, ROCPPVarIF_PtrcreateVarMap (ROCPPObjectiveIF_Ptr objFun)
 Create the variable map for the given objective function Iterate through all variables in the given objective function. More...
 
virtual map< string, ROCPPUnc_PtrcreateUncMap (ROCPPConstraintIF_Ptr pConstraint)
 
virtual map< string, ROCPPUnc_PtrcreateUncMap (ROCPPObjectiveIF_Ptr objFun)
 
virtual void pair_uncertainties (ROCPPUnc_Ptr u1, ROCPPUnc_Ptr u2)
 
virtual void getExpectation ()
 Convert the objective function to its expectation. More...
 
virtual size_t getNumUncertainties () const
 
virtual bool isDDU (string uncName) const
 Return true if and only if the given uncertainty has a time of revelation that is decision-dependent. More...
 
virtual bool isObservable (string uncName) const
 Return true if and only if the given uncertainty is observable. More...
 
bool isAdaptive (string varName) const
 Return true if and only if the variable with the given name is adaptive. More...
 
bool isInStandardForm () const
 Return true if and only if this model does not include a norm term. More...
 
virtual bool isUncertainOptimizationModel () const
 Return true if and only if this model is uncertain. More...
 
virtual bool isMultiStageOptModelDDID () const
 Return true if and only if this model is a ddu model. More...
 
bool varIsDefined (string varName) const
 Return true if and only if the decision variable exists in this model. More...
 
bool VarInObj (string varName, uint i=1) const
 Return true if and only if the decision variable exists in the i th objective function of the max term. More...
 
virtual problemType getType () const =0
 Return the problem type. More...
 
virtual ROCPPVarIF_Ptr getMeasVar (string dduncName, uint timeStage) const
 Return the measurement variable for the given uncertainty and the time stage. More...
 
ROCPPVarIF_Ptr getVar (string varName) const
 Return the variable called varName. More...
 
virtual ROCPPUnc_Ptr getUnc (string uncName) const
 Return the uncertain parameter called uncName. More...
 
uint getNumTimesTermAppears (const multimap< string, ROCPPVarIF_Ptr > &term) const
 Return the number of times the given term in the map appears in this model. More...
 
void getAllProductsOf2Variables (map< pair< string, string >, uint > &freqMap, map< pair< string, string >, multimap< string, ROCPPVarIF_Ptr > > &termMap) const
 Return all products of two variables in this model. More...
 
ROCPPObjectiveIF_Ptr getObj () const
 Return a pointer pointing to the objective function of this problem. More...
 
virtual map< pair< string, uint >, measPairgetDDUToMeasMap () const
 Return a map from decision dependent uncertain parameters to associated measurement variables. More...
 
virtual map< string, pair< uint, uint > > getdduStagesObs () const
 Return a map from decision dependent uncertain parameters to the stages when the parameter can be observed. More...
 
virtual uint getFirstStageObservable (string uncName) const
 Return the first time stage when uncertainty called uncName can be observed. More...
 
virtual uint getLastStageObservable (string uncName) const
 Return the last time stage when uncertainty called uncName can be observed. More...
 
ROCPPconstdvContainer_Ptr getDVContainer () const
 Return the decision variable container (m_dvContainer) of this object. More...
 
virtual ROCPPuncContainer_Ptr getUncContainer () const
 Return the uncertainty container (m_uncContainer) of this object. More...
 
virtual uncOptModelObjType getObjType () const
 Return the objective type. More...
 
size_t getNumConstraints () const
 Return the number of constraints in the model. More...
 
uint getNumTimeStages () const
 Return the time stage of the model. More...
 
uint getNumContVars () const
 Return the number of real-valued decision variables in this term. More...
 
uint getNumIntVars () const
 Return the number of integer decision variables in this term. More...
 
uint getNumBoolVars () const
 Return the number of boolen decision variables in this term. More...
 
uint getNumAdaptiveContVars () const
 Return the number of adaptive real-valued decision variables in this term. More...
 
uint getNumAdaptiveVars () const
 Return the number of adaptive decision variables in this term. More...
 
size_t getNumVars () const
 Return the number of decision variables in this term. More...
 
bool hasNonlinearities () const
 Return true if and only if there is a product between two decision variables in this optimization model. More...
 
virtual bool hasRectangularUncertaintySet () const
 Return true if the problem has rectangular uncertainty set. More...
 
virtual bool hasRealVarsInUncertaintySet () const
 
virtual bool hasDecisionDependentUncertaintySet () const
 
virtual ROCPPOptModelIF_Ptr Clone () const
 Clone this problem. More...
 
virtual void WriteToFile (string folderName, string fileName) const
 

Protected Member Functions

virtual void add_var (ROCPPVarIF_Ptr pVariable)
 Add the given variable into the dvContainer of this model. More...
 
virtual void add_vars (ROCPPconstdvContainer_Ptr pDVcontainer)
 Add the variable in the given container into the dvContainer of this model. More...
 
void add_ddu_obj (ROCPPVarIF_Ptr pVar, double cost)
 Add the information discovery cost to the objective model. More...
 
void push_constraint (ROCPPConstraintIF_Ptr pConstraint)
 Push the constraint back into the vector of constraints of this model. More...
 
ptrdiff_t getConstraintIdx (constraintIterator pConstraintIt) const
 Get index of the given constraint in the m_mapCstrIdxToUncertaintySet map. More...
 

Protected Attributes

uint m_numTimeStages
 Length of planning horizon of this model. More...
 
vector< ROCPPConstraintIF_Ptrm_uncertaintySet
 Vector collecting the uncertainty set constraints of this model. More...
 
ROCPPuncContainer_Ptr m_pUncContainer
 Uncertain parameter container of this model. More...
 
ROCPPuncContainer_Ptr m_dduContainer
 Container of decision dependent uncertain parameters in this model. More...
 
ROCPPuncContainer_Ptr m_nondduContainer
 Container of non decision dependent uncertain parameters in this model. More...
 
map< string, measPairm_measVars
 Map from measurement varaibles to measurement pairs. More...
 
map< pair< string, uint >, measPairm_dduToMeasMap
 Map from pair of uncertain parameter name and time stage to measurement pair. More...
 
map< string, pair< uint, uint > > m_dduStagesObs
 Map from name of the uncertain parameter to the first and last times when it can be observed. More...
 
map< string, vector< ROCPPConstraintIF_Ptr > > m_mapBlockConstraints
 Map from block name to vector of problem constraint indices. More...
 

Private Attributes

ROCPPdvContainer_Ptr m_pDVContainer
 Decision variable container of this model. More...
 
vector< ROCPPConstraintIF_Ptrm_constraints
 Vector of constraints in this model. More...
 
ROCPPObjectiveIF_Ptr m_pObj
 Objective function of this model. More...
 

Detailed Description

Optimization model interface class.

Member Typedef Documentation

◆ constraintIterator

Constant iterator for optimization model constraints.

◆ uncertaintiesIterator

typedef map<string, ROCPPUnc_Ptr>::const_iterator OptimizationModelIF::uncertaintiesIterator

Constant iterator for optimization model uncertain parameter map.

◆ varsIterator

typedef dvMapType::const_iterator OptimizationModelIF::varsIterator

Constant iterator for optimization model decision variable map.

Constructor & Destructor Documentation

◆ OptimizationModelIF()

OptimizationModelIF::OptimizationModelIF ( uint  numTimeStages = 1)

Constructor of OptimizationModelIF.

Parameters
numTimeStagesPlanning horizon of this model: maximum time when any decision is made or any uncertain parameter is revealed

◆ ~OptimizationModelIF()

virtual OptimizationModelIF::~OptimizationModelIF ( )
inlinevirtual

Destructor of OptimizationModelIF.

Member Function Documentation

◆ add_constraint()

void OptimizationModelIF::add_constraint ( ROCPPConstraintIF_Ptr  pConstraint,
string  blockNme = "main" 
)

Add a constraint into the optimization model after setting the constraint attributes.

Note
We first map all the variables and uncertainties to make sure they are not used in any other model and then add the new constraint to the model
See also
ConstraintIF::mapVars(const map<string,ROCPPVarIF_Ptr>), ConstraintIF::mapUnc(), OptimizationModelIF::createVarMap(ROCPPConstraintIF_Ptr), OptimizationModelIF::createUncMap(ROCPPConstraintIF_Ptr), OptimizationModelIF::push_constraint() blockNme allows to add a constraint

◆ add_constraint_uncset()

void OptimizationModelIF::add_constraint_uncset ( ROCPPConstraintIF_Ptr  pUncCstr,
string  blockNme = "main" 
)

Add a constraint defining the uncertainty set into the model.

◆ add_constraints()

void OptimizationModelIF::add_constraints ( vector< ROCPPConstraintIF_Ptr >::const_iterator  first,
vector< ROCPPConstraintIF_Ptr >::const_iterator  last,
string  blockNme = "main" 
)

Add constraints into the optimization model.

◆ add_ddu()

void OptimizationModelIF::add_ddu ( ROCPPUnc_Ptr  pUncertainty,
uint  firstTimeStageObservable,
uint  lastTimeStageObservable,
const map< uint, double > &  obsCosts 
)
virtual

Reimplemented in MultiStageOptModelDDID.

◆ add_ddu_obj()

void OptimizationModelIF::add_ddu_obj ( ROCPPVarIF_Ptr  pVar,
double  cost 
)
protected

Add the information discovery cost to the objective model.

Note
Used in DDUOptimizationModel

◆ add_epigraph()

void OptimizationModelIF::add_epigraph ( )

Add an epipragh variable as the objective function and an epigraph constraint into this model.

◆ add_soc_constraint()

void OptimizationModelIF::add_soc_constraint ( ROCPPVarIF_Ptr  coneHead,
const vector< ROCPPVarIF_Ptr > &  otherVars,
string  blockNme = "main" 
)

Add a soc constraint into the optimization model.

Parameters
coneHeadCone head decision variable
otherVarsOther variables

◆ add_var()

void OptimizationModelIF::add_var ( ROCPPVarIF_Ptr  pVariable)
protectedvirtual

Add the given variable into the dvContainer of this model.

◆ add_vars()

void OptimizationModelIF::add_vars ( ROCPPconstdvContainer_Ptr  pDVcontainer)
protectedvirtual

Add the variable in the given container into the dvContainer of this model.

◆ blockMapBegin()

map<string, vector<ROCPPConstraintIF_Ptr> >::const_iterator OptimizationModelIF::blockMapBegin ( ) const
inline

Return a constant iterator pointing to the begining of the block map.

◆ blockMapEnd()

map<string, vector<ROCPPConstraintIF_Ptr> >::const_iterator OptimizationModelIF::blockMapEnd ( ) const
inline

Return a constant iterator pointing to the end of the block map.

◆ checkCompatibility() [1/3]

void OptimizationModelIF::checkCompatibility ( ROCPPConstraintIF_Ptr  pConstraint) const
virtual

Check compatibility for the given constraint of this optimization model.

Reimplemented in CPLEXMISOCP, Bilinear_MISOCP, MISOCP, UncertainOptimizationModel, and DeterministicOptimizationModel.

◆ checkCompatibility() [2/3]

void OptimizationModelIF::checkCompatibility ( ROCPPObjectiveIF_Ptr  pObjFun) const
virtual

Check compatibility for the given objective function of this optimization model.

Warning
Cannot add objective function which contains products of continuous variables or products of uncertianties or has a larger time stage that the planning horizon into the optimization model

Reimplemented in CPLEXMISOCP, Bilinear_MISOCP, MISOCP, UncertainOptimizationModel, and DeterministicOptimizationModel.

◆ checkCompatibility() [3/3]

void OptimizationModelIF::checkCompatibility ( ROCPPVarIF_Ptr  pVariable) const
virtual

Check compatibility for the given decision variable of this optimization model.

Reimplemented in CPLEXMISOCP, Bilinear_MISOCP, MISOCP, UncertainSingleStageOptimizationModel, and DeterministicOptimizationModel.

◆ Clone()

ROCPPOptModelIF_Ptr OptimizationModelIF::Clone ( ) const
virtual

Clone this problem.

Reimplemented in MultiStageOptModelDDID.

◆ constraintBegin()

constraintIterator OptimizationModelIF::constraintBegin ( ) const
inline

Return a constant iterator pointing to the beginning of the constraint vector.

◆ constraintEnd()

constraintIterator OptimizationModelIF::constraintEnd ( ) const
inline

Return a constant iterator pointing to the end of the constraint vector.

◆ createUncMap() [1/2]

map< string, ROCPPUnc_Ptr > OptimizationModelIF::createUncMap ( ROCPPConstraintIF_Ptr  pConstraint)
virtual
Note
Only valid in uncertain model

Reimplemented in UncertainOptimizationModel.

◆ createUncMap() [2/2]

map< string, ROCPPUnc_Ptr > OptimizationModelIF::createUncMap ( ROCPPObjectiveIF_Ptr  objFun)
virtual
Note
Only valid in uncertain model

Reimplemented in UncertainOptimizationModel.

◆ createVarMap() [1/2]

map< string, ROCPPVarIF_Ptr > OptimizationModelIF::createVarMap ( ROCPPConstraintIF_Ptr  pConstraint)

Create the variable map for the given constraint Iterate through all variables in the given constraint.

If a variable with the same name exists in the model, use the old one. If a variables with the same name does not exist, create a new variable and add it into the model.

Returns
A map from the variable name to the variable
See also
OptimizationModelIF::varIsDefined(), OptimizationModelIF::add_var()

◆ createVarMap() [2/2]

map< string, ROCPPVarIF_Ptr > OptimizationModelIF::createVarMap ( ROCPPObjectiveIF_Ptr  objFun)

Create the variable map for the given objective function Iterate through all variables in the given objective function.

If a variable with the same name exists in the model, use the old one. If a variables with the same name does not exist, create a new variable and add it into the model.

Returns
A map from the variable name to the variable
See also
OptimizationModelIF::varIsDefined(), OptimizationModelIF::add_var()

◆ getAllProductsOf2Variables()

void OptimizationModelIF::getAllProductsOf2Variables ( map< pair< string, string >, uint > &  freqMap,
map< pair< string, string >, multimap< string, ROCPPVarIF_Ptr > > &  termMap 
) const

Return all products of two variables in this model.

Note
There are no nonlinearities in the objective function
See also
ConstraintIF::getAllProductsOf2Variables()

◆ getConstraintIdx()

ptrdiff_t OptimizationModelIF::getConstraintIdx ( constraintIterator  pConstraintIt) const
protected

Get index of the given constraint in the m_mapCstrIdxToUncertaintySet map.

◆ getdduStagesObs()

map< string, pair< uint, uint > > OptimizationModelIF::getdduStagesObs ( ) const
virtual

Return a map from decision dependent uncertain parameters to the stages when the parameter can be observed.

Returns
the first element of the map is the uncertainty name; the second element is a pair with the first and the last stages when the parameter is observable. If there is no such parameter, return an empty map.

Reimplemented in MultiStageOptModelDDID.

◆ getDDUToMeasMap()

map< pair< string, uint >, measPair > OptimizationModelIF::getDDUToMeasMap ( ) const
virtual

Return a map from decision dependent uncertain parameters to associated measurement variables.

Returns
the first element of the map is a pair of uncertainty name and time stage; the second element is the measurement structure corresponding to this pair. If there is no such parameter, return an empty map.

Reimplemented in MultiStageOptModelDDID.

◆ getDVContainer()

ROCPPconstdvContainer_Ptr OptimizationModelIF::getDVContainer ( ) const
inline

Return the decision variable container (m_dvContainer) of this object.

◆ getExpectation()

void OptimizationModelIF::getExpectation ( )
virtual

Convert the objective function to its expectation.

Reimplemented in UncertainOptimizationModel.

◆ getFirstStageObservable()

uint OptimizationModelIF::getFirstStageObservable ( string  uncName) const
virtual

Return the first time stage when uncertainty called uncName can be observed.

Note
Not valid in deterministic model

Reimplemented in MultiStageOptModelDDID, and UncertainOptimizationModel.

◆ getLastStageObservable()

uint OptimizationModelIF::getLastStageObservable ( string  uncName) const
virtual

Return the last time stage when uncertainty called uncName can be observed.

Note
Not valid in deterministic model

Reimplemented in MultiStageOptModelDDID, and UncertainOptimizationModel.

◆ getMeasVar()

ROCPPVarIF_Ptr OptimizationModelIF::getMeasVar ( string  dduncName,
uint  timeStage 
) const
virtual

Return the measurement variable for the given uncertainty and the time stage.

Reimplemented in MultiStageOptModelDDID.

◆ getNumAdaptiveContVars()

uint OptimizationModelIF::getNumAdaptiveContVars ( ) const

Return the number of adaptive real-valued decision variables in this term.

◆ getNumAdaptiveVars()

uint OptimizationModelIF::getNumAdaptiveVars ( ) const

Return the number of adaptive decision variables in this term.

◆ getNumBoolVars()

uint OptimizationModelIF::getNumBoolVars ( ) const

Return the number of boolen decision variables in this term.

◆ getNumConstraints()

size_t OptimizationModelIF::getNumConstraints ( ) const
inline

Return the number of constraints in the model.

◆ getNumContVars()

uint OptimizationModelIF::getNumContVars ( ) const

Return the number of real-valued decision variables in this term.

◆ getNumIntVars()

uint OptimizationModelIF::getNumIntVars ( ) const

Return the number of integer decision variables in this term.

◆ getNumTimeStages()

uint OptimizationModelIF::getNumTimeStages ( ) const
inline

Return the time stage of the model.

◆ getNumTimesTermAppears()

uint OptimizationModelIF::getNumTimesTermAppears ( const multimap< string, ROCPPVarIF_Ptr > &  term) const

Return the number of times the given term in the map appears in this model.

See also
ObjectiveFunctionIF::getNumTimesTermAppears(), ConstraintIF::getNumTimesTermAppears()

◆ getNumUncertainties()

size_t OptimizationModelIF::getNumUncertainties ( ) const
virtual

Reimplemented in UncertainOptimizationModel.

◆ getNumVars()

size_t OptimizationModelIF::getNumVars ( ) const

Return the number of decision variables in this term.

◆ getObj()

ROCPPObjectiveIF_Ptr OptimizationModelIF::getObj ( ) const
inline

Return a pointer pointing to the objective function of this problem.

◆ getObjType()

uncOptModelObjType OptimizationModelIF::getObjType ( ) const
virtual

Return the objective type.

Reimplemented in UncertainOptimizationModel.

◆ getType()

◆ getUnc()

ROCPPUnc_Ptr OptimizationModelIF::getUnc ( string  uncName) const
virtual

Return the uncertain parameter called uncName.

Reimplemented in UncertainOptimizationModel.

◆ getUncContainer()

ROCPPuncContainer_Ptr OptimizationModelIF::getUncContainer ( ) const
virtual

Return the uncertainty container (m_uncContainer) of this object.

Warning
Not valid in deterministic model

Reimplemented in UncertainOptimizationModel.

◆ getVar()

ROCPPVarIF_Ptr OptimizationModelIF::getVar ( string  varName) const

Return the variable called varName.

◆ hasDecisionDependentUncertaintySet()

virtual bool OptimizationModelIF::hasDecisionDependentUncertaintySet ( ) const
inlinevirtual

Reimplemented in UncertainOptimizationModel.

◆ hasNonlinearities()

bool OptimizationModelIF::hasNonlinearities ( ) const

Return true if and only if there is a product between two decision variables in this optimization model.

◆ hasRealVarsInUncertaintySet()

virtual bool OptimizationModelIF::hasRealVarsInUncertaintySet ( ) const
inlinevirtual

Reimplemented in UncertainOptimizationModel.

◆ hasRectangularUncertaintySet()

bool OptimizationModelIF::hasRectangularUncertaintySet ( ) const
virtual

Return true if the problem has rectangular uncertainty set.

Reimplemented in UncertainOptimizationModel.

◆ isAdaptive()

bool OptimizationModelIF::isAdaptive ( string  varName) const

Return true if and only if the variable with the given name is adaptive.

See also
OpimizationModelIF::getVar(), DecisionVariableIf::isAdaptive()

◆ isDDU()

virtual bool OptimizationModelIF::isDDU ( string  uncName) const
inlinevirtual

Return true if and only if the given uncertainty has a time of revelation that is decision-dependent.

Reimplemented in MultiStageOptModelDDID.

◆ isInStandardForm()

bool OptimizationModelIF::isInStandardForm ( ) const

Return true if and only if this model does not include a norm term.

◆ isMultiStageOptModelDDID()

virtual bool OptimizationModelIF::isMultiStageOptModelDDID ( ) const
inlinevirtual

Return true if and only if this model is a ddu model.

Reimplemented in MultiStageOptModelDDID.

◆ isObservable()

bool OptimizationModelIF::isObservable ( string  uncName) const
virtual

Return true if and only if the given uncertainty is observable.

Reimplemented in UncertainOptimizationModel.

◆ isUncertainOptimizationModel()

virtual bool OptimizationModelIF::isUncertainOptimizationModel ( ) const
inlinevirtual

Return true if and only if this model is uncertain.

Reimplemented in UncertainOptimizationModel.

◆ pair_uncertainties()

void OptimizationModelIF::pair_uncertainties ( ROCPPUnc_Ptr  u1,
ROCPPUnc_Ptr  u2 
)
virtual

Reimplemented in MultiStageOptModelDDID.

◆ push_constraint()

void OptimizationModelIF::push_constraint ( ROCPPConstraintIF_Ptr  pConstraint)
protected

Push the constraint back into the vector of constraints of this model.

◆ replaceTermWithVar()

ROCPPOptModelIF_Ptr OptimizationModelIF::replaceTermWithVar ( const multimap< string, ROCPPVarIF_Ptr > &  term,
ROCPPVarIF_Ptr  var 
) const

Replace the given term in this model with the given decision variable.

See also
ObjectiveFunctionIF::replaceTermWithVar(), ConstraintIF::replaceTermWithVar()

◆ set_ddu() [1/2]

void OptimizationModelIF::set_ddu ( const map< pair< string, uint >, measPair > &  dduToMeasMap,
const map< string, pair< uint, uint > > &  dduStagesObs 
)
virtual

Copy the information in the given maps and set it to this one, make sure the information of ddu is kept after clone or reformulation.

Reimplemented in MultiStageOptModelDDID.

◆ set_ddu() [2/2]

void OptimizationModelIF::set_ddu ( ROCPPOptModelIF_Ptr  pIn)
virtual

Copy the information in the given model and set it to this one, make sure the information of ddu is kept after clone or reformulation.

Reimplemented in MultiStageOptModelDDID.

◆ set_objective() [1/3]

void OptimizationModelIF::set_objective ( ROCPPExpr_Ptr  objFun)

Create an objective function using the given expression and add it to the optimization model.

See also
Optimization::set_objective(ROCPPObjectiveIF_Ptr)

◆ set_objective() [2/3]

void OptimizationModelIF::set_objective ( ROCPPObjectiveIF_Ptr  pObj)
virtual

Set the given objective as the objective function of the model.

Note
We first map all the variables and uncertainties to make sure they are not used in any other model and then set the new objective
See also
ConstraintIF::mapVars(const map<string,ROCPPVarIF_Ptr>), ConstraintIF::mapUnc(), OptimizationModelIF::createVarMap(ROCPPConstraintIF_Ptr), OptimizationModelIF::createUncMap(ROCPPConstraintIF_Ptr)

Reimplemented in MultiStageOptModelDDID.

◆ set_objective() [3/3]

void OptimizationModelIF::set_objective ( vector< ROCPPExpr_Ptr objFuns)

Create an objective function using the given expressions and add it to the optimization model.

See also
Optimization::set_objective(ROCPPObjectiveIF_Ptr)

◆ set_objType()

void OptimizationModelIF::set_objType ( uncOptModelObjType  pType)
virtual

Reimplemented in UncertainOptimizationModel.

◆ uncertaintiesBegin()

OptimizationModelIF::uncertaintiesIterator OptimizationModelIF::uncertaintiesBegin ( ) const
virtual

Return a constant iterator pointing to the beginning of the uncertain parameter map (m_pUncContainer)

Warning
Not valid in deterministic model

Reimplemented in UncertainOptimizationModel.

◆ uncertaintiesEnd()

OptimizationModelIF::uncertaintiesIterator OptimizationModelIF::uncertaintiesEnd ( ) const
virtual

Return a constant iterator pointing to the end of the uncertain parameter map (m_pUncContainer)

Warning
Not valid in deterministic model

Reimplemented in UncertainOptimizationModel.

◆ VarInObj()

bool OptimizationModelIF::VarInObj ( string  varName,
uint  i = 1 
) const

Return true if and only if the decision variable exists in the i th objective function of the max term.

Note
Call ObjectiveFunctionIF::varIsDefined()

◆ varIsDefined()

bool OptimizationModelIF::varIsDefined ( string  varName) const

Return true if and only if the decision variable exists in this model.

Note
Call dvContainer::find() for the dvContainer of this model

◆ varsBegin()

OptimizationModelIF::varsIterator OptimizationModelIF::varsBegin ( ) const

Return a constant iterator pointing to the beginning of the decision variable map (m_pDVContainer)

◆ varsEnd()

OptimizationModelIF::varsIterator OptimizationModelIF::varsEnd ( ) const

Return a constant iterator pointing to the end of the decision variable map (m_pDVContainer)

◆ WriteToFile()

void OptimizationModelIF::WriteToFile ( string  folderName,
string  fileName 
) const
virtual

Reimplemented in MultiStageOptModelDDID.

Member Data Documentation

◆ m_constraints

vector<ROCPPConstraintIF_Ptr> OptimizationModelIF::m_constraints
private

Vector of constraints in this model.

◆ m_dduContainer

ROCPPuncContainer_Ptr OptimizationModelIF::m_dduContainer
protected

Container of decision dependent uncertain parameters in this model.

◆ m_dduStagesObs

map<string, pair<uint,uint> > OptimizationModelIF::m_dduStagesObs
protected

Map from name of the uncertain parameter to the first and last times when it can be observed.

◆ m_dduToMeasMap

map< pair<string,uint>, measPair> OptimizationModelIF::m_dduToMeasMap
protected

Map from pair of uncertain parameter name and time stage to measurement pair.

◆ m_mapBlockConstraints

map<string, vector<ROCPPConstraintIF_Ptr> > OptimizationModelIF::m_mapBlockConstraints
protected

Map from block name to vector of problem constraint indices.

◆ m_measVars

map<string, measPair> OptimizationModelIF::m_measVars
protected

Map from measurement varaibles to measurement pairs.

◆ m_nondduContainer

ROCPPuncContainer_Ptr OptimizationModelIF::m_nondduContainer
protected

Container of non decision dependent uncertain parameters in this model.

◆ m_numTimeStages

uint OptimizationModelIF::m_numTimeStages
protected

Length of planning horizon of this model.

◆ m_pDVContainer

ROCPPdvContainer_Ptr OptimizationModelIF::m_pDVContainer
private

Decision variable container of this model.

◆ m_pObj

ROCPPObjectiveIF_Ptr OptimizationModelIF::m_pObj
private

Objective function of this model.

◆ m_pUncContainer

ROCPPuncContainer_Ptr OptimizationModelIF::m_pUncContainer
protected

Uncertain parameter container of this model.

◆ m_uncertaintySet

vector<ROCPPConstraintIF_Ptr> OptimizationModelIF::m_uncertaintySet
protected

Vector collecting the uncertainty set constraints of this model.