sequential set s = {1, 2, 3, ..., N} bounded by parameter N

Hi,

I am wondering whether it is possible to define a sequential set s =
{1, 2, 3, …, N} depending on an upper parameter N? In other words,
how do I formulate the naive

parameter N;
set s /1*N/;

so that gams understands it?

Joanna

\

Hi,

You may use the following

$IF NOT SET N $SET N ‘Default’

*Note replace ‘Default’ with an integer

PARAMETER N
/YourPreferredNumber/
;
SET s /1*%N%/;

This should work for you.

Destin



On Wed, May 30, 2012 at 11:21 AM, joanna wrote:

Hi,

I am wondering whether it is possible to define a sequential set s =
{1, 2, 3, …, N} depending on an upper parameter N? In other words,
how do I formulate the naive

parameter N;
set s /1*N/;

so that gams understands it?

Joanna


To post to this group, send email to gamsworld@googlegroups.com.
To unsubscribe from this group, send email to gamsworld+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/gamsworld?hl=en.

\

To post to this group, send email to gamsworld@googlegroups.com.
To unsubscribe from this group, send email to gamsworld+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/gamsworld?hl=en.