Page 1 of 1

How to write Difference Sign in GAMS?

Posted: Fri Mar 04, 2022 9:45 am
by isinsuyildiz
Hello guys,

We are working on our graduation thesis which is called 'Network Planning Location Model for Turkey Railway Freight Transportation'. We try to set our model on GAMS. While writing the model on GAMS, we could not write the difference sign (\) in GAMS. In the attachment, you can see the picture of the difference sign with the equation l E C \ {j}. I will be appreciated if you help us.

Kind regards,

Re: How to write Difference Sign in GAMS?

Posted: Thu Mar 31, 2022 1:42 am
by O'Jhene
Hi,

Assuming your set C contains the elements {i,j,k,l}, and j is just an element. Then, you can write the following:

Code: Select all

sum(C$(not C('j')), function_here)

Re: How to write Difference Sign in GAMS?

Posted: Thu Mar 31, 2022 7:55 am
by Fred
O'Jhene wrote: 2 years ago Hi,

Assuming your set C contains the elements {i,j,k,l}, and j is just an element. Then, you can write the following:

Code: Select all

sum(C$(not C('j')), function_here)
This is not exactly doing what was asked for. If C('j') exists this will result in not summing over any elements in C. I think what isinsuyildiz is looking for is teh following

Code: Select all

sum(C$(not sameas(C,'j')), function_here)
I hope this helps!

Fred

Re: How to write Difference Sign in GAMS?

Posted: Thu Mar 31, 2022 2:39 pm
by O'Jhene
Ah I see. That's interesting. Thanks!