Set definition variable number of elements

Problems with syntax of GAMS
Post Reply
Nikou
User
User
Posts: 33
Joined: 4 years ago

Set definition variable number of elements

Post by Nikou »

Hello All

Is there a way to get this right?

Code: Select all

SCALAR Horizon /100/ ;
SCALAR StepSize  /7/  ;

SCALAR NPeriods ;
NPeriods = Ceil(Horizon/StepSize) ;


SET periods /1*NPeriods/ ;
What I would like to have is a set of which the number of elements is set through a variable.
So, setting the value for Horizon and StepSize should set the number of elements of periods.
User avatar
Renger
Posts: 639
Joined: 7 years ago

Re: Set definition variable number of elements

Post by Renger »

Hi Nikou

Just have a look here.

Cheers
Renger
____________________________________
Enjoy modeling even more: Read my blog on modeling at The lazy economist
Nikou
User
User
Posts: 33
Joined: 4 years ago

Re: Set definition variable number of elements

Post by Nikou »

Thank you very much!
Post Reply