How to write Difference Sign in GAMS?

Solver related questions
Post Reply
isinsuyildiz
User
User
Posts: 1
Joined: 2 years ago

How to write Difference Sign in GAMS?

Post 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,
Attachments
MicrosoftTeams-image (8).png
MicrosoftTeams-image (8).png (4.68 KiB) Viewed 3643 times
O'Jhene
User
User
Posts: 8
Joined: 2 years ago

Re: How to write Difference Sign in GAMS?

Post 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)
Fred
Posts: 372
Joined: 7 years ago

Re: How to write Difference Sign in GAMS?

Post 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
O'Jhene
User
User
Posts: 8
Joined: 2 years ago

Re: How to write Difference Sign in GAMS?

Post by O'Jhene »

Ah I see. That's interesting. Thanks!
Post Reply