我運行以下代碼來運行xfoil,以獲得機翼中權重的最佳值。ValueError:fmin_l_bfgs_b中要解壓縮的值太多
def four_dim_opt(x0, weight_limits, cl, file_path, xfoil_path):
opt_out = fmin_l_bfgs_b(run_xfoil_wcl, x0, args = (cl, file_path, xfoil_path), bounds = weight_limits, epsilon = 0.01, approx_grad = True)
return opt_out
其中run_xfoil_wcl是阻力值的functionreturning係數(浮點)。
我不斷收到的錯誤是:
Traceback (most recent call last):
File "<pyshell#13>", line 1, in <module>
four_dim_opt(x0, weight_limits, 1.2, file_path, xfoil_path)
File "H:/appliedlab4 - Copy(2).py", line 157, in four_dim_opt
opt_out = fmin_l_bfgs_b(run_xfoil_wcl, x0, args = (cl, file_path, xfoil_path), bounds = weight_limits, epsilon = 0.01, approx_grad = True)
File "C:\Python27\lib\site-packages\scipy\optimize\lbfgsb.py", line 166, in fmin_l_bfgs_b
l,u = bounds[i]
ValueError: too many values to unpack
什麼是'weight_limits'?你似乎將太多的價值傳遞給它。 – Blender 2013-03-02 03:56:21