Hi, I have a trouble to initialize a parameter.
Let’s say I have a parameter A(a, b, *) and I would like to initialize the whole parameter with 0.
I put various column on *, for example, A(a, b, “Column 1”), A(a,b, “Column 2”) … A(a, b, “Column n”)
I tried A(a, b, *) = 0; but it brings a error message “Set identifier or quoted element expected”.
Is there any way to initialize parameter A to 0?
Best,
Hi,
You cannot have a set “a” and a Parameter “A”. GAMS is not case sensitive. Initializing a parameter explicitly to zero is usually also not needed because 0 is the default value. But let’s assume you want to set the parameter to some non-zero value. When you do not specify a domain explicittly for the third dimension at the declaration of the parameter, you should make sure to understand how the universal set * works. You can use the universal set in assignments by introducing an alias for it, e.g.
set a / a1*a3 /
b / b1*b3 /
c / column1, column2, bla, blubb /
;
Parameter p(a,b,*);
alias(*,u);
p(a,b,u) = 5;
display p;
Be sure to check the output of the display statement to understand the impact of using the universal set.
I hope this helps!
Fred
Thanks for your answer!
It really helped me a lot.
Jake