Two-Dimensional Set to One-Dimensional Parameter

Hello,

I’ve a problem which I can’t solve by myself.

I have a two-dimensional subset which looks like that:

Sets
i /day1, day2, day3, day4, day5/
j /j1, j2/
test(i,j)

The subset test(i,j) does not include all possilble combinations, so it could look like that list:

day1 j1
day1 j2
day2 j1
day3 j1
day3 j2

and so on.

What I would like to have is a parameter count(i), produced by GAMS, which counts how many j’s in the subset on day1, how many on day 2, … . It does not matter which j. In this example the parameter would look like that:

count(i) /day1 2, day2 1, day3 2/

Is that possible?

Thanks for your help.

Hi Lucky,

Try:

option count < test;

Output:

----     14 PARAMETER count  

day1 2.000,    day2 1.000,    day3 2.000

Regards,
GFA