# [SciPy-User] using scipy.optimize.fmin_slsqp and setting bounds=(None, None)

Peter Halverson halverson.peter@yahoo....
Mon Oct 19 16:46:27 CDT 2009

```I'm not sure if this is user error or an actual bug. When I attempt to set my bounds in fmin_slsqp the option bounds =[(-10,10),(0,None)] is not recognized Scipy crashes with

IndexError                                Traceback (most recent call last)

C:\Documents and Settings\All Users\Documents\Python\<ipython console> in <module>()

C:\Python25\lib\site-packages\scipy\optimize\slsqp.pyc in fmin_slsqp(func, x0, eqcons, f_eqcons, ieqcons, f_ieqcons, bounds, fprime, fprime_eqcons, fprime_ieqcons, args, iter, acc, iprint, full_output, epsilon)
244             if bounds[i][0] > bounds[i][1]:
245                 raise ValueError, \
--> 246                 'SLSQP Error: lb > ub in bounds[' + str(i) +']  ' + str(bounds[4])
247
248     xl = array( [ b[0] for b in bounds ] )

IndexError: list index out of range

My code:

import numpy as np
import scipy as sp
from scipy.optimize import fmin_slsqp as fmincon

#The purpose of this script is
# minimize x0+x1^2
# where a and b are constants
# and 0<x0
# and x1-x2>0

def fitfun(x):
t=x[0]+x[1]**2
return t

def confun(x):
return (x[0]-x[1])

bnds =[(-10,10),(0,None)]
guess=[0.5,0.5]

fmincon(fitfun,guess,ieqcons=[confun],bounds=bnds)

If this is a bug I will report it to the appropriate places. If its not a bug please help me sort it out.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/scipy-user/attachments/20091019/c3bd9794/attachment.html
```