Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow variables and global expressions to be included in a YAML constraint "where" string #450

Closed
brynpickering opened this issue Apr 18, 2023 · 1 comment
Milestone

Comments

@brynpickering
Copy link
Member

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

@brynpickering brynpickering changed the title Allow variables and global eexpressions to be included in a YAML constraint "where" string Allow variables and global expressions to be included in a YAML constraint "where" string Apr 19, 2023
@brynpickering brynpickering added this to the 0.7.0.b1 milestone Apr 21, 2023
@sjpfenninger
Copy link
Member

Addressed in #490

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants