An indexed collection of sets can be read from a single range in the spreadsheet, using a similarly indexed collection of tables. As an example, for your "set A1 {p in NP}" with the given data, the spreadsheet range could be named setA1, and could arranged like this:
Columns A1_P1_1 and A1_P1_2 contain the pairs that are in set A1["P1"], and columns A1_P2_1 and A1_P2_2 contain the pairs that are in set A1["P2"]. (It happens that A1["P1"] and A1["P2"] have the same number of members, but that is not necessary.) The corresponding table statement defines a table for each p in NP:
table setA1 {p in NP} IN "amplxl" "setofsets.xlsx":
A1[p] <- [("A1_"&p&"_1"),("A1_"&p&"_2")];
String expressions like ("A1_"&p&"_1") are used to specify the column names, which are different for each value of p.) Since there is an indexed collection of tables, a for-loop is used to read them:
for {p in NP} read table setA1[p];Since A1[p] is a set of pairs, your "param T_LINKS_F1 {p in NP, A1[p]}" is indexed over a set of triples. Thus the spreadsheet table for this param should have 3 key columns and a data column:
and the table statement is straightforward:
table T_LINKS_F1 IN "amplxl" "setofsets.xlsx": [NP,A1_1,A1_2], T_LINKS_F1;I have attached files for this example, which you can adapt to your full model.