-
Notifications
You must be signed in to change notification settings - Fork 109
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
IPOPT now returns Lagrange multpliers using the same sign convention as SNOPT. #416
base: main
Are you sure you want to change the base?
Conversation
…ution. Added lagrange multipliers to IPOPT's output. Note that in the call to _createSolution we negate the multiplier values so that they are consistent with those returned by SNOPT. My understanding is that this is a matter of convention (due to the internal representations of the problems in the two optimizers).
Thanks for opening the PR! I also got curious and worked out a logic fix but you were quicker than me - see this comparison. I don't have strong opinions between that approach and just add a flag as you did, I actually like yours a bit more because it is more explicit. @lamkina do you have any suggestions here?
As you see from my branch, I also figured that the IPOPT convention is flipped and changed the sign of the multipliers, so I am 100% onboard with what you did. |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #416 +/- ##
===========================================
- Coverage 74.92% 63.30% -11.63%
===========================================
Files 22 22
Lines 3338 3338
===========================================
- Hits 2501 2113 -388
- Misses 837 1225 +388 ☔ View full report in Codecov by Sentry. 🚨 Try these New Features:
|
I'm not sure where the regression in coverage is coming in. As far as I can tell it's hitting all of the lines I added. It might be due to black reformatting a few of the things. |
11e0686
to
4cb9a90
Compare
You're right that my initial use of black was a little too agressive (no 120 char limit specification). I dialed that back so it only affected the files that I needed to change. I'm still failing codecov and would appreciate guidance on what you'd like me to do. |
Sorry I just noticed your issues with Codecov - you actually don't need to do anything there! Since the PR comes from a fork and not from |
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 verified that the missing tests pass locally, this looks good to me, thanks!
This is a bit of a philosophical question, but do we have references that show IPOPT uses a different sign convention from SNOPT? I vaguely recall SNOPT itself using the opposite sign of normal convention, but it's been a while. If we are modifying values that are coming out of the optimizers, this needs to be clearly documented. I'm not entirely against it, but this can easily confuse downstream users and create a mess. If we want to ensure that all Lagrange multipliers are consistent across optimizers, then I think what we need then is the following:
|
Purpose
Added lagrange multipliers to IPOPT's output. Note that in the call to _createSolution we negate the multiplier values so that they are consistent with those returned by SNOPT. My understanding is that this is a matter of convention (due to the internal representations of the problems in the two optimizers).
The lagrange multipliers in the string representation of the solution are now correct.
Resolves #415
Expected time until merged
This change is not urgent.
Type of change
Testing
I've added a test to hs071 that verifies that the lagrange multipliers returned by SNOPT and IPOPT are correct.
Checklist
flake8
andblack
to make sure the Python code adheres to PEP-8 and is consistently formattedfprettify
or C/C++ code withclang-format
as applicable