[AMPL 24578] define set in another set

Hi all,
I have a problem regarding defining two sets, in particular:
1- I need to define I_dt for each t, where inside each I_dt I need to put a set of flight, for example I_d1= flight1, flight2, flight3 for t=1, I_d2=flight4, flight5 for t=2 note that I_d1 and Id2 do not have the same dimension, so this is the first problem i have
2- Once i have defined I_dt for each t I need to colllect them in a set T_d, in this way T_d={I_d1,I_d2,…,I_dn}

thanks all

You can define I_d as an indexed collection of sets, and then define T_d as the union of all those sets. For example, you could have this in your model,

set T;
set I_d {T};
set T_d = union {t in T} I_d[t];

and then this as your data:

set T := 1 2 ;
set I_d[1] := flight1 flight2 flight3 ;
set I_d[2] := flight4 flight5 ;

To confirm that the result is what you want, you can use an AMPL “display” command to view the membership of the sets:

ampl: display I_d, T_d;
set I_d[1] := flight1 flight2 flight3;
set I_d[2] := flight4 flight5;
set T_d := flight1 flight2 flight3 flight4 flight5;

thank you, now it works.