'How can one optimize a multivariate function by differential_evolution
I would like to optimize a multivariate function by differential evolution using lambda function. Actually the parameters based on which I want to optimize the function are matrices each of which has a different dimension. this is my code:
R0= [[(0,1)]]
Q0=[[(0,1)]]
c0= (0,1)
beta0=[[(-6,9)]]
B0=[ (-2,2),(-2,2),(-2,2),(-2,2),(-2,2),(-2,2), (-2,2),(-2,2),(-2,2),(-2,2),(-2,2),(-2,2),(-2,2),(-2,2)]
B0=np.array([B0])
B0=B0.T
kal_=lambda R,Q,c,beta,B:myfunc(R,Q,c,beta,B,Y,X)
opt=scipy.optimize.differential_evolution(kal_(R0,Q0,c0,beta0,B0), maxiter=1000000,tol=1e-6)
Python returns the following error which is due to the bounds set as the initial values:
ValueError: setting an array element with a sequence.
Can anyone let me know what is wrong with the code?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
