2

I have three sets, I and J and K, I know that for defining a subset in GAMS I should write it this way, I2(I) when set I2 is a subset of set I

The problem is that the third set, Set K, is a subset of both set I and J, and I don't know how to code that in GAMS.

Thanks in advance :)

PS Someone with enough reputation create a GAMS tag please, cause there isn't anything related to this subject in the list.

Serj-Tm
  • 16,581
  • 4
  • 54
  • 61
Sepideh Gh
  • 97
  • 6

1 Answers1

0

If I and J are disjoint you can have

set I / i1*i10 /,
    J / j1*j10 /,
    I_U_J / set.I, set.J /,
    K(I_U_J) / i1, i4, j3, j6 /;

If they are not disjoint the above code will give an error and you can, instead, do

set I_U_J / i1*i10 /,
    I(I_U_J) / i1*i7 /,
    J(I_U_J) / i3*i10/,
    K(I_U_J) / i4*i8/;
David Prentiss
  • 548
  • 1
  • 6
  • 16