Reputation: 49
I'm trying to work with SciPy optimize.minimize usign several variables and I found a great explanation in: Structure of inputs to scipy minimize function in the case when the obective function is of the kind f(x,y) and the parameter to be optimizated is "x". But a question arises: What if my objective function is of the kind f(x,y,z,u,v) and I want to optimze with respect to "y" and "u" (provided that f returns a scalar).
Upvotes: 0
Views: 1407
Reputation: 9726
Just create a new function with target variables going first in the list of parameters:
def g(y, u, x, z, v):
return f(x, y, z, u, v)
(or use an analogous lambda).
Upvotes: 1