Change Equation over time

I am trying to update the DICE2013 model in GAMS. I want to solve parts of it recursively.

If I have an equation like the one below, how can I tell GAMS that after, say 5 periods t, it should update the equation?

I(t) =E= S(t) * Y(t);

So that after 5 periods, the function for example becomes:

I(t) =E= S(t) * AY(t);

Thank you

Hi,

You can have two different equations, one for t<=5 and one for t>=6.
Assuming that t is an ordered set (https://www.gams.com/latest/docs/UG_OrderedSets.html), this can be done as follows:

equation eq1(t), eq2(t);
[...]
eq1(t)$(ord(t)<=5).. I(t) =E= S(t) * Y(t);
eq2(t)$(ord(t)>=6).. I(t) =E= S(t) * AY(t);

I hope this helps!

Fred

Hi Fred,

Thanks for your answer. It should be the same equation though as I try to maximize this one equation. Any idea?

Thanks heaps

You can just move the dollar condition into the equation body.

eq(t).. I(t) =E= S(t) * (Y(t)$(ord(t)<=5) + AY(t)$(ord(t)>=6)) ;

I hope this helps!

Fred

Cool, thank you!