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!