-
Notifications
You must be signed in to change notification settings - Fork 557
New KNITRO direct solver interface #3707
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?
Conversation
611fb3b
to
0d7a162
Compare
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #3707 +/- ##
==========================================
+ Coverage 89.31% 89.34% +0.03%
==========================================
Files 896 906 +10
Lines 103687 104446 +759
==========================================
+ Hits 92609 93319 +710
- Misses 11078 11127 +49
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:
|
Hi @eminyouskn - okay, so, the tests are running but a large number of them are failing. Here is part of the stacktrace:
Most of the failures are just tolerance problems / the tolerance needs to be loosened. |
One-off failures:
Second one-off:
|
Thanks @mrmundt for the report. I didn’t run these tests locally since I didn’t have NumPy installed, and in that case, the tests are skipped. I’ll make sure to check them before pushing code from now on. I do have a question: is there a way to adjust the tolerance for all these tests at once? Ideally, we’d only change it for Knitro, but I imagine that might be more complicated. Regarding the two remaining failures, I’ve already fixed the one related to the objective. However, I’m not sure how to address the stale one, it’s not clear to me what exactly that test is supposed to check. |
@mrmundt Thanks for your comments. I’ve addressed the majority of them. For two of your comments, I left my original implementation and added my reasoning. If you feel my explanations are not convincing, I’m open to adjusting the code accordingly. |
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.
I swear, I am almost done leaving comments. This is looking great. I found one uncaught typo and have a couple of suggestions. Also, I noticed that you don't use a logger
anywhere. Not saying you have to, but you might consider doing so for any helpful messages / debugging for users' benefit?
Co-authored-by: Miranda Mundt <55767766+mrmundt@users.noreply.github.com>
Thanks @mrmundt for the quick and thorough review. As you mentioned, I didn’t use the logger, everything requiring user attention is either handled directly or raised an error, in which case the higher-level code is responsible for communicating it to the user. |
However, your point about debugging is valid. I need to consider whether there are parts that should be logged specifically for debugging purposes. |
@mrmundt One of the two failing tests doesn’t seem related to Knitro. For the other one, could you share the output so I can work on fixing it? |
Yup, this one should be an easy fix:
Just update |
Thanks @mrmundt for the report. I’d prefer not to change the test since it should pass as is. I believe I found the cause of the failure, so I’ll add a fix. |
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.
@eminyouskn - I realized one thing is definitely missing! Can you please update the docs to include knitro? https://github.com/Pyomo/pyomo/blob/main/doc/OnlineDocs/explanation/experimental/solvers.rst
@mrmundt done! |
* - KNITRO | ||
- ``knitroampl`` | ||
- ``knitro_direct`` |
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.
Isn't it just called knitro_direct
in both SolverFactories?
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.
Nope the old interface used AMPL to read and write the file so it was called knitroampl
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.
That isn't the intent of this table, though! The table is meant to show "how to access V2 interface." So, for example, you see that for ipopt
, you call either ipopt_v2
if you are using the legacy SolverFactory, but just ipopt
if you are using the new SolverFactory.
For this one, it'd be accessed the same way, no matter which SolverFactory: knitro_direct
. If someone accesses knitroampl
, they are getting the old interface.
Fixes NA
Summary/Motivation:
This PR introduced a new KNITRO direct solver interface.
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: