Open kbarros opened 5 months ago
See also https://github.com/JuliaNLSolvers/LineSearches.jl/pull/174
cc @mateuszbaran seems like it's another problem related to the flatness detection
Thanks, this looks very similar, I will move the discussion there.
Note that the final value c=0.055... is not a zero point of the derivative dϕ.
It's not expected to be. Essentially all modern optimizers perform approximate line search. See, e.g., the Wolfe conditions.
That said, returning α = 0
is not OK.
I found a case where the ConjugateGradient method of Optim.jl terminates early, at a non-stationary point, without raising an error. After some digging, the problem seems associated with LineSearches. I can't tell whether the actual bug is in in LineSearches, or in the way that Optim calls the Hager-Zhang line search. Your help in diagnosing this would be greatly appreciated.
Below is a simplified example illustrating how Hager-Zhang fails to converge correctly, given the (effective) parameters that are provided by Optim.jl:
The printed output of this code is:
Note that the final value
c=0.055...
is not a zero point of the derivativedϕ
.The HZ line search terminates early because this "flatness" condition is hit: https://github.com/JuliaNLSolvers/LineSearches.jl/blob/master/src/hagerzhang.jl#L282-L285
However, it's not clear to me whether the underlying problem is the HZ flatness condition, or the way that the call to
method.linesearch!
is made in Optim: https://github.com/JuliaNLSolvers/Optim.jl/blob/master/src/utilities/perform_linesearch.jl#L41-L60).Is it OK that the values of
phi_0, dphi_0
were calculated foralpha == 0
and notstate.alpha == 0.2
?To fix the bug, therefore, it seems that there are two possibilities:
method.linesearch!
, the values ofphi_0, dphi_0
should be recalculated for the newly guessedstate.alpha
.Thanks in advance.