Python Scipy.optimize最小化中的多个变量
我的问题与先前提出的问题有关。我正在努力寻找答案Python Scipy.optimize最小化中的多个变量,python,scipy,Python,Scipy,我的问题与先前提出的问题有关。我正在努力寻找答案 def simulator(X,Y,Z): return X+Y+Z def f(params): X,Y,Z = params A = simulator(params) return A bound = [(10,30), (10, 30), (10, 30)] x0 = (10,10,10) result = minimize(f,x0,bounds=bound) 我犯了一个错误 simulator() m
def simulator(X,Y,Z):
return X+Y+Z
def f(params):
X,Y,Z = params
A = simulator(params)
return A
bound = [(10,30), (10, 30), (10, 30)]
x0 = (10,10,10)
result = minimize(f,x0,bounds=bound)
我犯了一个错误
simulator() missing 2 required positional arguments: 'Y' and 'Z'.
在现实中,模拟器fx要复杂得多,但我面临着与此简化代码相同的问题。如评论中所述
A = simulator(X, Y, Z)
A=模拟器(X,Y,Z)
。。。