Hello,

I have been working on a project in GAMs and encountered an issue and was hoping that dynamic sets would help me deal with this:

1.) So I have a .gdx file of data for four regions, indexed A, B, C and D. Within each region there are 3 groups (like household types, 3 income categories etc.,), A1,A2,A3, B1,B2,B3, C1,…

2.) The .gdx data, in a simplified form, looks this:

income(“”,“”,“A1”)=10;

income(“”,“”,“A2”)=20;

…

Where the last element indexes household type.

So I have 1 row in the .gdx for each variable (income, expenditure etc.,), which is pre-populated with a designated household set, designated set “h”. (so “income(”“,”",h), where h contains A1-D4)

3.) When I try to run the model, it uses the entire h set, which is /A1, A2, A3, B1, B2, B3, C1, C2, C3, D1, D2, D3/; so it runs the model with all 12 household groups (which is not what I want)

4.) instead, I want to run the model via a selection mechanism, say: id=1 for A region, id=2 for B region, so-on-and-so-forth. So when I tell GAMs id=1, it only runs the model for A1, A2 and A3.

My question is as follows: is there a way to tell GAMs to drop elements of the “h” set (12 elements), depending on some external parameter? I tried using dynamic sets, but it doesn’t allow me to selectively read-in a subset of “h”, because it is a pre-defined set (inside the .gdx data file). In a nutshell, I’m reading in data from 12 different agents (set “h”), however, I want to only use 3 of them at a time in the model, is there a good way to modify pre-existing sets (read in from a .gdx file)? I’ve tried dynamic sets, but it won’t allow me to modify a pre-existing set, I think. Thank you!