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 removing multiple constraints at once #211

Merged
merged 7 commits into from
Dec 15, 2023
Merged

allow removing multiple constraints at once #211

merged 7 commits into from
Dec 15, 2023

Conversation

Irieo
Copy link
Contributor

@Irieo Irieo commented Dec 7, 2023

Make possible to pass a list into remove_constraints() to remove multiple constraints at once.
Keeps old functionality, i.e. it is still possible to pass constraint name as a string.
Adds logging, so user can see what constraints are removed.

to remove all constraints:
n.model.remove_constraints(list(n.model.constraints))

to remove a single constraint:
n.model.remove_constraints(['Bus-nodal_balance'])
or
n.model.remove_constraints('Bus-nodal_balance')

closes #210

Copy link

codecov bot commented Dec 7, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (930ceae) 89.26% compared to head (148a545) 89.28%.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #211      +/-   ##
==========================================
+ Coverage   89.26%   89.28%   +0.01%     
==========================================
  Files          15       15              
  Lines        3354     3359       +5     
  Branches      771      773       +2     
==========================================
+ Hits         2994     2999       +5     
  Misses        248      248              
  Partials      112      112              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

linopy/model.py Outdated Show resolved Hide resolved
@FabianHofmann
Copy link
Collaborator

Are you fine, if I set the logging from info to debug?

@Irieo
Copy link
Contributor Author

Irieo commented Dec 8, 2023

Are you fine, if I set the logging from info to debug?

sure!

linopy/model.py Outdated Show resolved Hide resolved
linopy/model.py Outdated Show resolved Hide resolved
@FabianHofmann FabianHofmann merged commit 23329b8 into master Dec 15, 2023
13 checks passed
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.

make possible to pass a list to remove_constraints()
3 participants