assign parameter value using gams
Posted: Mon May 17, 2021 9:29 am
Hello,
I want to assign the row value of 2D parameter to 1D parameter as follows:
Here, I can do as follows:
However. I will not be knowing j1 or j2 apriori. Instead, I will be only knowing ord(j).
For instance, I will have to assign Rf('j1' , i) to A(i) if ord(j) = 1.
I can also use if else loop, but can any one tell me, if I can directly use ord(j) to assign appropriate Rf(j,i) to A(i) ?
Thanks
I want to assign the row value of 2D parameter to 1D parameter as follows:
Code: Select all
set
i /i1*i4/ , j /j1,j2/;
Parameter A(i);
Table Rf(j,i)
i1 i2 i3 i4
j1 1 2 3 4
j2 8 7 9 8;
Code: Select all
A(i) = Rf('j1' , i);
For instance, I will have to assign Rf('j1' , i) to A(i) if ord(j) = 1.
I can also use if else loop, but can any one tell me, if I can directly use ord(j) to assign appropriate Rf(j,i) to A(i) ?
Thanks