The main problem is the optimization of the filling of a tank, filling it in cheap periods and extracting in expensive periods to sell. I am using Python and gurobipy.
I am not able to model this constraint: the daily injection should be less than an expression depending on the previous day's filling.
\begin{align}X_i&\le C_i*(\sum_{j=0}^{j=i-1} X_j )\end{align}
I have tried with this expression:
m.addConstrs((x[i]<= C[i]*v1) for i in index)
v1=sum(x[j] for j in range(1,i-1))
But it does not work. Note that $C_i$ is a constant.