Numpy >2.0 bug for indexing in utils multiply()#53
Draft
dalyw wants to merge 3 commits into
Draft
Conversation
…dinal position instead of throwing IndexError Debugged using Claude
Codecov Report❌ Patch coverage is
❌ Your patch status has failed because the patch coverage (94.11%) is below the target coverage (100.00%). You can increase the patch coverage or adjust the target coverage. Additional details and impacted files@@ Coverage Diff @@
## main #53 +/- ##
==========================================
- Coverage 94.38% 94.37% -0.01%
==========================================
Files 10 10
Lines 1603 1601 -2
==========================================
- Hits 1513 1511 -2
Misses 90 90 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
#54 - one solution, Alex had some ideas too on pyomo usability
For numpy ≥ 2.0, the numpy charge_array was indexed by the Pyomo time-set member instead of its position. Worked when model.t = range(T), but raised IndexError for model.t = any other ordered set (e.g. float seconds).
Debugged using Claude: Added helper at(expr, t). Numpy operands are indexed by their ordinal position, Pyomo operands by their member.
Added a non-range test case to test_multiply_pyo.
Pull request recommendations:
Thanks for contributing!