You may try something like this
Code: Select all
$if not set maxt $set maxt 10
Set t "time slots" /1* %maxt%/;
display t
To change the value of
maxt from 10 to another number (i.e. 50), please add
–maxt=50 to the command line (see
double dash parameters).
Please also keep in mind that set elements are not numbers - even if you choose labels that look like numbers. In fact, my recommendation is to avoid using set elements that look like numbers since it can cause confusion in different circumstances. If you write
Code: Select all
Set t /t1 * t5/;
Set i /i1 * i5/;
you won't get the two confused. If you write
you'll be surprised to find that the order of elements in set
j is
5, 6, 7, 8, 3, 4. That's because the ordering comes from the collection of all unique set elements in a GAMS program - and the order is defined by when they appear.