Skip to content

Conversation

sadavis1
Copy link
Contributor

@sadavis1 sadavis1 commented Sep 3, 2025

Fixes # n/a

Summary/Motivation:

#3699 created a new api_version() method that can be queried to determine which api version a solver object supports. Use that method to validate a solver object argument in multiple_bigm.py, rather than using isinstance in a questionable way.

Along the way I noticed that contrib LegacySolverWrapper and appsi LegacySolverInterface class instances were returning V2 and APPSI as their api versions which is not correct, so I added an override to api_version() there.

Changes proposed in this PR:

  • Improve argument validation
  • Override api_version() in wrapper classes as presenting the v1 api is their whole purpose

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.

@blnicho blnicho requested review from mrmundt and emma58 September 9, 2025 18:41
Copy link
Contributor

@mrmundt mrmundt left a comment

Choose a reason for hiding this comment

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

We had a quick chat about this at the dev call, and the implementation is perfectly fine. I just had a residual question that I wanted answered.

Copy link

codecov bot commented Sep 9, 2025

Codecov Report

❌ Patch coverage is 77.77778% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 89.31%. Comparing base (613f2ad) to head (3b00f60).
⚠️ Report is 4 commits behind head on main.

Files with missing lines Patch % Lines
pyomo/contrib/appsi/base.py 66.66% 1 Missing ⚠️
pyomo/gdp/plugins/multiple_bigm.py 66.66% 1 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main    #3717   +/-   ##
=======================================
  Coverage   89.31%   89.31%           
=======================================
  Files         896      896           
  Lines      103670   103675    +5     
=======================================
+ Hits        92589    92594    +5     
  Misses      11081    11081           
Flag Coverage Δ
builders 29.10% <55.55%> (+0.01%) ⬆️
default 85.92% <77.77%> (?)
expensive 35.86% <55.55%> (?)
linux 86.96% <77.77%> (-2.09%) ⬇️
linux_other 86.96% <77.77%> (-0.01%) ⬇️
osx 83.10% <77.77%> (+<0.01%) ⬆️
win 85.18% <77.77%> (+<0.01%) ⬆️
win_other 85.18% <77.77%> (+<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.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@mrmundt mrmundt merged commit a9ce9b4 into Pyomo:main Sep 9, 2025
34 of 35 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.

4 participants