Does anyone have any guidance on what’s best practice for non-linear root search? (in this case, relatively small, smooth systems of equations expressed as code that should be AD-able) It looks like NLsolve.jl is a good option, but it hasn’t had a commit in two years. Is it the best option or has the landscape changed?
If NLsolve doesn’t work for you, I have a thin wrapper of Ipopt called StandaloneIpopt.jl that has an ipopt_nlsolve(f, init; kwargs...) function. You put in your function in the format f(buf, x) where buf is something you update with your system of equations at x. The package is officially registered so you can just ]add it, but I haven’t really written much docs for it, so maybe if this is appealing to you and something isn’t clear then just shoot me a note and I’ll clarify and add some documentation to the README at least.
Under the hood, it works with the trick of solving the dummy objective problem of min 0 but with constraints f_j(x) = 0, j=1,...,k for your k equations. Which seems weird, but it’s a trick I first saw in the KNITRO docs and it seems to work pretty well via Ipopt too. You could probably use JuMP with this trick too, although maybe @odow will chime in and say not to do that. If your functions are simple enough that you can write them in the format that JuMP likes, I bet that would be a better option.
If you have KNITRO, they actually have a least-squares mode that works at least as well and uses Gauss-Newton. KNITRO.jl has an example file for nonlinear least-squares mode that I can point you if you are interested and can’t find it with google.
Thanks @cgeoga, I haven’t had any trouble with NLsolve yet, I just wanted to check that in a fast moving ecosystem it’s still the right thing to try first, and it sounds like it is. If I do have trouble I’ll look at StandaloneIpopt.
The idea of building a JuMP model is interesting and maybe feasible, but again, not what I’d try first.