Set limit as a predefined scalar

Hi,
I was trying to use a predefined scalar as the set’s upper limit. I wrote the following code:

SCALAR   N       number of vertices      /5/;
SET
         i       vertex index    /1*N/

I am getting following error:

Error 764 in C:\[dir]
Could not extract number in <element> * <element> list

Can anyone please help me to fix this issue.

Hi

For this you can use the $setlocal or $setglobal command which allows you to run your code with different values:

$setlocal n 5

SET
i vertex index /1*%n%/;

display i;

Now you can easily change this value by setting this parameter as an option:

gams mymodel --n=19

This will override n and use 19 instead of 5.

This can also be done in the Gamside

Cheers

Renger