commonpower.modeling.robust_cost.WeightedSumRobustCost

class WeightedSumRobustCost(discount_factor: float = 1.0, weights: list[float] | None = None)[source]

Bases: _ScenarioBasedCost

Utility class to create a robust cost function from a given cost function expression. The cost is calculated as the weighted sum of the costs over all scenarios.

Parameters:
  • discount_factor (float, optional) – Discount rate to give lower importance to costs further in the future. The logic is: sum_t (cost_t * df**t). Defaults to 1.0.

  • weights (list[float], optional) – Weights for each scenario. If not given, all scenarios are weighted equally. Defaults to None.

Methods

add_additional_constraints

Adds additional constraints for the robust cost function to the given model.

initialize

Initializes the robust cost function.

obj_fcn

Creates the objective function for the robust cost.

obj_fcn(model: ConcreteModel) Expression[source]

Creates the objective function for the robust cost.

Returns:

Expression – Robust objective function.