[SciPy-User] fmin_bfgs stuck in infinite loop

Pauli Virtanen pav@iki...
Tue Oct 25 06:40:23 CDT 2011

25.10.2011 13:30, josef.pktd@gmail.com kirjoitti:
> Is there an explanation for task? What does task[:2] == 'FG' mean?

Check the minpack source files for dcscrch.f

> I tried the condition separately.
>         if np.isnan(phi1) or np.isneginf(phi1):
>             break
>         if task[:2] == asbytes('FG'):
> I also added the isneginf check, because I think there is also the
> possibility of an infinite loop at phi = -inf.
> I would still feel safer if there is a maxiter in the line search, as
> in the python version, scalar_search_wolfe2

Transforming the while loop to a for-loop could be a reasonable
alternative solution,

	for j in xrange(maxiter):
	    ... return indicating wolfe search failed ...

> a separate issue:
> bfgs does not have an xtol, which means we don't get any indication if
> only one or some of the parameters go to inf.

The best thing would be to have all the optimizers deal with termination
conditions in the same way.


Pauli Virtanen

More information about the SciPy-User mailing list