swapping indices in a variable

Problems with syntax of GAMS
Post Reply
e.a.alaboudi
User
User
Posts: 1
Joined: 3 months ago

swapping indices in a variable

Post by e.a.alaboudi » 3 months ago

hello everyone,

I have the following lines in my model:
set
i/1*400/;
alias(i,j);
binary variable x(i,j,k);
con(i,k)..sum((j)$(ord(j) ne ord(i)),x(i,j,k))=E= sum((j)$(ord(j) ne ord(i)),x(j,i,k)) ;

as you can see, I reversed the order of (i)&(j) in the variable x(i,j,k) to become x(j,i,k). for this constraint, I need to place (i) once in the first index for the first summation and in the second index for the second summation.
my question: is this syntax acceptable? in if not, what should I do to tackle this problem?

Thank you,

Fred
Posts: 144
Joined: 2 years ago

Re: swapping indices in a variable

Post by Fred » 3 months ago

Hi,

Not sure what you find "acceptable" but at least this is correct GAMS syntax (which you could easily figure out by the fact that there is no compilation error).

Best,
Fred

Post Reply