commonpower.modeling.robust_cost.BaseRobustCost

class BaseRobustCost(discount_factor: float = 1.0)[source]

Bases: object

Utility class to create a robust cost function from a given cost function expression.

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.

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.

add_additional_constraints(model: ConcreteModel) None[source]

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

Parameters:

model (ConcreteModel) – Model instance.

initialize(fcn: Callable, horizon: int)[source]

Initializes the robust cost function.

Parameters:
  • fcn (Callable) – Cost function. Must take the arguments (scenario, model, t).

  • horizon (int) – Horizon of the optimization problem.

obj_fcn(model: ConcreteModel) Expression[source]

Creates the objective function for the robust cost.

Returns:

Expression – Robust objective function.