limited sums

Problems with syntax of GAMS
Post Reply
anonyms14225
User
User
Posts: 2
Joined: 3 years ago

limited sums

Post by anonyms14225 »

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
User avatar
Renger
Posts: 639
Joined: 7 years ago

Re: limited sums

Post by Renger »

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

Code: Select all


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

Renger
____________________________________
Enjoy modeling even more: Read my blog on modeling at The lazy economist
anonyms14225
User
User
Posts: 2
Joined: 3 years ago

Re: limited sums

Post by anonyms14225 »

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.
User avatar
Renger
Posts: 639
Joined: 7 years ago

Re: limited sums

Post by Renger »

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
____________________________________
Enjoy modeling even more: Read my blog on modeling at The lazy economist
Post Reply