Python: Scipy: brute optimization -


i getting error

typeerror: objfunc() missing 1 required positional argument: 'q'

when try brute optimize objective function.

what doing wrong?

def objfunc(p,q):     return p**3-2**q;  scipy.optimize import brute grid = (slice(1, 300, 1),slice(1, 300, 1)) solution = brute(objfunc, grid, finish=none,full_output = true) `enter code here`*typeerror: objfunc() missing 1 required positional argument: 'q'*''' 

thank you!

you need correct objfunc. range q high , may change prevent overflows

def objfunc(grid):     p, q = grid     return p**3-2**q;  grid = (slice(1, 300, 1),slice(1, 30, 1)) 

Comments

Popular posts from this blog

python - Operations inside variables -

Generic Map Parameter java -

arrays - What causes a java.lang.ArrayIndexOutOfBoundsException and how do I prevent it? -