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

Robustify engine class (automatically dualizes all semi-infinite constraints) More...

#include <RobustifyEngine.hpp>

Inheritance diagram for RobustifyEngine:
Collaboration diagram for RobustifyEngine:

Public Member Functions

 RobustifyEngine (uint dualVarsCounter=0, string dualNme_suff="", string dualNme="dual")
 
 ~RobustifyEngine ()
 
ROCPPBilinMISOCP_Ptr robustify (ROCPPUncSSOptModel_Ptr pIn, bool feasible=true)
 Robusity the given model. More...
 
void calculateUncertaintySetMatrices (ROCPPUncSSOptModel_Ptr const pIn)
 Calculate the coefficient map for uncertainties and the coefficient map for deterministic part. More...
 
void createDualVars (ROCPPBilinMISOCP_Ptr pOut, ROCPPConstraintIF_Ptr pCstr, vector< vector< ROCPPVarIF_Ptr > > &dualVars, bool feasible=true)
 Create and store the dual variables in the given constraint and add duality constraint into output model. More...
 
void robustifyConstraint (ROCPPConstraintIF_Ptr pConstraint, ROCPPUncSSOptModel_Ptr const pIn, ROCPPBilinMISOCP_Ptr pOut, bool feasible=true)
 Robusify the given constraint. More...
 
uint getDualVarsCnt () const
 Get the number of dual variables. More...
 
ROCPPOptModelIF_Ptr Reformulate (ROCPPOptModelIF_Ptr pIn)
 
bool isApplicable (ROCPPOptModelIF_Ptr pIn) const
 
string getName () const
 
- Public Member Functions inherited from ReformulationStrategyIF
 ReformulationStrategyIF ()
 
 ~ReformulationStrategyIF ()
 

Private Attributes

string m_dualNme
 Name of the dual variable. More...
 
string m_dualNme_suff
 
uint m_dualVarsCounter
 Number of the dual variabls. More...
 
bool m_uncertaintySetMatricesCalculated
 Indicate whether the uncertainty set matriced are calculated or not. More...
 
map< uint, vector< vector< vector< pair< bool, ROCPPExpr_Ptr > > > > > m_EMvec
 Map from time-stage to -> dimensions are constraint defining the us, number of linear expressions in that constraint, number of total uncertainties in the model. More...
 
map< uint, vector< vector< ROCPPExpr_Ptr > > > m_EVvec
 Map from time-stage -> dimensions are constraint defining the us number, number of linear expressions in that constraint. More...
 
map< pair< uint, uint >, bool > m_isEqCstr
 Map from pair( time-stage, constraint num) to bool = true if constraint is equality constraint. More...
 

Detailed Description

Robustify engine class (automatically dualizes all semi-infinite constraints)

Constructor & Destructor Documentation

◆ RobustifyEngine()

RobustifyEngine::RobustifyEngine ( uint  dualVarsCounter = 0,
string  dualNme_suff = "",
string  dualNme = "dual" 
)
inline

◆ ~RobustifyEngine()

RobustifyEngine::~RobustifyEngine ( )
inline

Member Function Documentation

◆ calculateUncertaintySetMatrices()

void RobustifyEngine::calculateUncertaintySetMatrices ( ROCPPUncSSOptModel_Ptr const  pIn)

Calculate the coefficient map for uncertainties and the coefficient map for deterministic part.

Note
Store the coefficent of each uncertainty in each linear expression(out of and in the norm term) of each constraint defining uncertainty set in m_EMvec
Store the deterministic part in each linear expression(out of and in the norm term) in each constraint defining uncertainty set in m_EVvec

◆ createDualVars()

void RobustifyEngine::createDualVars ( ROCPPBilinMISOCP_Ptr  pOut,
ROCPPConstraintIF_Ptr  pCstr,
vector< vector< ROCPPVarIF_Ptr > > &  dualVars,
bool  feasible = true 
)

Create and store the dual variables in the given constraint and add duality constraint into output model.

Parameters
pOutOptimization model after dualization
pCstrConstraint to be robustified
dualVarsStore dual variable for each linear expression(outside and in the norm term) in each constraint defining uncertainty set and store it in this vector
feasibleIndicate whether the given constraint is feasible or not, only set to false when we dualize an infeasible problem

◆ getDualVarsCnt()

uint RobustifyEngine::getDualVarsCnt ( ) const
inline

Get the number of dual variables.

◆ getName()

string RobustifyEngine::getName ( ) const
inlinevirtual

◆ isApplicable()

bool RobustifyEngine::isApplicable ( ROCPPOptModelIF_Ptr  pIn) const
virtual

◆ Reformulate()

ROCPPOptModelIF_Ptr RobustifyEngine::Reformulate ( ROCPPOptModelIF_Ptr  pIn)
virtual

◆ robustify()

ROCPPBilinMISOCP_Ptr RobustifyEngine::robustify ( ROCPPUncSSOptModel_Ptr  pIn,
bool  feasible = true 
)

Robusity the given model.

Note
First calculate the UncertaintySetMatrices then robustify each constraint.
See also
CalculateUncertaintySetMatrices, robustifyConstraint
Parameters
pInModel to be robusified
feasibleIndicate whether the given constraint is feasible or not, only set to false when we dualize an infeasible problem

◆ robustifyConstraint()

void RobustifyEngine::robustifyConstraint ( ROCPPConstraintIF_Ptr  pConstraint,
ROCPPUncSSOptModel_Ptr const  pIn,
ROCPPBilinMISOCP_Ptr  pOut,
bool  feasible = true 
)

Robusify the given constraint.

Parameters
pConstraintConstraint to be robustified
pInModel to be robusified
feasibleIndicate whether the given constraint is feasible or not, only set to false when we dualize an infeasible problem
Note
First create the dual variables being used for robustifying this constraint, then add the dual constraint into the output model
See also
createDualVars

Member Data Documentation

◆ m_dualNme

string RobustifyEngine::m_dualNme
private

Name of the dual variable.

◆ m_dualNme_suff

string RobustifyEngine::m_dualNme_suff
private

◆ m_dualVarsCounter

uint RobustifyEngine::m_dualVarsCounter
private

Number of the dual variabls.

◆ m_EMvec

map<uint, vector<vector<vector< pair<bool, ROCPPExpr_Ptr> > > > > RobustifyEngine::m_EMvec
private

Map from time-stage to -> dimensions are constraint defining the us, number of linear expressions in that constraint, number of total uncertainties in the model.

◆ m_EVvec

map<uint, vector<vector< ROCPPExpr_Ptr> > > RobustifyEngine::m_EVvec
private

Map from time-stage -> dimensions are constraint defining the us number, number of linear expressions in that constraint.

◆ m_isEqCstr

map<pair<uint,uint>, bool> RobustifyEngine::m_isEqCstr
private

Map from pair( time-stage, constraint num) to bool = true if constraint is equality constraint.

◆ m_uncertaintySetMatricesCalculated

bool RobustifyEngine::m_uncertaintySetMatricesCalculated
private

Indicate whether the uncertainty set matriced are calculated or not.