在使用 scipy.optimize.minimize 和 trust-constr 方法时,我得到了这个 UserWarning:
scipy\optimize\_hessian_update_strategy.py:187: UserWarning: delta_grad == 0.0. Check if the approximated function is linear. If the function is linear better results can be obtained by defining the Hessian as zero instead of using quasi-Newton approximations. 'approximations.', UserWarning)
我有一个线性函数,所以我想尝试将粗麻布设置为零。但这是如何工作的?我尝试了使用“hess = None”作为参数的最简单方法。好吧,一个糟糕的尝试。
这是调用求解器的行:
solution = scopt.minimize(minimizeFunction,initialGuess ,method='trust-constr', constraints=cons,options={'disp':True,'verbose':3},bounds=bnds)