[SciPy-user] Getting started with optimize.fmin_l_bfgs_b

Nils Wagner nwagner at mecha.uni-stuttgart.de
Wed Jun 29 06:27:40 CDT 2005

```Christian Kristukat wrote:

> Nils Wagner wrote:
>
>> Traceback (most recent call last):
>>  File "bfgs_b.py", line 8, in ?
>>    best, val, d = optimize.fmin_l_bfgs_b(func, guess, bounds=bounds)
>>  File
>> "/usr/local/lib/python2.4/site-packages/scipy/optimize/lbfgsb.py",
>> line 183, in fmin_l_bfgs_b
>>  File
>> "/usr/local/lib/python2.4/site-packages/scipy/optimize/lbfgsb.py",
>>    f, g = func(x, *args)
>> TypeError: unpack non-sequence
>>
>> How can I resolve the problem ?
>
>
> Look at the docstring of l_bfgs_b - func is expected to return the
>
> Regards, Christian
>
> _______________________________________________
> SciPy-user mailing list
> SciPy-user at scipy.net
> http://www.scipy.net/mailman/listinfo/scipy-user

Hi Christian,

This my modified program

from scipy import *

def func(x):
return x[0]-x[1]

def fprime(x):
return array(([1,-1]))

guess = 1.2, 1.3
bounds = [(-2.0,2.0), (-2.0,2.0) ]
best, val, d = optimize.fmin_l_bfgs_b(func, guess, fprime,
print 'Position of the minimum',best, 'and its value',val

Is it somehow possible to visualize (e.g. by matplotlib) the history of
the optimization process ?

Nils

```