Hello,
I have the following formulation:
In the second summation, tj,i is a table containing for example the following values
(j=1,2, and i=1,2,3)
alias(i,k)
Table t(j,i)
1 2 3
1 1.000 3.000 2.000
2 1.000 1.000 1.000
I face the two following problems:
1. How to introduce a table and treat it as a set in the summation?
2. In the summation, for certain values, i index goes out of bounds.
More specifically I have the following:
since the first elemnt of the table is t(j=1,i=1)=1.
Could you please help me?
Table as index
Table as index
 Attachments

 CodeCogsEqn (1).gif (532 Bytes) Viewed 485 times
Re: Table as index
Hi
Is this you are looking for? I just assumed that the row index of the table starts with 1 instead of 0.
Is this you are looking for? I just assumed that the row index of the table starts with 1 instead of 0.
Code: Select all
set j /1,2/,
i /1,2,3/;
alias(i,k,l);
table t(j,i)
1 2 3
1 1.000 3.000 2.000
2 1.000 1.000 1.000
;
* Define a set that consists of all combinations of j and i
set tb(j,i) /#j.#i/;
display tb;
parameter w(i,k);
* Assign some numbers as they are not available in the quesion
w(i,k) = ord(i) + ord(k)
;
display w, t;
parameter wantedsum(j,i);
loop(tb(j,i),
wantedsum(j,i) = sum(l, sum(k$(ord(k) le t(j,i)), w(l,k)));
);
display wantedsum;