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

Fixes bug with IndexedSet objects and the within argument #3288

Merged
merged 11 commits into from
Jul 11, 2024

Conversation

thisandthatuser
Copy link
Contributor

Fixes #3284 .

Summary/Motivation:

Indexed sets relying on other indexed sets for the within argument trigger errors in pyomo 6.7.3, whereas in pyomo 6.6.x they did not.

Changes proposed in this PR:

  • Fixed the bug
  • Added tests to ensure future functionality changes are noticed
  • Updated the set tutorial
  • Updated the doc string to be more explicit about this functionality

Legal Acknowledgement

By contributing to this software project, I have read the contribution guide and agree to the following terms and conditions for my contribution:

  1. I agree my contributions are submitted under the BSD license.
  2. I represent I am authorized to make the contributions and grant the license. If my employer has rights to intellectual property that includes these contributions, I represent that I have received permission to make contributions and grant the required license on behalf of that employer.

@thisandthatuser
Copy link
Contributor Author

The tests are failling because of numpy v2, which is being handled already in #3291

@blnicho blnicho requested a review from jsiirola June 25, 2024 19:05
Copy link
Member

@jsiirola jsiirola left a comment

Choose a reason for hiding this comment

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

This is a great catch and I am impressed that the fix was that straightforward. I have a couple minor requests for edits (one is a slight modification to your fix, and the other updates the tests to make better / more standard use of unittest).

note that this PR will conflict with #3302. I propose that (assuming you have time), we get this PR updated and merged first and then I will update #3302.

examples/pyomo/tutorials/set.dat Outdated Show resolved Hide resolved
pyomo/core/base/set.py Outdated Show resolved Hide resolved
pyomo/core/tests/unit/test_set.py Outdated Show resolved Hide resolved
@blnicho blnicho self-requested a review July 2, 2024 19:09
@mrmundt
Copy link
Contributor

mrmundt commented Jul 9, 2024

@thisandthatuser - can you please run the following on your code:

 # Auto-apply correct formatting
pip install black
black -S -C <path> --exclude examples/pyomobook/python-ch/BadIndent.py

If you already have black installed, please make sure it's on the latest version!

Copy link

codecov bot commented Jul 11, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 88.48%. Comparing base (b50cfac) to head (643c0e5).
Report is 17 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #3288   +/-   ##
=======================================
  Coverage   88.48%   88.48%           
=======================================
  Files         868      868           
  Lines       98427    98428    +1     
=======================================
+ Hits        87095    87097    +2     
+ Misses      11332    11331    -1     
Flag Coverage Δ
linux 86.30% <100.00%> (+<0.01%) ⬆️
osx 75.61% <100.00%> (+<0.01%) ⬆️
other 86.49% <100.00%> (+<0.01%) ⬆️
win 83.80% <100.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

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

@blnicho blnicho merged commit 2d138e3 into Pyomo:main Jul 11, 2024
33 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.

IndexedSet objects can no longer be used with the within argument in pyomo 6.7.3
5 participants