Page 1 of 1

Set limit as a predefined scalar

Posted: Thu Feb 15, 2018 5:39 pm
by Dewan
Hi,
I was trying to use a predefined scalar as the set's upper limit. I wrote the following code:

Code: Select all

SCALAR   N       number of vertices      /5/;
SET
         i       vertex index    /1*N/
I am getting following error:

Code: Select all

Error 764 in C:\[dir]
Could not extract number in <element> * <element> list
Can anyone please help me to fix this issue.

Re: Set limit as a predefined scalar

Posted: Fri Feb 16, 2018 7:11 am
by Renger
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
Image

Cheers

Renger