Scipy optimizations methods select nan for input parameter

﹥>﹥吖頭↗ 提交于 2019-12-25 08:47:01

问题


I've a mathematical function by 4 parameters input. Also there are bounds in parameters:

a = [0,2]
b = [-1,1]
c = [eps, inf]
d = [-inf, inf]

I want to minimize the final value and find best parameter in function. In Scipy there are just 3 functions to support bounding optimization problems as 'TNC', 'SLSQP' and 'L-BFGS-B' [refrence: optimizations].

The problem is when SLSQP and sometimes other methods select nan for parameters and thus, result of function goes to nan for value. It's happend suddenly, for e.g. in step i-1 run normal and return real value, but for step i input parameters is nan and so final results goes to nan. From then on, inputes and outputs is nan while maximum iterations is reached!

Where is the issue?

The summery code is here:

bnds = [(eps, 2.), (-1.,1.), (eps, np.inf), (-np.inf, np.inf)]
scipy.optimize.fmin_slsqp(myFunc, params, bounds=bnds)

or

scipy.optimize.minimize(myFunc, params, method='SLSQP', bounds=bnds)

Because of there are no real solution for this issue, I was forced to change my problem!

来源:https://stackoverflow.com/questions/34963248/scipy-optimizations-methods-select-nan-for-input-parameter

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!