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

Track nonlinear resultant vars outside of MOI #590

Merged
merged 7 commits into from
Nov 28, 2024
Merged

Track nonlinear resultant vars outside of MOI #590

merged 7 commits into from
Nov 28, 2024

Conversation

simonbowly
Copy link
Collaborator

@simonbowly simonbowly commented Nov 27, 2024

Alternative to #587: instead of filtering out the NL resultant variables when querying through MOI, don't add these variables to MOI at all so they don't show up in model queries.

  • On deletion of NL constraints, deleted resvar indices are tracked on the deleted list for the next update operation
  • In _update_if_necessary, the same index tracking trick applied to each entry in model.variable_info is applied to NL constraints as well, so that their resvar indices are appropriately adjusted following deletion of another variable.

@simonbowly simonbowly marked this pull request as draft November 27, 2024 14:00
Copy link

codecov bot commented Nov 27, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 92.24%. Comparing base (9720c80) to head (85308ed).
Report is 1 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #590      +/-   ##
==========================================
+ Coverage   92.16%   92.24%   +0.07%     
==========================================
  Files           6        6              
  Lines        2630     2642      +12     
==========================================
+ Hits         2424     2437      +13     
+ Misses        206      205       -1     

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

@simonbowly simonbowly marked this pull request as ready for review November 27, 2024 21:41
@simonbowly
Copy link
Collaborator Author

This resolves all the tests to do with querying user-visible variables.

r"^test_nonlinear_expression_hs109$",
r"^test_nonlinear_expression_hs110$",
# MOI.get(MOI.ObjectiveValue()) fails for NL objectives
Copy link
Member

Choose a reason for hiding this comment

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

I'll take a look at this. It's probably on our end.

Copy link
Member

@odow odow left a comment

Choose a reason for hiding this comment

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

I'm happy if you're happy

Keep the coverage gods happy
@simonbowly
Copy link
Collaborator Author

I'm happy if @torressa is happy

Copy link
Collaborator

@torressa torressa left a comment

Choose a reason for hiding this comment

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

Nice one! Thanks Simon

@odow odow merged commit 1c31d31 into master Nov 28, 2024
23 checks passed
@odow odow deleted the hide-resvars branch November 28, 2024 19:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants