Left hand-side expression class. More...
#include <ConstraintTerm.hpp>
Public Types | |
| typedef vector< ROCPPCstrTermIF_Ptr >::const_iterator | ConstraintLHS_const_iterator |
| Constant iterator in vector of constraint terms. More... | |
| typedef vector< ROCPPCstrTermIF_Ptr >::iterator | ConstraintLHS_iterator |
| Iterator in vector of constraint terms. More... | |
| typedef ConstraintLHS_const_iterator | const_iterator |
| Constant iterator in vector of constraint terms. More... | |
| typedef ConstraintLHS_iterator | iterator |
| Iterator in vector of constraint terms. More... | |
| typedef dvMapType::const_iterator | dvIterator |
| Constant iterator in decision variable map. More... | |
| typedef uncMapType::const_iterator | uncIterator |
| Constant iterator in uncertain parameter map. More... | |
Public Member Functions | |
| LHSExpression () | |
| Constructor of LHSExpression. More... | |
| ~LHSExpression () | |
| Destructor of LHSExpression. More... | |
| const_iterator | begin () const |
| Return a constant iterator pointing to the beginning of m_terms in the expression. More... | |
| const_iterator | end () const |
| Return a constant iterator pointing to the end of m_terms in the expression. More... | |
| dvIterator | varsBegin () const |
| Return a constant iterator pointing to the beginning of the decision variable container (m_pDVContainer) More... | |
| dvIterator | varsEnd () const |
| Return a constant iterator pointing to the end of the decision variable container m_pDVContainer. More... | |
| uncIterator | uncBegin () const |
| Return a constaint iterator pointing to the beginning of the uncertain parameter container (m_pUncContainer) More... | |
| uncIterator | uncEnd () const |
| Return a constant iterator pointing to the end of the uncertain parameter container (m_pUncContainer) More... | |
| const_iterator | find (ROCPPconstCstrTermIF_Ptr term) const |
| Find a term in the expression. More... | |
| void | operator*= (ROCPPconstCstrTermIF_Ptr term) |
| Multiply expression by given term. More... | |
| void | operator*= (ROCPPconstExpr_Ptr other) |
| Multiply expression by given expression. More... | |
| void | operator*= (ROCPPUnc_Ptr unc) |
| Multiply expression by given uncertain parameter. More... | |
| void | operator*= (ROCPPVarIF_Ptr var) |
| Multiply expression by given decision variable. More... | |
| void | operator*= (double a) |
| Multiply expression by given constant. More... | |
| void | operator+= (ROCPPUnc_Ptr unc) |
| Add uncertain parameter to expression. More... | |
| void | operator+= (ROCPPVarIF_Ptr var) |
| Add decision variable to expression. More... | |
| void | operator+= (ROCPPconstCstrTermIF_Ptr term) |
| Add term to expression. More... | |
| void | operator+= (ROCPPconstExpr_Ptr other) |
| Add expression to expression. More... | |
| void | operator+= (double a) |
| Add constant to expression. More... | |
| void | add (double c) |
| Create a new ProductTerm using the given input and add it to the expression. More... | |
| void | add (double c, ROCPPVarIF_Ptr pVariable) |
| Create a new ProductTerm using the given inputs and add it to the expression. More... | |
| void | add (double c, ROCPPUnc_Ptr pUncertainty, ROCPPVarIF_Ptr pVariable) |
| Create a new ProductTerm using the given inputs and add it to the expression. More... | |
| void | add (double c, ROCPPUnc_Ptr pUncertainty) |
| Create a new ProductTerm using the given inputs and add it to the expression. More... | |
| void | add (double c, ROCPPVarIF_Ptr pVariable1, ROCPPVarIF_Ptr pVariable2) |
| Create a new ProductTerm using the given inputs and add it to the expression. More... | |
| void | add (double c, ROCPPUnc_Ptr pUncertainty, ROCPPVarIF_Ptr pVariable1, ROCPPVarIF_Ptr pVariable2) |
| Create a new ProductTerm using the given inputs and add it to the expression. More... | |
| void | add (ROCPPconstCstrTermIF_Ptr term) |
| Add the given term to the expression. More... | |
| void | add (ROCPPconstExpr_Ptr expr) |
| Add the given expression to this expression. More... | |
| void | add (double c, ROCPPconstCstrTermIF_Ptr term) |
| Add the product of the given inputs into the expression. More... | |
| void | add (double c, ROCPPconstExpr_Ptr expr) |
| Add the given expression multiplied by c to this expression. More... | |
| void | add (double c, ROCPPconstExpr_Ptr pExpression, ROCPPVarIF_Ptr pVariable) |
| Add the product of the given inputs to the expression. More... | |
| void | add (double c, ROCPPconstExpr_Ptr pExpression, ROCPPUnc_Ptr pUnc) |
| Add the product of the given inputs to the expression. More... | |
| ROCPPExpr_Ptr | mapExprVars (const map< string, ROCPPVarIF_Ptr > &mapFromOldToNewVars) const |
| Map the old decision variables in this expression to new decision variables. More... | |
| ROCPPExpr_Ptr | mapExprUnc (const map< string, ROCPPUnc_Ptr > &mapFromOldToNewUnc) const |
| Map the old uncertain parameters in this expression to new uncertain parameters. More... | |
| ROCPPExpr_Ptr | mapVars (const map< string, ROCPPExpr_Ptr > &mapFromVarToExpression) const |
| Map the old variables in this expression to some expressions. More... | |
| ROCPPExpr_Ptr | mapUncs (const map< string, ROCPPExpr_Ptr > &mapFromUncToExpression) const |
| Map the old uncertain parameters in this expression to some expressions. More... | |
| ROCPPExpr_Ptr | replaceTermWithVar (const multimap< string, ROCPPVarIF_Ptr > &term, ROCPPVarIF_Ptr var) const |
| Replace the given term in this expression with the given decision variable. More... | |
| ROCPPExpr_Ptr | replaceBilinearTerm (map< pair< string, string >, ROCPPVarIF_Ptr > &allTerms, uint &count) const |
| Replace the bilinear term in this object with the given decision variable. More... | |
| pair< bool, ROCPPExpr_Ptr > | factorOut (ROCPPUnc_Ptr unc) const |
| Calculate the coeffiecient of the given uncertain parameter. More... | |
| void | add_vars_involved_in_prod (dvContainer &dvs) const |
| Add the variable involved in product in this expression into the given containe␐r. More... | |
| void | add_int_vars (dvContainer &dvs) const |
| Add the integer variable in this expression into the given container. More... | |
| double | evaluate (const map< string, double > &valuesMap) const |
| Calculate the value of this expression at the given solution. More... | |
| double | getSumConstantTerms () const |
| Calculate the sum of the constant terms in this expression. More... | |
| size_t | getNumTerms () const |
| Get the number of terms in this experssion. More... | |
| bool | hasNormTerm () const |
| Returns true if and only if the expression has a norm term. More... | |
| bool | hasNonlinearities () const |
| Returns true if and only if the expression involves nonlinear terms (i.e., terms involving products of decision variables) More... | |
| bool | hasProdsUncertainties () const |
| Returns true if and only if the expression involves products of uncertain parameters. More... | |
| bool | hasProdsContVars () const |
| Returns true if and only if the expression involves products of real-valued decision variables. More... | |
| bool | isDeterministic () const |
| Returns true if and only if the expression does not involve any uncertain parameters. More... | |
| bool | isConstant () const |
| Returns true if and only if the expression involves only constant terms. More... | |
| bool | isLinear () const |
| Returns true if and only if the expression is linear. More... | |
| bool | isQuadratic () const |
| Returns true if and only if the expression is quadratic. More... | |
| bool | isWellDefined () const |
| Return true if and only if this expression is not empty. More... | |
| ROCPPExpr_Ptr | getLinearPart () const |
| Return the part without norm term (i.e., the sum of all product terms) in this expression. More... | |
| ROCPPNormTerm_Ptr | getNormTerm () const |
| Return the norm term in this expression. More... | |
| uint | getNumContVars () const |
| Get the number of real-valued decision variables in the expression. More... | |
| uint | getNumIntVars () const |
| Get the number of integer-valued decision variables in the expression. More... | |
| uint | getNumBoolVars () const |
| Get the number of boolean decision variables in the expression. More... | |
| uint | getNumAdaptiveContVars () const |
| Get the number of adaptive real-valued decision variables in the expression. More... | |
| uint | getNumAdaptiveVars () const |
| Get the number of adaptive decision variables in the expression. More... | |
| size_t | getNumVars () const |
| Get the number of decision variables in the expression. More... | |
| uint | getTimeStage () const |
| Get the maximum time-stage of any decision variable in the expression. More... | |
| size_t | getNumUncertainties () const |
| Get the number of uncertain parameters in the expression. More... | |
| ROCPPExpr_Ptr | getDeterministicLinearPart () const |
| Return the sum of all deterministic product terms in this expression. More... | |
| uint | getNumTimesTermAppears (const multimap< string, ROCPPVarIF_Ptr > &term) const |
| Get the number of times the given term appears in this expression. More... | |
| void | getAllProductsOf2Variables (map< pair< string, string >, uint > &freqMap, map< pair< string, string >, multimap< string, ROCPPVarIF_Ptr > > &termMap) const |
| Get products of any two variables in this expression. More... | |
| ROCPPconstdvContainer_Ptr | getDVContainer () const |
| Get the decision variable container. More... | |
| ROCPPconstuncContainer_Ptr | getUncContainer () const |
| Get the uncertain parameter container. More... | |
| ROCPPVarIF_Ptr | getVar (string varName) const |
| Get the variable by name. More... | |
| bool | varIsInvolved (ROCPPVarIF_Ptr dv) const |
| Check whether the given variable is involved in this expression Call dvContainer::varIsInvolved() for the dvContainer of this expression. More... | |
| bool | AnyVarIsInvolved (dvContainer &dvs) const |
| Check whether any decision variable in the given container is involved in this expression Call dvContainer::AnyVarIsInvolved() for the dvContainer of this expression. More... | |
| ROCPPExpr_Ptr | Clone () const |
| Clone this expression. More... | |
| void | WriteToStream (ofstream &ofs) const |
| Print this term to the stream ofs. More... | |
Protected Member Functions | |
| iterator | find (ROCPPCstrTermIF_Ptr term) |
| Find a term in this expression. More... | |
Protected Attributes | |
| vector< ROCPPCstrTermIF_Ptr > | m_terms |
| Vector of terms in this expression. More... | |
| bool | m_hasNormTerm |
| Indicates whether this expression has a norm term or not. More... | |
| ROCPPdvContainer_Ptr | m_pDVContainer |
| Decision variable container for this expression. More... | |
| ROCPPuncContainer_Ptr | m_pUncContainer |
| Uncertain parameter container for this expression. More... | |
Left hand-side expression class.
Constant iterator in vector of constraint terms.
| typedef vector<ROCPPCstrTermIF_Ptr>::const_iterator LHSExpression::ConstraintLHS_const_iterator |
Constant iterator in vector of constraint terms.
| typedef vector<ROCPPCstrTermIF_Ptr>::iterator LHSExpression::ConstraintLHS_iterator |
Iterator in vector of constraint terms.
| typedef dvMapType::const_iterator LHSExpression::dvIterator |
Constant iterator in decision variable map.
Iterator in vector of constraint terms.
| typedef uncMapType::const_iterator LHSExpression::uncIterator |
Constant iterator in uncertain parameter map.
|
inline |
Constructor of LHSExpression.
|
inline |
Destructor of LHSExpression.
| void LHSExpression::add | ( | double | c | ) |
Create a new ProductTerm using the given input and add it to the expression.
| c | constant to add to the expression |
| void LHSExpression::add | ( | double | c, |
| ROCPPconstCstrTermIF_Ptr | term | ||
| ) |
Add the product of the given inputs into the expression.
| c | coefficient |
| term | term to add to expression after multiplying it by coefficient |
| void LHSExpression::add | ( | double | c, |
| ROCPPconstExpr_Ptr | expr | ||
| ) |
Add the given expression multiplied by c to this expression.
| c | coefficient |
| expr | expression to add to this expression after multiplying it by coefficient c |
| void LHSExpression::add | ( | double | c, |
| ROCPPconstExpr_Ptr | pExpression, | ||
| ROCPPUnc_Ptr | pUnc | ||
| ) |
Add the product of the given inputs to the expression.
| c | coefficient |
| pUnc | uncertain parameter |
| pExpression | expression to add to this expression after multiplying it by coefficient c and by uncertain parameter pUnc Call LHExpression::add(ROCPPconstExpr_Ptr) |
| void LHSExpression::add | ( | double | c, |
| ROCPPconstExpr_Ptr | pExpression, | ||
| ROCPPVarIF_Ptr | pVariable | ||
| ) |
Add the product of the given inputs to the expression.
| c | coefficient |
| pVariable | decision variable |
| pExpression | expression to add to this expression after multiplying it by coefficient c and by decision variable pVariable |
| void LHSExpression::add | ( | double | c, |
| ROCPPUnc_Ptr | pUncertainty | ||
| ) |
Create a new ProductTerm using the given inputs and add it to the expression.
| c | coefficient of the term to add |
| pUncertainty | uncertain parameter of the term to add |
| void LHSExpression::add | ( | double | c, |
| ROCPPUnc_Ptr | pUncertainty, | ||
| ROCPPVarIF_Ptr | pVariable | ||
| ) |
Create a new ProductTerm using the given inputs and add it to the expression.
| c | coefficient of the term to add |
| pUncertainty | uncertain parameter of the term to add |
| pVariable | decision variable of the term to add |
| void LHSExpression::add | ( | double | c, |
| ROCPPUnc_Ptr | pUncertainty, | ||
| ROCPPVarIF_Ptr | pVariable1, | ||
| ROCPPVarIF_Ptr | pVariable2 | ||
| ) |
Create a new ProductTerm using the given inputs and add it to the expression.
| c | coefficient of the term to add |
| pUncertainty | uncertain parameter of the term to add |
| pVariable1 | first decision variable of the term to add |
| pVariable2 | second decision variable of the term to add |
| void LHSExpression::add | ( | double | c, |
| ROCPPVarIF_Ptr | pVariable | ||
| ) |
Create a new ProductTerm using the given inputs and add it to the expression.
| c | coefficient of the term to add |
| pVariable | decision variable of the term to add |
| void LHSExpression::add | ( | double | c, |
| ROCPPVarIF_Ptr | pVariable1, | ||
| ROCPPVarIF_Ptr | pVariable2 | ||
| ) |
Create a new ProductTerm using the given inputs and add it to the expression.
| c | coefficient of the term to add |
| pVariable1 | first decision variable of the term to add |
| pVariable2 | second decision variable of the term to add |
| void LHSExpression::add | ( | ROCPPconstCstrTermIF_Ptr | term | ) |
Add the given term to the expression.
| void LHSExpression::add | ( | ROCPPconstExpr_Ptr | expr | ) |
Add the given expression to this expression.
| expr | expression to add to this expression |
| void LHSExpression::add_int_vars | ( | dvContainer & | dvs | ) | const |
Add the integer variable in this expression into the given container.
| void LHSExpression::add_vars_involved_in_prod | ( | dvContainer & | dvs | ) | const |
Add the variable involved in product in this expression into the given containe␐r.
| bool LHSExpression::AnyVarIsInvolved | ( | dvContainer & | dvs | ) | const |
Check whether any decision variable in the given container is involved in this expression Call dvContainer::AnyVarIsInvolved() for the dvContainer of this expression.
|
inline |
Return a constant iterator pointing to the beginning of m_terms in the expression.
| ROCPPExpr_Ptr LHSExpression::Clone | ( | ) | const |
Clone this expression.
|
inline |
Return a constant iterator pointing to the end of m_terms in the expression.
| double LHSExpression::evaluate | ( | const map< string, double > & | valuesMap | ) | const |
Calculate the value of this expression at the given solution.
| pair< bool, ROCPPExpr_Ptr > LHSExpression::factorOut | ( | ROCPPUnc_Ptr | unc | ) | const |
Calculate the coeffiecient of the given uncertain parameter.
| LHSExpression::const_iterator LHSExpression::find | ( | ROCPPconstCstrTermIF_Ptr | term | ) | const |
Find a term in the expression.
| term | term to add to the expression |
|
protected |
Find a term in this expression.
| void LHSExpression::getAllProductsOf2Variables | ( | map< pair< string, string >, uint > & | freqMap, |
| map< pair< string, string >, multimap< string, ROCPPVarIF_Ptr > > & | termMap | ||
| ) | const |
Get products of any two variables in this expression.
| freqMap | map from the pair of the decision variable names in each product to the frequency of this product |
| termMap | map from the pair of the decision variable names in each product to the map of the name to the variable involved in the product |
| ROCPPExpr_Ptr LHSExpression::getDeterministicLinearPart | ( | ) | const |
Return the sum of all deterministic product terms in this expression.
| ROCPPconstdvContainer_Ptr LHSExpression::getDVContainer | ( | ) | const |
Get the decision variable container.
| ROCPPExpr_Ptr LHSExpression::getLinearPart | ( | ) | const |
Return the part without norm term (i.e., the sum of all product terms) in this expression.
| ROCPPNormTerm_Ptr LHSExpression::getNormTerm | ( | ) | const |
Return the norm term in this expression.
|
inline |
Get the number of adaptive real-valued decision variables in the expression.
|
inline |
Get the number of adaptive decision variables in the expression.
|
inline |
Get the number of boolean decision variables in the expression.
|
inline |
Get the number of real-valued decision variables in the expression.
|
inline |
Get the number of integer-valued decision variables in the expression.
|
inline |
Get the number of terms in this experssion.
| uint LHSExpression::getNumTimesTermAppears | ( | const multimap< string, ROCPPVarIF_Ptr > & | term | ) | const |
Get the number of times the given term appears in this expression.
|
inline |
Get the number of uncertain parameters in the expression.
|
inline |
Get the number of decision variables in the expression.
| double LHSExpression::getSumConstantTerms | ( | ) | const |
Calculate the sum of the constant terms in this expression.
|
inline |
Get the maximum time-stage of any decision variable in the expression.
| ROCPPconstuncContainer_Ptr LHSExpression::getUncContainer | ( | ) | const |
Get the uncertain parameter container.
| ROCPPVarIF_Ptr LHSExpression::getVar | ( | string | varName | ) | const |
Get the variable by name.
| bool LHSExpression::hasNonlinearities | ( | ) | const |
Returns true if and only if the expression involves nonlinear terms (i.e., terms involving products of decision variables)
|
inline |
Returns true if and only if the expression has a norm term.
| bool LHSExpression::hasProdsContVars | ( | ) | const |
Returns true if and only if the expression involves products of real-valued decision variables.
| bool LHSExpression::hasProdsUncertainties | ( | ) | const |
Returns true if and only if the expression involves products of uncertain parameters.
| bool LHSExpression::isConstant | ( | ) | const |
Returns true if and only if the expression involves only constant terms.
| bool LHSExpression::isDeterministic | ( | ) | const |
Returns true if and only if the expression does not involve any uncertain parameters.
| bool LHSExpression::isLinear | ( | ) | const |
Returns true if and only if the expression is linear.
| bool LHSExpression::isQuadratic | ( | ) | const |
Returns true if and only if the expression is quadratic.
|
inline |
Return true if and only if this expression is not empty.
| ROCPPExpr_Ptr LHSExpression::mapExprUnc | ( | const map< string, ROCPPUnc_Ptr > & | mapFromOldToNewUnc | ) | const |
Map the old uncertain parameters in this expression to new uncertain parameters.
| ROCPPExpr_Ptr LHSExpression::mapExprVars | ( | const map< string, ROCPPVarIF_Ptr > & | mapFromOldToNewVars | ) | const |
Map the old decision variables in this expression to new decision variables.
| ROCPPExpr_Ptr LHSExpression::mapUncs | ( | const map< string, ROCPPExpr_Ptr > & | mapFromUncToExpression | ) | const |
Map the old uncertain parameters in this expression to some expressions.
| ROCPPExpr_Ptr LHSExpression::mapVars | ( | const map< string, ROCPPExpr_Ptr > & | mapFromVarToExpression | ) | const |
Map the old variables in this expression to some expressions.
| void LHSExpression::operator*= | ( | double | a | ) |
Multiply expression by given constant.
| a | constant to multiply this expression by |
| void LHSExpression::operator*= | ( | ROCPPconstCstrTermIF_Ptr | term | ) |
Multiply expression by given term.
| term | term to multiply this expression by |
| void LHSExpression::operator*= | ( | ROCPPconstExpr_Ptr | other | ) |
Multiply expression by given expression.
| other | expression to multiply this expression by |
| void LHSExpression::operator*= | ( | ROCPPUnc_Ptr | unc | ) |
Multiply expression by given uncertain parameter.
| unc | uncertain parameter to multiply this expression by |
| void LHSExpression::operator*= | ( | ROCPPVarIF_Ptr | var | ) |
Multiply expression by given decision variable.
| var | decision variable to multiply this expression by |
|
inline |
Add constant to expression.
| a | constants to add to this expression |
|
inline |
Add term to expression.
| term | term to add to this expression |
|
inline |
Add expression to expression.
| other | expression to add to this expression |
|
inline |
Add uncertain parameter to expression.
| unc | uncertain parameter to add to this expression |
|
inline |
Add decision variable to expression.
| var | decision variable to add to this expression |
| ROCPPExpr_Ptr LHSExpression::replaceBilinearTerm | ( | map< pair< string, string >, ROCPPVarIF_Ptr > & | allTerms, |
| uint & | count | ||
| ) | const |
Replace the bilinear term in this object with the given decision variable.
| allTerms | map from pair of decision variable names that define the bilinear term to the decision variable used to replace the term |
| count | number of different bilinear terms |
| ROCPPExpr_Ptr LHSExpression::replaceTermWithVar | ( | const multimap< string, ROCPPVarIF_Ptr > & | term, |
| ROCPPVarIF_Ptr | var | ||
| ) | const |
Replace the given term in this expression with the given decision variable.
|
inline |
Return a constaint iterator pointing to the beginning of the uncertain parameter container (m_pUncContainer)
|
inline |
Return a constant iterator pointing to the end of the uncertain parameter container (m_pUncContainer)
| bool LHSExpression::varIsInvolved | ( | ROCPPVarIF_Ptr | dv | ) | const |
Check whether the given variable is involved in this expression Call dvContainer::varIsInvolved() for the dvContainer of this expression.
|
inline |
Return a constant iterator pointing to the beginning of the decision variable container (m_pDVContainer)
|
inline |
Return a constant iterator pointing to the end of the decision variable container m_pDVContainer.
| void LHSExpression::WriteToStream | ( | ofstream & | ofs | ) | const |
Print this term to the stream ofs.
| ofs | output file stream |
|
protected |
Indicates whether this expression has a norm term or not.
|
protected |
Decision variable container for this expression.
|
protected |
Uncertain parameter container for this expression.
|
protected |
Vector of terms in this expression.