pwrs.power_models.extensions#
Lifecycle and metadata for user extensions to built power models.
- class pwrs.power_models.extensions.ExtensionRecord(name, constraint_groups, variable_groups, objective_terms, build_time)[source]#
Bases:
objectThe constraints and construction time contributed by one extension.
- Parameters:
name (str)
constraint_groups (tuple[str, ...])
variable_groups (tuple[str, ...])
objective_terms (tuple[str, ...])
build_time (float)
- class pwrs.power_models.extensions.PowerModelExtension(name, callback)[source]#
Bases:
objectA stable name paired with a callback that mutates a built model.
- Parameters:
name (str)
callback (PowerModelExtensionCallback)
- class pwrs.power_models.extensions.PowerModel(*args, **kwargs)[source]#
Bases:
ProtocolBackend-neutral interface available to extension callbacks.
- pwrs.power_models.extensions.apply_extensions(problem, value)[source]#
Apply configured extensions once, after build and before solver selection.
- Parameters:
problem (Any)
value (Any)
- Return type:
tuple[ExtensionRecord, …]