Hi
tuple StudentinDiscipline {
string discipline;
int NbStudent;
};
tuple Pair {
string a;
string b;
};
tuple td {
string teacher;
string discipline;
};
{string} LabRoom = …; // the set of available laboratory
{string} SmallRoom = …; // the set of available room for no more than 25 students
{string} MediumRoom = …; // the set of available room for no more than 65 students
{string} LargeRoom = …;
{StudentinDiscipline} StudentDiscipline =…;
{td} TeacherDisciplineSet = …;
{Pair} DedicatedRoomSet = …;
{string} Discipline = {d |in TeacherDisciplineSet };
{string} Room = LabRoom union SmallRoom union MediumRoom union LargeRoom;{int} NbStudent = {n |
in StudentDiscipline };
int nbStudentPerDiscipline[d in Discipline]=
(card({n |in StudentDiscipline })==0)?0:first({n | in StudentDiscipline });
{string} DisciplineForLargeroom[n in NbStudent] =
{ d |in StudentDiscipline: nbStudentPerDiscipline[d] <= 300};
//maybe wrong due to Nbstudent has no repeat
execute
{
writeln(NbStudent);
writeln(nbStudentPerDiscipline);
for(var i in Discipline) writeln(“discipline “,i,” ==> “,nbStudentPerDiscipline[i]);
}
gives
{16 34 22 47 86 55 120 3 51 23 37 49}
[55 22 34 120 16 3 86 47 51 49 37 0 23 0 0] discipline Maths ==> 55
discipline French ==> 22
discipline Economy ==> 34
discipline Physics ==> 120
discipline Biology ==> 16
discipline Sport ==> 3
discipline History ==> 86
discipline Geography ==> 47
discipline a ==> 51
discipline b ==> 49
discipline c ==> 37
discipline d ==> 0
discipline e ==> 23
discipline f ==> 0
discipline g ==> 0
and will help you see why you got some zeros
best regards
Source: Re: How to preprocess part of information of excel in CP