help-glpk
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Help-glpk] Generate Set from Param data


From: Timothy Calderwood
Subject: [Help-glpk] Generate Set from Param data
Date: Mon, 2 Dec 2013 11:09:53 -0800

I have a list of students defined as a set. I have also a param defined for historical information that contains the set of students. As seen below...

set Students;
param HistoricalInfo {c in Classes, s in Students}, binary;

Our project might have any number of students, from 50 to over a 1000. I rather not have to list the students twice, once in the set of students, a second time in param Historical Info. 

set Students := David, Jerry, Fannie, Student4, Student5, Student6, Student7, Student8;
param HistoricalInfo (tr):
                 English     Math    Science        SocialStudies    Elective :=
Jerry          1            0        0            0                0
David         1            0        1            0                0
Fannie       0            1        0            1                0
Student4    1            1        0            1                0
Student5    0            1        0            1                0
Student6    0            1        1            0                1
Student7    1            1        0            0                1
Student8    0            0        0            0                1;

My question is, is there a way to define set Students from the param data so the students only need to be listed once?

Thanks for you time and help...

reply via email to

[Prev in Thread] Current Thread [Next in Thread]