Sum function from t=2

Problems with modeling
Post Reply
pelorn
User
User
Posts: 14
Joined: 4 years ago

Sum function from t=2

Post 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
Fred
Posts: 372
Joined: 7 years ago

Re: Sum function from t=2

Post 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
pelorn
User
User
Posts: 14
Joined: 4 years ago

Re: Sum function from t=2

Post by pelorn »

Thanks again Fred!
Post Reply