User Tools

Site Tools


gams:union_two_different_sets

This is an old revision of the document!


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 Expanded GAMS User's Guide

IMPRESSUM / LEGAL NOTICEPRIVACY POLICY gams/union_two_different_sets.1442572480.txt.gz · Last modified: 2015/09/18 12:34 by Jarungjit Parnjai