Subsets consisting of odd/even elements + compressing sets
Posted: Fri Aug 25, 2017 6:44 pm
Hi all,
I have a vector U(rr), where rr = /1*40/. I also have a set i(rr) = /1*20/, and would like to populate two vectors, U1(i) and U2(i), where U1(i) should contain the odd elements of U(rr) and U2(i) should contain the even elements of U(rr).
So far I have attempted using dynamic sets, i.e.
rreven(rr)$(mod(rr,2) = 0) = yes,
but I cannot correctly define vectors the U1 and U2 over set i = /1*20/. Is there any simple solution to this problem in GAMS?
Thanks in advance.
I have a vector U(rr), where rr = /1*40/. I also have a set i(rr) = /1*20/, and would like to populate two vectors, U1(i) and U2(i), where U1(i) should contain the odd elements of U(rr) and U2(i) should contain the even elements of U(rr).
So far I have attempted using dynamic sets, i.e.
rreven(rr)$(mod(rr,2) = 0) = yes,
but I cannot correctly define vectors the U1 and U2 over set i = /1*20/. Is there any simple solution to this problem in GAMS?
Thanks in advance.