【问题标题】:Multiple variables in Scipy.optimize minimizeScipy.optimize 中的多个变量最小化
【发布时间】:2021-04-26 18:49:31
【问题描述】:

我的问题与之前提出的this question 有关。我正在尝试遵循答案。

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) ...

标签: python scipy


【解决方案1】:

正如在 cmets 中发布的,

A = simulator(X, Y, Z)

【讨论】:

    猜你喜欢
    • 2021-04-08
    • 2018-12-15
    • 1970-01-01
    • 2019-09-17
    • 2019-10-13
    • 2020-03-16
    • 1970-01-01
    • 1970-01-01
    • 2014-06-08
    相关资源
    最近更新 更多