[Top][All Lists]

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

Re: [Help-glpk] Generate Set from Param data

From: Heinrich Schuchardt
Subject: Re: [Help-glpk] Generate Set from Param data
Date: Tue, 3 Dec 2013 07:03:17 +0100 (CET)

Hello Timothy,

set info, dimen 3;
set Students = setof{(c,s,b) in info)} s;
set Classes = setof{(c,s,b) in info)} c;
param HistoricalInfo {c in Classes, s in Students}, binary = setof{(c,s,b) in info)} b;

But do you really need the students that are not assigned to a class? Otherwise the information could be provided in a two dimensional set with student class assignment.

Best regards

Heinrich Schuchardt

Timothy Calderwood <address@hidden> schrieb:
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...
_______________________________________________ Help-glpk mailing list address@hidden

reply via email to

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