[SciPy-user] optimize.fmin_l_bfgs_b problem
Marek Wojciechowski
mwojc at p.lodz.pl
Wed Jun 11 16:15:48 EDT 2008
Nils Wagner wrote:
> On Wed, 11 Jun 2008 22:00:05 +0200
> Marek Wojciechowski <mwojc at p.lodz.pl> wrote:
>> Nils Wagner wrote:
>>
>>> On Mon, 9 Jun 2008 15:50:53 +0200
>>> Marek Wojciechowski <mwojc at p.lodz.pl> wrote:
>>>> Hi!
>>>> The following command:
>>>> optimize.fmin_l_bfgs_b(lambda x: x[0]**2, [-1.],
>>>>iprint=1)
>>>> causes an error and breaks the python session with the
>>>>following output:
>>>>
>>>> RUNNING THE L-BFGS-B CODE
>>>>
>>>> * * *
>>>>
>>>> At line 2647 of file scipy/optimize/lbfgsb/routines.f
>>>> Internal Error: printf is broken
>>>> Machine precision =
>>>>
>>>> This occurs on scipy-0.6.0 and python 2.4 under Gentoo
>>>>Linux. Is this the
>>>> known bug?
>>>>
>>>> Greetings,
>>>> --
>>>> Marek Wojciechowski
>>>
>>> I get
>>>
>>>>>> optimize.fmin_l_bfgs_b(lambda x: x[0]**2, [-1.],
>>>>>>iprint=1)
>>> RUNNING THE L-BFGS-B CODE
>>>
>>> * * *
>>>
>>> Machine precision = 2.220E-16
>>> N = 1 M = 10
>>> This problem is unconstrained.
>>>
>>> At X0 0 variables are exactly at the bounds
>>> Traceback (most recent call last):
>>> File "<stdin>", line 1, in <module>
>>> File
>>> "/data/home/nwagner/local/lib/python2.5/site-packages/scipy/optimize/lbfgsb.py",
>>> line 205, in fmin_l_bfgs_b
>>> f, g = func_and_grad(x)
>>> File
>>> "/data/home/nwagner/local/lib/python2.5/site-packages/scipy/optimize/lbfgsb.py",
>>> line 156, in func_and_grad
>>> f, g = func(x, *args)
>>> TypeError: 'numpy.float64' object is not iterable
>>>
>>>>>> scipy.__version__
>>> '0.7.0.dev4420'
>>
>> It seems that my bug is corrected in development
>>versions of scipy.
>> Exception you obtained results probably from new layout
>>of lbfgsb
>> optimizer. I think the following should work:
>>
>> optimize.fmin_l_bfgs_b(lambda x: (x[0]**2, 2*x[0]),
>>[-1.], iprint=1)
>>
> No.
>>>> optimize.fmin_l_bfgs_b(lambda x: (x[0]**2, 2*x[0]), [-1.], iprint=1)
> RUNNING THE L-BFGS-B CODE
>
> * * *
>
> Machine precision = 2.220E-16
> N = 1 M = 10
> This problem is unconstrained.
>
> At X0 0 variables are exactly at the bounds
> Traceback (most recent call last):
> File "<stdin>", line 1, in <module>
> File
> "/usr/local/lib64/python2.5/site-packages/scipy/optimize/lbfgsb.py",
> line 199, in fmin_l_bfgs_b
> isave, dsave)
> TypeError: failed to initialize
> intent(inout|inplace|cache) array -- input must be array
> but got <type 'numpy.float64'>
>
> Cheers,
> Nils
The last chance :) :
optimize.fmin_l_bfgs_b(lambda x: (x[0]**2, 2*x[0]), array([-1.]), iprint=1)
--
Marek Wojciechowski
More information about the SciPy-User
mailing list