splinepy icon indicating copy to clipboard operation
splinepy copied to clipboard

Levenberg-Marquart + SLSQP for Proximity

Open jzwar opened this issue 1 year ago • 7 comments

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 using f2c. Then, removed some static variables and add const keywords.

Now, the search looks like this:

Initial guess
|
Newton
|
Converged? -- yes -- return
|
No
|
Reset initial guess, max_iterations *= 5
|
SLSQP
|
Converged? -- yes -- return
|
No
|
Reset initial guess, max_iterations *= 5
|
LM

Also, SLSQP can incorporate bounds. Nice.

Addressed Issues

  • fixes #389
  • Sometimes, newton iterations does not converge
  • Sometimes, we needed to sample a lot of points for k-d tree
  • Sometimes, we really want to get correct values at any cost.

Checklists

  • [ ] Documentations are up-to-date.
  • [ ] Added example(s)
  • [ ] Added test(s)

jzwar avatar Mar 11 '24 14:03 jzwar

super cool!

j042 avatar Mar 11 '24 16:03 j042

Do you have scripts/notes of the origin of this implementation?

j042 avatar Apr 26 '24 13:04 j042

never mind, found it in #389

j042 avatar Apr 26 '24 15:04 j042

one thing to note in general is that we probably had to call system.ResetRowOrder(); at each iteration.

j042 avatar Apr 26 '24 15:04 j042

one thing to note in general is that we probably had to call system.ResetRowOrder(); at each iteration.

On the other hand, it would have iterated through this order and reordered it, so maybe it is irrelevant

j042 avatar Apr 26 '24 15:04 j042

If you get a chance, I'd appreciate if you can take a look at proximity.hpp / proximity.cpp @danielwolff1 :)

j042 avatar May 03 '24 10:05 j042

Thanks for incorporating the changes, from my point of view this can be merged! 🚀

danielwolff1 avatar May 04 '24 16:05 danielwolff1

Thanks for the review @danielwolff1 !

j042 avatar May 06 '24 14:05 j042