Bug in Broydn?


bucolicwind
12-13-2009, 10:06 AM
see the lines in red.

if (maxval(abs(fvec(:))) < TOLF) then
check=.false.
RETURN
end if
if (check) then
if (restrt .or. maxval(abs(g(:))*max(abs(x(:)), &
1.0_Dp)/max(f,0.5_Dp*n)) < TOLMIN) RETURN
restrt=.true.
else
restrt=.false.
if (maxval((abs(x(:)-xold(:)))/max(abs(x(:)), &
1.0_Dp)) < TOLX) RETURN
end if
end do
########################
To my knowledge, the codes in red are at least theoretically improper, although they do not seem to have any influence on the computing results. I think the gradient vector should be recalculated at the new point obtained by line search strategy when it is used as an convergence criterion.

Saul Teukolsky
12-13-2009, 10:13 PM
Looks like you are referring to the Fortran 90 version (although the same logic occurs in the other versions). I don't think it's necessary to recompute the gradient. The test detects the case where you get spurious convergence because of a "zero" gradient, and if this happens the gradient tends to stay small nearby. It would be interesting to see if anyone can find an example that shows a problem.

Thanks for writing.
Saul Teukolsky

bucolicwind
12-14-2009, 12:14 AM
Looks like you are referring to the Fortran 90 version (although the same logic occurs in the other versions). I don't think it's necessary to recompute the gradient. The test detects the case where you get spurious convergence because of a "zero" gradient, and if this happens the gradient tends to stay small nearby. It would be interesting to see if anyone can find an example that shows a problem.

Thanks for writing.
Saul Teukolsky

Thank you Mr. Teukolsky for your timely reply.
The convergence criterion is really marginal compared with other criterions and it is hardly ever activated for most problems if TOLMIN is small enough. But if the difference between the gradient of f at xp and that at xc is large (that seldom happens as you said above), it will have some influence on the final result, which happens to occur in my program where the subroutine broydn must be called repeatedly. But anyway, the effect can be ignored for my problem.

As illustrated by Schnabel in the book "Numerical Methods for Unconstrained Optimization and Nonlinear Equations", the convergence test should be totally disregarded when secant methods are adopted to solve the linear subproblem.