[SciPy-user] bounds with optimize.leastsq
Mon Mar 2 14:23:21 CST 2009
Is there a way to set bounds on variables when using optimize.leastsq. I've found optimize.fmin_l_bfgs_b but that unfortunately does not work when approx_grad=True. I get an error:
/home/rw247/lib/python/scipy/optimize/optimize.pyc in approx_fprime(xk, f, epsilon, *args)
615 for k in range(len(xk)):
616 ei[k] = epsilon
--> 617 grad[k] = (f(*((xk+ei,)+args)) - f0)/epsilon
618 ei[k] = 0.0
619 return grad
ValueError: setting an array element with a sequence.
Is there another function I should be looking at?
More information about the SciPy-user