As part of our constraints, we have \begin{align*} &\sum_{i=1}^{I}c_ix_i\ge y, \\ &\sum_{i=1}^{I}c_{i-1}x_i\le y, \end{align*} where $y\ge0,x_i\in\{0,1\}, \forall i$.
I am trying to code these two constraints in Julia and solve the problem using gurobi or cplex but we cannot define index $i=0$ so we don't have $c_0$ there.
How can I code this? I tried this
c = zeros(I+1)
for i = 1:I+1
c[i] = value
end
@variable(model, x[1:I], Bin)
@variable(model, y>=0)
But then there's a mismatch between variable and parameter index.
How should I correct this?