I'm beginner in GAMS. So, my question relates to use of variables in conditions. I supposed, that it's Programming Flow Control Features, but I cannot to find an example with variables, not parameters.
In my task I have only one set (t) at the start of the code. In the "Equations" block GAMS executes variable D(t) for several values of (t), for example, for t=1..5. I would like to extract only positive values of D(t). For example, I have executed D(t): 3, -2, 5, -4, 1 I want to have D2(t): 3, 0, 5, 0, 1
I know, that it's not allowed to use dollar condition with variables. Also I cannot use loop+if construction for the same reason. For example, I tried to write something like this, but got a lot of errors (D2(t) was declared as it should):
Equation1(t).. loop (t,
if ((D(t) < 0),
D2(t) = D(t) - D(t);
);
);
So, how can I add my condition and where should I place the code?