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

NLv2: fix reporting numbers of nonlinear discrete variables #3238

Merged
merged 6 commits into from
Apr 19, 2024

Conversation

jsiirola
Copy link
Member

Fixes #3235

Summary/Motivation:

This resolves an error in how we were reporting the numbers of nonlinear discrete variables that was causing some MINLP solvers to crash. It also ensures that Integer variables whose domains are in [0, 1] are reported as being binary (matching AMPL's behavior).

These changes are covered by a new test, the baseline of which was verified against AMPL's generated NL file.

Changes proposed in this PR:

  • correct reporting of nonlinear discrete variables
  • report integer variables with domains in [0, 1] as binary
  • add / update tests

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.

Copy link

codecov bot commented Apr 17, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 88.40%. Comparing base (fa5d0b6) to head (ee05e18).
Report is 2 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3238      +/-   ##
==========================================
+ Coverage   88.39%   88.40%   +0.01%     
==========================================
  Files         848      848              
  Lines       95322    95325       +3     
==========================================
+ Hits        84258    84273      +15     
+ Misses      11064    11052      -12     
Flag Coverage Δ
linux 86.34% <100.00%> (+<0.01%) ⬆️
osx 76.19% <100.00%> (+<0.01%) ⬆️
other 86.54% <100.00%> (+0.01%) ⬆️
win 83.84% <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.

@grahamsparrow-8451
Copy link

@jsiirola Thank you very much for your speedy fix to this issue! I re-ran my original test code and can confirm that this resolves the issue and all three MINLP solvers now run successfully and report the same optimal objective value:

scip:None:nl_version_2 0.68
asl:bonmin:nl_version_2 0.68
asl:couenne:nl_version_2 0.68

@jsiirola jsiirola merged commit 4e8e48d into Pyomo:main Apr 19, 2024
33 checks passed
@jsiirola jsiirola deleted the fix-nlv2-discrete-var-count branch April 19, 2024 00:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants