# How to preprocess part of information of excel in CP

We work on university scheduling problem. We want to preprocess possible room and discipline. We use the timetabling example in CPLEX as our guide.

In timetabling.mod

int PossibleRoom[d in Discipline, x in Room] =
in DedicatedRoomSet
|| 0 == card({ | z in Room, k in Discipline
: ( in DedicatedRoomSet)
|| ( in DedicatedRoomSet)});

We have a set of MediumRoom as rooms that has less than or equal to 65 seats,

StudentDiscipline is { : d is discipline , n is numbers of students in discipline} which are in excel.

{int} NbStudent = {n | in StudentDiscipline }.

Then, we try to mimic the code of timetabling.mod as follows

————————————————————————————–

int PossibleLargeRoom[d in Discipline, x in LargeRoom] =
in DedicatedRoomSet || d.NbStudent <= 300;

—————————————————————————————-

However something is wrong, we don’t know it because of the syntex or some logic that we stated.

Here is my t.mod

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 PossibleRoom[d in Discipline, x in Room] =
in DedicatedRoomSet ||
0 == card({ | z in Room, k in Discipline: ( in DedicatedRoomSet)
|| ( in DedicatedRoomSet)});
*/

int PossibleLargeRoom[d in Discipline, x in LargeRoom] =
in DedicatedRoomSet || d.NbStudent <= 300;

/*We want the code to provide the matching discipline that has n students and room that suitable for  # students, n<= 300 , but  got error 'Expecting a tuple type, found string */
execute {
writeln(“PossibleLargeRoom =  “, PossibleLargeRoom);
}