-
Notifications
You must be signed in to change notification settings - Fork 560
add cuopt direct solver #3620
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
base: main
Are you sure you want to change the base?
add cuopt direct solver #3620
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #3620 +/- ##
==========================================
- Coverage 89.40% 89.38% -0.03%
==========================================
Files 909 910 +1
Lines 105541 105804 +263
==========================================
+ Hits 94364 94574 +210
- Misses 11177 11230 +53
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
mrmundt
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We are working on making cuopt available in our testing infrastructure; can you please add tests to this PR?
|
@Iroy30 - We've been able to make cuopt available on our internal testing machines. Can you please add tests to this PR? |
5dbf9dd to
6f64094
Compare
|
@mrmundt Thanks! We have added tests by enabling testing cuopt with LP and MILP capabilities in tests/solvers.py. Let us know if:
The following is the testing output I get relevant to cuOpt |
| t0 = time.time() | ||
| self.solution = cuopt.linear_programming.solver.Solve(self._solver_model) | ||
| t1 = time.time() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is fine, but just so you're aware, we have this lovely little utility called TicTocTimer that you may want to consider using: https://pyomo.readthedocs.io/en/latest/api/pyomo.common.timing.TicTocTimer.html
|
@mrmundt What do you think about including this solver interface in pyomo.contrib.solvers? Would it make sense to pull-in new solver interfaces there, since that's where the new solver API is evolving? |
@whart222 - I am evenly split. Because we are still messing with what the new solver interfaces are going to actually do / how they will handle input and present output, I don't know if we want to put "new" solvers there or just "well-established" ones that we can robustly test / really know what they are supposed to do and return. |
|
@Iroy30 - I forgot to post this last week, but all of the failures are of the variety: |
|
@Iroy30 - Two more things:
|
Co-authored-by: Miranda Mundt <[email protected]>
|
@jsiirola Did the instructions fix the cuOpt import? |
| def __init__(self, **kwds): | ||
| kwds["type"] = "cuoptdirect" | ||
| super(CUOPTDirect, self).__init__(**kwds) | ||
| self._version = cuopt.__version__.split('.') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the problem line. If cuopt isn't actually available, then this panics. You should probably wrap this in a try block or move it into its own function, e.g.:
try:
self._version = cuopt.__version__.split('.')
except DeferredImportError:
self._version = None
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, upon chatting in the dev call more about this just now, this should probably just be moved into its own function, not at all in the init, because if it's in the init, it will import cuopt unconditionally no matter what.
|
Seems to run successfully now in the branch pipeline . Could we trigger CI @mrmundt |
|
OK. We are getting close. cuopt finally appears to be running on Jenkins. We are seeing 9 failures: |
Fixes #3626
Summary/Motivation:
Add cuOpt math optimization (includes LP and MILP) solver backend to Pyomo so users can solve pyomo models with cuOpt
Changes proposed in this PR:
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: