-
Notifications
You must be signed in to change notification settings - Fork 14
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
Levenberg-Marquart + SLSQP for Proximity #394
Conversation
super cool! |
adf8c3a
to
5fed186
Compare
Do you have scripts/notes of the origin of this implementation? |
never mind, found it in #389 |
one thing to note in general is that we probably had to call |
On the other hand, it would have iterated through this order and reordered it, so maybe it is irrelevant |
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.
Awesome addition! I think we can set Newton max_iter a bit lower than LM. I've added some discussion points.
src/proximity/proximity.cpp
Outdated
if (modified_marquart) { | ||
lhs(i, i) = 2 * spline_gradient_AAt(i, i) * (1 + lambda); | ||
} else { | ||
lhs(i, i) = 2 * (spline_gradient_AAt(i, i) + lambda); |
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.
@jzwar current J
removes this 2 *
, but can you double check this? With 2*, I thought it should be:
lhs(i, i) = 2 * (spline_gradient_AAt(i, i) + lambda); | |
lhs(i, i) = (2 * (spline_gradient_AAt(i, i)) + lambda; |
|
||
// compute || F(x + dX) ||^2 then rho | ||
ComputeCostAndDerivatives(data, 0); // computes J and everything on the way | ||
const double rho = |
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.
@jzwar you think it is crucial to keep both neu
and alt
metrics?
License notice included in src commit: 5a6f935 https://github.com/scipy/scipy/blob/main/scipy/optimize/slsqp/slsqp_optmz.f
I have no problem, but codespell does
Initial file created with f2c (https://www.netlib.org/f2c/). Modified to be standalone (without f2c.h)
If you get a chance, I'd appreciate if you can take a look at |
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 took a look at it and have some minor comments.
I have to admit that I did not check every single line of code in detail, but I took a few hours to check closely and to me it looks good, I didn't spot anything that seems completely wrong. Therefore, I approve! 🚀
Co-authored-by: Daniel Wolff <[email protected]>
main return first, then additional ones. This applies to GuessMinusQuery, J, dJdu, d2Jdu2
Thanks for incorporating the changes, from my point of view this can be merged! 🚀 |
Queries outside of the spline sometimes does not return 0.0 convergence_norm. However, slsqp exits with 0 if J itself converges.
Thanks for the review @danielwolff1 ! |
Overview
Adds Levenberg-Marquart and SLSQP for proximity. Current implementation wouldn't work for some situations (see #389). Source for SLSQP is from current scipy's fortran version. To avoid difficulties of fortran-compiler-setup in CI systems, the source is translated to
c
usingf2c
. Then, removed some static variables and add const keywords.Now, the search looks like this:
Also, SLSQP can incorporate bounds. Nice.
Addressed Issues
Checklists