Hi,

I have a binary variable y(i,j,k) and i want to add this constraint:

y(i,j,k)+y(i,j,k+1)+y(i,j,k+2) =l= 1; for all i’s and j’s.

For example

y(1,1,1)+y(1,1,2)+y(1,1,3)<=1;

I’m new to GAMS, sorry if that’s a rather silly question

Hi,

I have a binary variable y(i,j,k) and i want to add this constraint:

y(i,j,k)+y(i,j,k+1)+y(i,j,k+2) =l= 1; for all i’s and j’s.

For example

y(1,1,1)+y(1,1,2)+y(1,1,3)<=1;

I’m new to GAMS, sorry if that’s a rather silly question

Hi

Looks fine. However, notice that if you are at the last k and the one before that the constraint will read

```
last k
y(i,j,k)=l= 1;
* Last k - 1
y(i,j,k)+y(i,j,k+1) =l= 1;
```

Cheers

Renger

Thank you for this heads up! But, my question was unclear, i meant to ask how to add “for all i’s & j’s” to my model. Normally i use sum((i, j), y(i, j, k,)) but since it is limited i don’t know how to do it.

Your question is still not clear to me. The equation is for all i,j,k. I don’t understand what you mean by summing is a problem.

Cheers

Renger