scipy.optimize get's trapped in local minima. What can I do?
问题 from numpy import *; from scipy.optimize import *; from math import * def f(X): x=X[0]; y=X[1] return x**4-3.5*x**3-2*x**2+12*x+y**2-2*y bnds = ((1,5), (0, 2)) min_test = minimize(f,[1,0.1], bounds = bnds); print(min_test.x) My function f(X) has a local minima at x=2.557, y=1 which I should be able to find. The code showed above will only give result where x=1 . I have tried with different tolerance and alle three method: L-BFGS-B, TNC and SLSQP. This is the thread I have been looking at so