0

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?

desertnaut
  • 57,590
  • 26
  • 140
  • 166

1 Answers1

0

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

scipy.optimize.minimize(..., bounds=Bounds(0, 5))
a_guest
  • 34,165
  • 12
  • 64
  • 118