Original ticket http://projects.scipy.org/scipy/ticket/1494 on 2011-08-13 by trac user scipydevwikiaccount, assigned to unknown.
Hello. I have run into a frustrating problem where scipy.optimize.fmin_bfgs will get stuck in an infinite loop. This problem has only shown up with a more recent version of scipy.
I have developed a very simple exmaple which demonstrates this problem by trying to minimize the function -1/e^x, for which the optimal value is at -infinity.
A simple program to reproduce the error:
import numpy,scipy,scipy.optimize
f=lambda x: -numpy.e**-x
fp=lambda x: -f(x)
x0=numpy.asarray([0])
x=scipy.optimize.fmin_bfgs(f,x0,fp)
print 'before: x=%s, after: x=%s' % (x0,x)
Using python 2.6, numpy 1.4.0, and scipy 0.7.2, the code successfuly finishs with a reasonably large negative value:
$ python crash.py
Warning: Desired error not necessarily achieveddue to precision loss
Current function value: -5184705528587058413568.000000
Iterations: 1
Function evaluations: 6
Gradient evaluations: 5
before: x=[0], after: x=[-50.]
Using python 2.7, numpy 1.6.1, and scipy 0.9.0, the code gets stuck in an infinite loop and never terminates.
Original ticket http://projects.scipy.org/scipy/ticket/1494 on 2011-08-13 by trac user scipydevwikiaccount, assigned to unknown.
Hello. I have run into a frustrating problem where scipy.optimize.fmin_bfgs will get stuck in an infinite loop. This problem has only shown up with a more recent version of scipy.
I have developed a very simple exmaple which demonstrates this problem by trying to minimize the function -1/e^x, for which the optimal value is at -infinity.
A simple program to reproduce the error:
Using python 2.6, numpy 1.4.0, and scipy 0.7.2, the code successfuly finishs with a reasonably large negative value:
$ python crash.py
Warning: Desired error not necessarily achieveddue to precision loss
Current function value: -5184705528587058413568.000000
Iterations: 1
Function evaluations: 6
Gradient evaluations: 5
before: x=[0], after: x=[-50.]
Using python 2.7, numpy 1.6.1, and scipy 0.9.0, the code gets stuck in an infinite loop and never terminates.