Page 1 of 1

swapping indices in a variable

Posted: Wed Apr 10, 2019 2:09 am
by e.a.alaboudi
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,

Re: swapping indices in a variable

Posted: Wed Apr 10, 2019 3:54 pm
by Fred
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