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

Decision vars & global exprs in where strings #490

Merged
merged 2 commits into from
Oct 23, 2023

Conversation

brynpickering
Copy link
Member

Fixes issue(s) #450

Summary of changes in this pull request:

Since there is a strict order of things in the backend (parameters -> variables -> expressions -> constraints -> objective), we will have already constructed variables by the time we construct expressions and will have access to both variables and expressions by the time we reach constraints. Therefore, their existence can be checked in the constraint/objective where string. It makes some things less verbose.

Reviewer checklist:

  • Test(s) added to cover contribution
  • Documentation updated
  • Changelog updated
  • Coverage maintained or improved

@codecov
Copy link

codecov bot commented Oct 23, 2023

Codecov Report

Merging #490 (94a64e1) into main (cbed4c8) will decrease coverage by 2.79%.
Report is 4 commits behind head on main.
The diff coverage is 95.81%.

@@            Coverage Diff             @@
##             main     #490      +/-   ##
==========================================
- Coverage   94.98%   92.20%   -2.79%     
==========================================
  Files          31       32       +1     
  Lines        3890     4015     +125     
  Branches        0      961     +961     
==========================================
+ Hits         3695     3702       +7     
- Misses        195      196       +1     
- Partials        0      117     +117     
Files Coverage Δ
src/calliope/__init__.py 100.00% <ø> (ø)
src/calliope/_version.py 100.00% <ø> (ø)
src/calliope/backend/helper_functions.py 99.35% <ø> (ø)
src/calliope/backend/where_parser.py 98.55% <100.00%> (ø)
src/calliope/cli.py 81.67% <100.00%> (ø)
src/calliope/core/__init__.py 100.00% <ø> (ø)
src/calliope/core/attrdict.py 99.50% <ø> (ø)
src/calliope/core/io.py 91.75% <ø> (ø)
src/calliope/core/model.py 93.23% <100.00%> (ø)
src/calliope/core/util/generate_runs.py 87.09% <ø> (ø)
... and 22 more

sjpfenninger
sjpfenninger previously approved these changes Oct 23, 2023
Copy link
Member

@sjpfenninger sjpfenninger left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good to go, with the proviso that the docs should highlight how vars and global_expressions are allowed in where strings and maybe some tips on how to differentiate between them when reading existing constraints

@brynpickering brynpickering merged commit 95ce22d into main Oct 23, 2023
8 of 9 checks passed
@brynpickering brynpickering deleted the feature-exprs-and-vars-in-constrs branch October 23, 2023 16:23
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

Successfully merging this pull request may close these issues.

2 participants