Hey,
I have a table on my model and I’m trying to define parameters using the values from that table as follows.
Sets
k sample number /1,2,3,4,5,6,7,8,9,10,11,12/
j criterion /1,2,3,4/
n class /1, 2, 3/;
Table a(k,j)
1 2 3 4
1 1 1 1 3
2 1 1 2 2
3 1 2 1 3
4 1 2 2 1
5 1 1 1 3
6 1 1 2 2
7 1 2 1 3
8 1 2 2 1
9 1 1 1 3
10 1 1 2 3
11 1 2 1 3
12 1 2 2 1;
Parameters y(n,j)
y(1,1)=(a(1,1)+a(2,1)+a(3,1)+a(4,1))/4;
y(2,1)=(a(5,1)+a(6,1)+a(7,1)+a(8,1))/4;
y(3,1)=(a(9,1)+a(10,1)+a(11,1)+a(12,1))/4;
y(1,2)=(a(1,2)+a(2,2)+a(3,2)+a(4,2))/4;
y(2,2)=(a(5,2)+a(6,2)+a(7,2)+a(8,2))/4;
y(3,2)=(a(9,2)+a(10,2)+a(11,2)+a(12,2))/4;
y(1,3)=(a(1,3)+a(2,2)+a(3,3)+a(4,3))/4;
y(2,3)=(a(5,3)+a(6,2)+a(7,3)+a(8,3))/4;
y(3,3)=(a(9,3)+a(10,3)+a(11,3)+a(12,3))/4;
However, it gives error and I cannot do it. I searched online but could not find something similar to this. Could anyone help me with this?
Also, is there a way to define these parameters in a more efficient way? I mean as far as I know summation occurs only in the form of sum(x(i),i) and takes all the i values possible. Is there a way to put an upper bound to i?
In addition, Gams cannot read specific values from table such as a(2,4). Is there a way to read them?
Best wishes.