[SciPy-user] Scipy optimize fmin_l_bfgs_b gives me an obscure error

Nils Wagner nwagner@iam.uni-stuttgart...
Thu Jul 10 01:06:43 CDT 2008


On Wed, 9 Jul 2008 19:17:58 -0400
  "Isaul Vargas" <isaulv@gmail.com> wrote:
> Here is how my function looks like:
> 
> xt =  scipy.optimize.fmin_l_bfgs_b(obj_grad_func, xcur, 
>args =
> (b,h,Beta,R,wR,wh,muh, alpha_b, beta_b, BN, sp), maxfun 
>= 1000)
> 
> 
> the args are mostly arrays except for BN and SP which 
>are dicts that contain
> various flags.
> 
> In the debugger, I tried the following:
> xcur is a 1,3 array with the values 1,1,0.
> I check the flags of xcur and I see it is not fortran 
>contiguous.
> I do a copy: xcur2 = xcur.copy('f')
> and now I get this error message:
> *** error: failed in converting 10th argument `wa' of 
>_lbfgsb.setulb to
> C/Fortra
> n array
> 
> There is no variable 'wa' in any of my functions, so I 
>am not sure why this
> failing.
> 
> Also, how do I setup the bounds, I am not clear on how 
>to set it. I have a
> list of upper bounds (an array of 3 values) and a list 
>of lower bounds Not
> sure how to set them.

For lower and upper bounda:

bounds = [(2000.,2100.),(1800.,1850.),(1600.,1630.)]
x_lbl,f,d = optimize.fmin_l_bfgs_b(func1, x0, fprime=None, 
args=(), approx_grad=1, bounds=bounds)

Nils


More information about the SciPy-user mailing list