How to write this constraint in GAMS Code? Topic is solved

Problems with syntax of GAMS
Post Reply
Gaucho
User
User
Posts: 10
Joined: 4 years ago

How to write this constraint in GAMS Code?

Post by Gaucho »

Hi,

I have a very basic question as I am not an experienced User in GAMS, but I couldn't figure this one out.
Does anyone know, how to write this in GAMScode? My problem is to include the j<>i correctly.

Best regards
Attachments
2019-09-30 15_12_12-Raviv2013_Article_StaticRepositioningInABike-sha.pdf - Adobe Acrobat Reader DC.jpg
2019-09-30 15_12_12-Raviv2013_Article_StaticRepositioningInABike-sha.pdf - Adobe Acrobat Reader DC.jpg (7.21 KiB) Viewed 4728 times
Manassaldi
User
User
Posts: 118
Joined: 7 years ago
Location: Rosario - Argentina

Re: How to write this constraint in GAMS Code?

Post by Manassaldi »

Hi, I guess you have to define the set, subset and alias.

for example:

Code: Select all

sets
i /i1*i10/
v /v1*v10/
N0(i) /i1,i3,i4,i5/
;
alias(i,j);
eq(i,v)$N0(i).. sum(j$(N0(j) and ord(j) ne ord(i)),x(i,j,v)) =e= sum(j$(N0(j) and ord(j) ne ord(i)),x(j,i,v))
User avatar
Renger
Posts: 639
Joined: 7 years ago

Re: How to write this constraint in GAMS Code?

Post by Renger »

Hi
You could also use

Code: Select all

$(not sameas(i,j)) 
instead of

Code: Select all

$(ord(i) ne ord(j))
.
Cheers
Renger
____________________________________
Enjoy modeling even more: Read my blog on modeling at The lazy economist
Gaucho
User
User
Posts: 10
Joined: 4 years ago

Re: How to write this constraint in GAMS Code?

Post by Gaucho »

I thank both of you for your quick and helpful answers!
Post Reply