Is it possible to use a variable as an index in linear programming ? For example
$\sum_{t=y}^{C}x_{t}= a$
where y is a variable (and also $x_{t}$; C and a are constants)
Is it possible to use a variable as an index in linear programming ? For example
$\sum_{t=y}^{C}x_{t}= a$
where y is a variable (and also $x_{t}$; C and a are constants)
Add binary variables $z_t$, where you want $z_t=1$ if term $t$ is included in the sum. The constraintthen becomes $\sum_t x_t z_t = a$. The product $x_t z_t$ can be linearized (see the comment on this page).
What remains is modelling the implications $y \geq t+1 \Rightarrow z_t=0$ and $y \leq t \Rightarrow z_t=1$. Those are equivalent to $y\leq t \vee z_t=0$ and $y \geq t+1 \vee z_t=1$. The linear equivalents are $y \leq t + (1-z_t) C$ and $y\geq t+1 - z_tC$.