Two-Dimensional Set to One-Dimensional Parameter Topic is solved

Problems with modeling
Post Reply
lucky
User
User
Posts: 1
Joined: 2 years ago

Two-Dimensional Set to One-Dimensional Parameter

Post by lucky »

Hello,

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

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

Code: Select all

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:

Code: Select all

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:

Code: Select all

count(i) /day1 2, day2 1, day3 2/
Is that possible?

Thanks for your help.
GFA
User
User
Posts: 50
Joined: 5 years ago

Re: Two-Dimensional Set to One-Dimensional Parameter

Post by GFA »

Hi Lucky,

Try:

Code: Select all

option count < test;
Output:

Code: Select all

----     14 PARAMETER count  

day1 2.000,    day2 1.000,    day3 2.000
Regards,
GFA
Post Reply