In gams you have a set with numbers you would think that you can use them as “real” numbers, e.g. you can do calculations with them. But if you try to do so you’ll got error messages. Set elements can not be referred to directly as numbers.
But there is a special function i.val that you can use in these cases. Here comes an example to make it clear:
set i /1, 20, 300, 4000/; parameter p_tmp(i) 'to store i as values'; $ontext *** this would generate error *** 148 Dimension different - The symbol is referenced with more/less *** indices as declared p_tmp(i) = 3*i; display p_tmp; $offtext p_tmp(i) = i.val/100; display p_tmp;
Advertisement