[SciPy-user] problem with fmin_powell

Sebastian Walter sebastian.walter@gmail....
Mon Apr 27 05:52:37 CDT 2009


The source of the full example would be a lot more helpful...
My bet is that something is wrong with your objective function.

TypeError: unsupported operand type(s) for -: 'str' and 'str'
might possibly be the result of an objective function that uses global
variables that are set differently in the context of fmin_powell.
But that's just a wild guess.


On Mon, Apr 27, 2009 at 11:49 AM,  <etrade.griffiths@dsl.pipex.com> wrote:
> Hi
>
> I am running an optimisation program using fmin_powell with the following statement:
>
> vals = scipy.optimize.fmin_powell(my_obj.ix_func,ivalues,maxiter=my_obj.maxiter,full_output=True)
>
> Scipy makes around 10 calls to the function my_obj.ix_func then crashes with these error messages:
>
> Traceback (most recent call last):
>  File "D:\AlunG\2008\convergence\test_script.py", line 383, in <module>
>    vals = scipy.optimize.fmin_powell(my_obj.ix_func,ivalues,maxiter=my_obj.maxiter,full_output=True)
>  File "C:\Python25\lib\site-packages\scipy-0.6.0.0006-py2.5-win32.egg\scipy\optimize\optimize.py", line 1852, in
> fmin_powell
>    fval, x, direc1 = _linesearch_powell(func, x, direc1, tol=xtol*100)
>  File "C:\Python25\lib\site-packages\scipy-0.6.0.0006-py2.5-win32.egg\scipy\optimize\optimize.py", line 1737, in
> _linesearch_powell
>    alpha_min, fret, iter, num = brent(myfunc, full_output=1, tol=tol)
>  File "C:\Python25\lib\site-packages\scipy-0.6.0.0006-py2.5-win32.egg\scipy\optimize\optimize.py", line 1549, in
> brent
>    brent.optimize()
>  File "C:\Python25\lib\site-packages\scipy-0.6.0.0006-py2.5-win32.egg\scipy\optimize\optimize.py", line 1432, in
> optimize
>    tmp1 = (x-w)*(fx-fv)
> TypeError: unsupported operand type(s) for -: 'str' and 'str'
>
> I have no problems if I use fmin instead of fmin_powell.  I also tried passing the argument direc as a unit vector
> ([1.,1.,1.,1.] in this case) but have the same problem.  I am using Python 2.5, SciPy 0.6, NumPy 1.5.2.  All
> suggestions gratefully received
>
> Alun Griffiths
>
>
>
>
> -------------------------------------------------
> Visit Pipex Business: The homepage for UK Small Businesses
>
> Go to http://www.pipex.co.uk/business-services
>
> _______________________________________________
> SciPy-user mailing list
> SciPy-user@scipy.org
> http://mail.scipy.org/mailman/listinfo/scipy-user
>


More information about the SciPy-user mailing list