Sum function from t=2

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

Sum function from t=2

Post by pelorn » 4 months ago

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: 162
Joined: 3 years ago

Re: Sum function from t=2

Post by Fred » 4 months ago

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 months ago

Re: Sum function from t=2

Post by pelorn » 4 months ago

Thanks again Fred!

Post Reply