Hello,
I am new at GAMS, so this might seems trivial, but I haven´t been able to solve this problem.
I have the following code to retrieve data from a .gdx file.
*1st
Parameters
evfb_1(endw, acts, reg) !!this is the variable that contains the data
evfb_la(aez, acts, reg)
;
loop(endw$aez(endw),
evfb_la(aez, acts, reg) = evfb_1(endw, acts, reg)
);
where the set aez(endw) is a subset of endw. Basically I want to make the variable evfb_la(aez, acts, reg) with only a subset of data from evfb_1(endw, acts, reg). But for some reason, in the new variable it copies all but one region.
Instead, if I do like this
*2nd
loop((aez,acts,reg),
evfb_la("AEZ1", acts, reg) = evfb_1("AEZ1", acts, reg);
evfb_la("AEZ2", acts, reg) = evfb_1("AEZ2", acts, reg);
.
.
.
)
;
it does copies all observations for all the new parameters, but it is really cumbersome as there are many elements in both sets “endw” and “acts”.
I have tried the following alternatives (below)
—> Alternatives 1,2,3,4,5,6 copies all but one region. Even even though the set reg is the same for both parameters. I tried doing $onEps to maybe avoid some 0 values being the problem, but to no avail, it drops one region completely
—> Alternatives 7,8,9 show error 149
—> I also tried implicit set definition, by not declaring set aez as a subset of set endw, and then doing “evfb_la(aez<,acts,reg)”. But the problem persists. In the .gdx the set endw shows all the aez elements, but I keep having the same problem with the parameter, that is not copying all values.
*1st try to make it shorter
$offtext
$ontext
loop(endw$(aez(endw)),
evfb_la(aez, acts, reg) = evfb_1(endw, acts, reg);
)
;
;
$ontext
*$offtext
*2nd try*****************************************************
loop((reg,acts,endw),
evfb_la(aez, acts, reg) = evfb_1(endw, acts, reg)
);
$ontext
*3rd try*****************************************************
loop(reg,
loop(acts,
loop(endw$(aez(endw)),
evfb_la(aez, acts, reg) = evfb_1(endw, acts, reg)
)))
;
*$offtext
*4th try*****************************************************
loop(endw,
if(aez(endw),
evfb_la(aez, acts, reg) = evfb_1(endw, acts, reg)
)
)
;
$ontext
*$offtext
*5th try*****************************************************
loop((reg,acts,endw),
if(aez(endw),
evfb_la(aez, acts, reg) = evfb_1(endw, acts, reg)
)
)
;
*$offtext
*6th try*****************************************************
loop(endw,
if(aez(endw),
evfb_la(aez, acts, reg) = evfb_1(endw, acts, reg)
)
)
;
*$offtext
*7th try*****************************************************
*$offtext
if(aez(endw),
evfb_la(aez, acts, reg) = evfb_1(endw, acts, reg);
);
*$offtext
*8th try*****************************************************
*$offtext
evfb_la(aez, acts, reg) = evfb_1(endw, acts, reg);
*$offtext
*9th try*****************************************************
*$offtext
$offtext
evfb_la(aez, acts, reg) = evfb_1(endw, acts, reg)
I would appreciate any insights on why it copies all data but one region and in general on how to avoid these types of problems.
Thank you