Allow variables and global expressions to be included in a YAML constraint "where" string
brynpickering opened this issue · comments
Problem description
Since variables and global expressions must be defined before constraints are added, they could also be used to "where" a constraint array, e.g.:
constraint_dict = {
"foreach": ["techs"]
"equation": "sum(carrier_prod, over=[nodes, timesteps]) >= 100"
"where": "carrier_prod"
}
The implementation would require first checking "model_data" to see if the component is a parameter. If it isn't, then check the backend dataset variables/expressions to see if it is one of those. We shouldn't have to worry about name overlaps since a user cannot define the same name for any optimisation problem component (i.e., a parameter and decision variable cannot have the same name).
Calliope version
v0.7.0-dev
Addressed in #490