JuliaNLSolvers / NLsolve.jl

Julia solvers for systems of nonlinear equations and mixed complementarity problems

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

only_fj! version requests f and j separately at the same x

rleegates opened this issue · comments

As the title suggests, using method newton, no linesearch. I could search the code for where this occurs, if needed. Since in my case requesting only f and then only j at the same x from fj is less efficient than requesting both simultaneously, this generates significant overhead. With fj! generating some debugging output, I get:

Iter     f(x) inf-norm    Step 2-norm 
------   --------------   --------------
┌ Warning: Requested both stiffness and RHS.
└ @ Solvers ...
     0     3.751768e+03              NaN
┌ Warning: Requested only RHS. norm(x) = 190.759526036454
└ @ Solvers ...
     1     3.523550e+00     6.360172e-02
┌ Warning: Requested only stiffness. norm(x) = 190.759526036454
└ @ Solvers ...
┌ Warning: Requested only RHS. norm(x) = 190.72736454878574
└ @ Solvers ...
     2     2.828951e-02     1.358687e-03
┌ Warning: Requested only stiffness. norm(x) = 190.72736454878574
└ @ Solvers ...
┌ Warning: Requested only RHS. norm(x) = 190.727259268085
└ @ Solvers ...
     3     2.609981e-07     1.455108e-08
┌ Warning: Requested only stiffness. norm(x) = 190.727259268085
└ @ Solvers ...
┌ Warning: Requested only RHS. norm(x) = 190.72726075663638
└ @ Solvers ...
     4     1.096478e-09     2.914448e-12

Is there some reason why this is the intended behavior?

That's not the intended behavior, no. I can try to look into it.

But some code to go by would be nice :)

Okay, I got it.

...imho, it's the static line-search.

It's because the value is already checked in the line search, yes. So the cheapest thing is to only calculate the Jacobian next time around (I mean given the current setup). I've changed it here #243 you can try that branch