'Boundary in Powell method Scipy
Let's minimise the function
f =lambda x: (x+1)**2
using Powell method in scipy
If we use
scipy.optimize.minimize(f, 1, method='Powell', bounds=None)
the return is
direc: array([[1.]])
fun: array(0.)
message: 'Optimization terminated successfully.'
nfev: 20
nit: 2
status: 0
success: True
x: array(-1.)
i.e. the minimum is at -1 as it should. If we provide the bounds
scipy.optimize.minimize(f, 1, method='Powell', bounds=[(0,2)])
the return is again
direc: array([[1.]])
fun: array(0.)
message: 'Optimization terminated successfully.'
nfev: 20
nit: 2
status: 0
success: True
x: array(-1.)
which is now WRONG! The correct answer should be 0. It is like if the bounds are not taken int account. I am using scipy '1.4.1' and python 3.7.6. Someone has any clue?
Solution 1:[1]
I want to add that I have noticed as well that the Powell method tends to explore out of bounds parameters.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Valentin Formont |
