scipy.optimize.lsq_linear bounds error

Viewed 2688

I am trying to jsut the following formula:

http://docs.scipy.org/doc/scipy/reference/generated/scipy.optimize.lsq_linear.html#scipy.optimize.lsq_linear

I have the following code but it will not accept the bounds for 6 seperate variables it will only accept one tuple which makes the bounds the same for all variables.

## cut benchmark out of data
benchmark_ser = data_df.ix[:,0]
##  get out the stocks data
stocks_df = data_df.ix[:,1:]

## create/get bounds
bds = (0,.2) # <- i want to change this line 
             #    to something that will provide 
             #    a bound for each variable like 
             #    [(0,.1),(0,.2),(0,.5),(0,.6)]

wgt_arr = sp.optimize.lsq_linear(stocks_df, benchmark_ser, bds)

I get the following error currently:

ValueError: 'bounds' must contain 2 elements.

Thanks

1 Answers
Related