Page 1 of 1

Sum function from t=2

Posted: Thu Jun 06, 2019 5:43 pm
by pelorn
Hi there,

How can I use the sum function only from the second or later period (t=2) instead of all t? sum(t, periodutility(t))

Cheers

Re: Sum function from t=2

Posted: Fri Jun 07, 2019 1:11 pm
by Fred
Assuming that t is an orderd set (https://www.gams.com/latest/docs/UG_OrderedSets.html), you could use the ord operator:

Code: Select all

 sum(t$(ord(t)>=2), periodutility(t))
I hope this helps!

Fred

Re: Sum function from t=2

Posted: Fri Jun 07, 2019 2:08 pm
by pelorn
Thanks again Fred!