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

Feature: piecewise constraints #569

Open
wants to merge 20 commits into
base: main
Choose a base branch
from

Conversation

brynpickering
Copy link
Member

@brynpickering brynpickering commented Feb 14, 2024

Fixes #107

Summary of changes in this pull request:

  • Add piecewise_constraints component to YAML math.
  • Add simple example of its use in the user-defined math gallery.

TODO

  • Handle piecewise constraints when using verbose YAML - I suspect it won't be possible to incorporate it properly.
  • Handle piecewise constraints in math docs
  • Capture piecewise validation errors and pipe them through our own exceptions classes.
    - [ ] Test values as lists and not as mutable parameters. EDIT: not adding
  • Add documentation.

Reviewer checklist:

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

@brynpickering brynpickering marked this pull request as ready for review February 16, 2024 18:18
Copy link

codecov bot commented Feb 16, 2024

Codecov Report

Attention: Patch coverage is 95.41985% with 6 lines in your changes are missing coverage. Please review.

Project coverage is 96.12%. Comparing base (872978d) to head (52043a9).
Report is 6 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #569      +/-   ##
==========================================
+ Coverage   95.85%   96.12%   +0.26%     
==========================================
  Files          24       24              
  Lines        3619     3689      +70     
  Branches      788      717      -71     
==========================================
+ Hits         3469     3546      +77     
+ Misses         86       84       -2     
+ Partials       64       59       -5     
Files Coverage Δ
src/calliope/backend/backend_model.py 100.00% <100.00%> (+2.09%) ⬆️
src/calliope/backend/latex_backend_model.py 98.11% <100.00%> (+0.31%) ⬆️
src/calliope/backend/parsing.py 98.69% <100.00%> (+0.92%) ⬆️
src/calliope/backend/where_parser.py 98.17% <100.00%> (+0.87%) ⬆️
src/calliope/backend/expression_parser.py 97.36% <50.00%> (+0.18%) ⬆️
src/calliope/backend/pyomo_backend_model.py 94.82% <92.15%> (-0.60%) ⬇️

... and 3 files with indirect coverage changes

docs/user_defined_math/components.md Show resolved Hide resolved
src/calliope/backend/backend_model.py Outdated Show resolved Hide resolved
docs/user_defined_math/components.md Outdated Show resolved Hide resolved
docs/user_defined_math/components.md Show resolved Hide resolved
pyproject.toml Outdated Show resolved Hide resolved
pyproject.toml Outdated Show resolved Hide resolved
brynpickering and others added 2 commits March 1, 2024 14:34
Co-authored-by: Stefan Pfenninger <stefan@pfenninger.org>
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.

Piecewise linearisation
2 participants