[SciPy-user] howto call optimize.brute()

Nils Wagner nwagner at iam.uni-stuttgart.de
Mon Oct 9 13:30:47 EDT 2006


On Mon, 9 Oct 2006 10:17:28 -0600
  "Spuhler, Peter" <pspuhler at ball.com> wrote:
> 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
> 
> 
> _______________________________________________
> SciPy-user mailing list
> SciPy-user at scipy.org
> http://projects.scipy.org/mailman/listinfo/scipy-user

I cannot reproduce your problem.
I am using
>>> scipy.__version__
'0.5.2.dev2247'
>>> import numpy
>>> numpy.__version__
'1.0.dev3292'


Nils
-------------- next part --------------
A non-text attachment was scrubbed...
Name: test_brute.py
Type: text/x-python
Size: 257 bytes
Desc: not available
URL: <http://mail.scipy.org/pipermail/scipy-user/attachments/20061009/c7b4b670/attachment.py>


More information about the SciPy-User mailing list