User Tools

Site Tools


gams:union_two_different_sets

How do I union two different sets

Find below an example:

set i / i1*i10 /,
     j / j1*j10 /,
     i_u_j / set.i, set.j /;

display i_u_j;

The trouble is that i and j need to be disjoint. Otherwise you get a compilation error about a redefined element when defining i_u_j. Moreover, i and j are not subsets of i_u_j. The following code will create a compilation error:

set i / i1*i10 /,
     j / j1*j10, i5 /,
     i_u_j / set.i, set.j /;

display i_u_j; 

Please also check unions in the GAMS User's Guide.

gams/union_two_different_sets.txt · Last modified: 2017/09/02 17:08 by support