utils
Provides some utility functions for all code in energy_hub.
- energy_hub.utils.cached_property(func)[source]
Return a property that caches results.
- Parameters:
func – The function to decorated
- Returns:
The decorated cached property
- energy_hub.utils.constraint(*args, enabled=True)[source]
Mark a function as a constraint of the model.
The function that adds these constraints to the model is _add_indexed_constraints.
- Parameters:
*args – The indices that the constraint is indexed by. Each element of each index is passed to the method.
enabled – Is the constraint enabled? Defaults to True.
- Returns:
The decorated function