commonpower.modeling.robust_constraints.ConstraintScenario
- class ConstraintScenario(entity: ModelEntity, expand_state_mapping: str, element_mapping: dict[str, str])[source]
Bases:
objectUtility class to map variables and parameters to their corresponding scenario variables. This is the corner stone of robust constraint handling. The scenario keeps track of all necessary scenarios defined by uncertainties in the constraint and allows to expand the constraint for all these scenarios. All of this is handled in the background.
You need to define exactly one expand variable in the constraint expression. This variable is the anchor point for the expansion of the robust constraint. This means that all uncertainties are computed with respect to it, i.e., scenarios are created for it. The choice of expand variable is not necessarily unique, however, it is useful to think about which variables you want to generate scenarios for, i.e., which variable is mainly “affected” by uncertainties.
Multiple robust constraints can share the same expand variable, the appropriate aggregation of uncertainties is taken care of.
Utility class to map variables and parameters to their corresponding scenario variables.
- Parameters:
entity (ModelEntity) – Entity instance.
expand_state_mapping (str) – Expandable variable name.
element_mapping (dict[str, str]) – Mapping of variables and parameters to their scenario equivalents.
Methods
- __call__(element_name: str, model: ConcreteModel, expand_var: bool = False) Var | Param[source]
Retrieves the pyomo element for the given element name. It does so across all scenarios defined by the uncertainties in the robust constraint.
- Parameters:
element_name (str) – Local name of the element.
model (ConcreteModel) – Model instance.
expand_var (bool, optional) – Determines if this element is the variable/state that is expanded. This means that all uncertainties are computed with respect to it, i.e., scenarios are created for it. Every robust constraint has exactly one expand variable. Defaults to False.
- Returns:
Var | Param – Pyomo element.