[SciPy-user] howto call optimize.brute()
Spuhler, Peter
pspuhler at ball.com
Mon Oct 9 12:17:28 EDT 2006
I can't seem to get optimize.brute working
The following error function works for optimize.fmin_powell for example
Def _error(x,offset):
Error = x[0]**2 + x[1]**2 + offset
Return error
Optimize.fmin(_error,x0=[1,1],args=(10,))
But if I now try to use optimize.brute
Bounds = ((-10,10,0.1),(-10,10,0.1))
Optimize.brute(_error,ranges=bounds,args=(10,))
I get the following error. What am I missing?
C:\Python24\lib\site-packages\scipy\optimize\optimize.py in brute(func,
ranges,
args, Ns, full_output, finish)
1577 if (N==1):
1578 grid = (grid,)
-> 1579 Jout = vecfunc(*grid)
1580 Nshape = shape(Jout)
1581 indx = argmin(Jout.ravel())
C:\Python24\lib\site-packages\numpy\lib\function_base.py in
__call__(self, *args
)
619 nargs = len(args)
620 if (nargs > self.nin) or (nargs < self.nin_wo_defaults):
--> 621 raise ValueError, "mismatch between python function
inputs"\
622 " and received arguments"
623 if self.nout is None or self.otypes == '':
ValueError: mismatch between python function inputs and received
arguments
Thanks
-Peter
More information about the SciPy-User
mailing list