Python scipy.minimize

63 views Asked by At

I have a question about python scipy.minimize, I know if

x0 = np.array([0.5, 0])

then I can set the bound like this

bnds = ((0, None), (0, None))

but if my x0 has 1000 terms, and I want each of them to be in range (0,5), how should I set my bound?

1

There are 1 answers

0
a_guest On

You can pass an instance of scipy.optimize.Bounds:

scipy.optimize.minimize(..., bounds=Bounds(0, 5))