Skip to content

Conversation

@michaelbynum
Copy link
Contributor

@michaelbynum michaelbynum commented Aug 12, 2025

Summary/Motivation:

This PR refactors the gurobi interfaces to achieve two goals:

  • reduce duplicate code
  • use the new contrib.observer package

Changes proposed in this PR:

  • create a directory for gurobi now that there are 4 files
  • create a base class for all of the interfaces that use gurobipy, making the direct and persistent interfaces more consistent (e.g., tc_map, postsolve, solve, mipstart)
  • modify the persistent interface to use the contrib.observer package
  • add mipstart functionality to gurobi direct and gurobi minlp
  • add a minimum gurobipy version to the direct interface (addMConstr was not added until version 9)
  • simplified some of the persistent interface

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.

@codecov
Copy link

codecov bot commented Aug 13, 2025

Codecov Report

❌ Patch coverage is 91.10915% with 101 lines in your changes missing coverage. Please review.
✅ Project coverage is 89.25%. Comparing base (4696230) to head (93bb118).

Files with missing lines Patch % Lines
...contrib/solver/solvers/gurobi/gurobi_persistent.py 89.24% 83 Missing ⚠️
...ontrib/solver/solvers/gurobi/gurobi_direct_base.py 94.00% 16 Missing ⚠️
...omo/contrib/solver/solvers/gurobi/gurobi_direct.py 97.05% 2 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main    #3698   +/-   ##
=======================================
  Coverage   89.24%   89.25%           
=======================================
  Files         909      911    +2     
  Lines      105536   105551   +15     
=======================================
+ Hits        94190    94212   +22     
+ Misses      11346    11339    -7     
Flag Coverage Δ
builders 29.15% <24.29%> (+0.05%) ⬆️
default 85.82% <90.66%> (?)
expensive 35.64% <24.29%> (?)
linux 86.70% <91.02%> (-2.30%) ⬇️
linux_other 86.70% <91.02%> (+<0.01%) ⬆️
osx 82.88% <91.02%> (+<0.01%) ⬆️
win 84.44% <91.02%> (+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.

@michaelbynum michaelbynum mentioned this pull request Nov 12, 2025
@michaelbynum michaelbynum changed the title [Depends on #3695] Observer gurobi refactor Observer gurobi refactor Nov 12, 2025
@michaelbynum michaelbynum requested a review from emma58 November 12, 2025 17:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Todo

Development

Successfully merging this pull request may close these issues.

4 participants