Using "infinite bounds" in scipy.optimize.minimize?
python, scipy
Solution
The `scipy.optimize.minimize`'s documentation states that:
bounds : sequence, optional
Bounds for variables (only for L-BFGS-B, TNC and SLSQP). `(min, max)` pairs for each element in `x`, defining the bounds on that parameter. Use `None` for one of min or max when there is no bound in that direction.
So you don't have to represent infinity, just pass `None`. Passing the floating point infinity may not work as intended.
The standard way to represent infinity in python is using `float('inf')` for plus infinity and `float('-inf')` for minus infinity. These represent the standard IEEE 754 infinity values.
`numpy` also offers `numpy.inf`.
Problem
I need to maximize a 3 variable function, which is defined in the following space: ]0, ∞[ x ]1, ∞[ x [0, ∞[ I am going to use SLSQP algorithm from scipy.optimize.minimize and I was thinking it should be done defining bounds for the function. But I don't know how to write "infinity" in python or this limits. Maybe it should be done using, then, constraints, but I couldnt find a way to define it. I would be glad if I could get some help doing this. Thanks in advance!