Complement of set Topic is solved

Problems with modeling
Post Reply
mh.akbari
User
User
Posts: 5
Joined: 4 years ago

Complement of set

Post by mh.akbari »

Hello
Is it possible to define complement of a set in gams?
Thanks
User avatar
Renger
Posts: 639
Joined: 7 years ago

Re: Complement of set

Post by Renger »

Hi
Yes this is possible as follows

Code: Select all

set all  'Overall set'  /i1*i10/,
     s1(all) 'Subset of overall set' /i1,i2, i9,i10/,
     s2(all) 'Complement set';
     
 s2(all)$(not s1(all)) = YES;
 
 display s2;
gives the following

Code: Select all

----      7 SET s2  Complement set

i3,    i4,    i5,    i6,    i7,    i8
I hope this helps
Renger
____________________________________
Enjoy modeling even more: Read my blog on modeling at The lazy economist
Post Reply