How to write Difference Sign in GAMS?

Solver related questions
Post Reply
isinsuyildiz
User
User
Posts: 1
Joined: 9 months ago

How to write Difference Sign in GAMS?

Post by isinsuyildiz » 9 months ago

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 2114 times

O'Jhene
User
User
Posts: 8
Joined: 8 months ago

Re: How to write Difference Sign in GAMS?

Post by O'Jhene » 8 months 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)

Fred
Posts: 323
Joined: 6 years ago

Re: How to write Difference Sign in GAMS?

Post by Fred » 8 months ago

O'Jhene wrote:
8 months 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: 8 months ago

Re: How to write Difference Sign in GAMS?

Post by O'Jhene » 8 months ago

Ah I see. That's interesting. Thanks!

Post Reply