Python Scipy Optimization.minimize using SLSQP showing maximized results
问题 I am learning to optimize a multivariate constrained nonlinear problem with scipy.optimize.minimize ,but received strange results. My problem: minimize objfun objfun x*y constraints 0<=x<=5, 0<=y<=5, x+y==5 My code: from scipy import optimize def func(x): return x[0]*x[1] bnds=((0,100),(0,5)) cons=({'type':'eq','fun':lambda x:x[0]+x[1]-5}) x0=[0,0] res= optimize.minimize(func,x0,method='SLSQP',bounds=bnds,constraints=cons) Received results: status: 0 success: True njev: 2 nfev: 8 fun: 6