Optimal Class Deployment Group 5 (Yutaro Sakai, Alexis Younkyung Shin) Introduction Getting to class on time is crucial to a student’s focus throughout a whole lecture. The Carnegie Mellon campus in Pittsburgh is a relatively small sized campus, but there are still some unfortunate events where students do not have enough time to get to class because the buildings of two successive lectures are just too far away to reach within 10 minutes. Thus we have decided to explore this problem for possible solutions by assigning classes appropriately to the buildings on campus according to the designated timetables of the students. We figured that this might be a good place to start rather than to mess with the timetable itself, since that will very likely involve more complications. Benefits If fewer students are late for class, it will save a whole class from frequent head turns to see who just came in. It will mean less distraction for the professors as well. In normal contexts, one or two minutes might not seem much, but it is a very different story if they are between two consecutive classes. If students can come to class a minute or two early and get ready for class then the class can start right away. If professors can spare one or two minutes to finish explaining what they were explaining they will not have to start over in the next lecture just to mention that last point he/she could not make during the previous lecture. If students cannot go to the bathroom between classes in order to be at a class, and they end up leaving class to go during the lecture, this is not only a distraction to the individual student but to the whole class. Making quick important phone calls or printing documents out before lecture can make a lot of differences in an individual’s life. Little as it may seem, these minutes may add up to have a large effect cumulatively. Integer Problem Formation We will try and minimize Z, which will denote the cumulative travel time for all the students. (Travel time: The time elapsed from when the student leaves the classroom to when he/she enters the next classroom) To achieve this, we form the following integer problem. Z : total travel time for all the students (course k is in building p) 𝑛 𝑚 𝑚 𝑚𝑖𝑛𝑖𝑚𝑖𝑧𝑒 𝑍 = ∑ ∑ 𝑠𝑖𝑘 ∑ 𝑓𝑘𝑙 𝑐𝑙𝑞 𝑡𝑝𝑞 𝑖=1 𝑘=1 List of variables 𝑚: number of courses (𝑘, 𝑙) • 𝑛: number of students (𝑖, 𝑗) • 𝑏: number of buildings (𝑝, 𝑞) • 𝑡𝑝𝑞 = travel time from building p to q Integer Variables (0 if other than the stated conditions) • 𝑠𝑖𝑘 = 1 if student i is taking course k 𝑙=1 𝑙≠𝑘 • 𝑓𝑘𝑙 = 1 if courses k and l are respectively consecutive for a given student’s time table (𝑓𝑘𝑙 and 𝑓𝑙𝑘 are not the same) • 𝑐𝑘𝑝 = 1 if course k is in building p The constraints for this problem will be: 1. ∑𝑏𝑝=1 𝑐𝑘𝑝 = 1 (𝐴 𝑔𝑖𝑣𝑒𝑛 𝑐𝑜𝑢𝑟𝑠𝑒 𝑠ℎ𝑜𝑢𝑙𝑑 𝑏𝑒 𝑎𝑠𝑠𝑖𝑔𝑛𝑒𝑑 𝑡𝑜 𝑜𝑛𝑙𝑦 𝑜𝑛𝑒 𝑏𝑢𝑖𝑙𝑑𝑖𝑛𝑔) 𝑚 2. ∑ 𝑓𝑘𝑙 = 1 𝑓𝑜𝑟 𝑎 𝑔𝑖𝑣𝑒𝑛 𝑘 𝑙=1 (For a given course, there will be only one course that follows) 3. 𝐹𝑜𝑟 𝑎𝑛𝑦 𝑔𝑖𝑣𝑒𝑛 𝑓𝑘𝑙 , 𝑡𝑝𝑞 < 10 (All students should have travel time that is less than 10 minutes) We used Java to implement a program that would find us the solution of this integer programming problem. However, we realized that we could not solve this problem through such brute force, iterative measures since the problem is considered a ‘Quadratic Assignment Problem’. QAPs such as our problem are known to be NP-hard (‘as hard as’ an NP problem, where NP stands for nondeterministic polynomial-time. The runtime solving these problems are known to be in the superpolynomial range.) Therefore, we decided it was more practical to devise a different algorithm to find other suboptimal solutions. This alternative approach will be explained in the next section. Alternative Options Due to the fact that solving our linear program for the general case is unsolvable due to the fact that it is NP-hard, we had to look for another way to solve our sample problem. First, we had to come up with a way to calculate the total travel time. The calculation was simple, as we would simply multiply the number of students going from some building to another by the estimated time needed to travel between those buildings. Then we would multiply by the number of days that course meets since we are trying to find the total travel time spent per week. We would do this per every timeslot and every building. In order to do so, it was necessary for us to make a table of the estimated travel times between the academic buildings. Also, since we were not able to access the data of how many students from a certain class goes to another math class, this data was made up for our solution. The approach we took to find the optimal schedule was to start off with some initial schedule and consider some possible swaps that can be done. By swapping, we mean swapping the locations of a pair of courses. For example, if course A is in building C and course B is in building D, when we swap course A and course B, we would consider the case where course A is in building D and course B is in building C. Then we would calculate the total travel time for this new schedule to see any improvements. By looking at all the possible combinations of possible swaps within the same class-time, we would find out what schedule would result in the lowest travel time. Since just randomly swapping two courses without any constraint would result in an excessive number of swaps, we decided to put some conditions of a “possible” swap. A “possible” swap would be such that two courses are in the same capacity group, not in the same building initially and offered on the same days. A capacity group is to take care of the capacities of each course. For example, a course with 200 students should not be swapped with a course with 30 students, as that would be unrealistic. Therefore we defined group 1 as a group of courses with 1 to 30 students, group 2 as a group of courses with 31 to 70 students, and group 3 as a group of courses with 71+ students. Also, courses that are offered in the same building should not be considered as that would not change the travel time. Lastly, two courses that are not offered on the same days cannot be swapped, as that has the possibility of not meeting the requirements for a course, such as not enough lectures, etc. However there were a number of key assumptions made in order to solve for our sample problem. We only considered the 50-minute math courses offered on Mondays, Wednesdays, and Fridays during the Fall 2010 semester. There were 39 such courses. Also, since we could not access the data for each course, we assumed that every course was full to their max capacity. During our process, we treated different sections of the same course since different sections would have lectures at different times in different buildings. Also, for the travel times, we assumed that a student who do not have class next timeslot or a student going to a class from no class is considered as not taking any time since we do not know where they would go and they would have time to go to their next course. Optimal Solution Given these conditions, we attempted to get an optimal schedule that would decrease the total travel time spent per week. For the travel times, we just the following table: (min) No Class Wean Doherty Porter Baker Scaife HH Gates Mar Mor No Class 0 0 0 0 0 0 0 0 0 Wean 0 1 2 2.5 3.2 3.5 3 4 7.5 Doherty 0 2 1 3.2 2.5 6 5.5 6.2 5 Porter 0 2.5 3.2 1 0.5 3.8 3.5 6.5 4.5 Baker 0 3.2 2.5 0.5 1 4.5 4.8 6 3.7 Scaife 0 3.5 6 3.8 4.5 1 2 7.3 10 Hammerschlag 0 3 5.5 3.5 4.8 2 1 7 9 Gates 0 4 6.2 6.5 6 7.3 7 1 4.3 Margaret Morrison 0 7.5 5 4.5 3.7 10 9 4.3 1 The red numbers are for times that take more than seven minutes. Also, the following table lists an estimate of how many students are going to a course that is offered during the next timeslot: Period 1 2 3 4 5 6 7 8 21120_1(152) [152,0,0,0,0,0,0,0] 21120_2(152) [152,0,0,0,0] 21235(25) [0,0,0,0,10,15] 21121(115) [115,0,0,0,0,0] 21120_3(75) [54,21,0,0,0] 21127_1(200) [189,0,11,0] 21127_2(150) [130,9,6,5,0,0,0] 21111(140) 21122_1(165) [165,0,0,0,0,0,0,0] 21122_2(175) [175,0,0,0,0] 21259_2(175) [143,0,0,32,0,0] 21131(40) [31,0,5,4,0,0] 21241_2(110) [77,17,7,8,1] 21256(152) [113,37,0,2] 21257(53) [36,0,0,0,14,3,0] 21112(35) 21259_1(175) [155,0,0,20,0] 21260_2(100) [50,0,0,37,5,8] 21241_1(111) [45,0,0,30,12,24] 21259_3(200) [177,10,0,11,2] 21373(50) [29,0,0,21] 21355(100) [83,0,0,0,8,5,4] 21241_3(30) 21260_1(100) [100,0,0,0,0] 21371(30) [13,0,0,3,6,8] 21300(62) [16,0,9,5,22,10] 21301_1(80) [60,0,0,16,4] 21393(30) [18,0,0,12] 21370(80) 21301_2(65) [45,0,0,10,10] 21325(40) [30,0,0,5,5] 21341(50) [23,0,0,3,10,14] 21369(60) [45,0,0,4,11] 21441(45) 21476(30) 21350(28) [14,6,2,3,3] This data was estimated by consulting the undergraduate catalog and the suggested course schedules. (The numbers were also manipulated in order to make the results/iterations more ‘interesting’.) The first element in the bracket is the number of students who do not have class after a certain course. Then the rest of the elements represent the number of students going to the first course listed in the next period, second course listed in the next period, etc. Using these data and our algorithm to calculate the total travel time per week, the initial schedule resulted in 6803.7 minutes. However, running our Java program that looks at all the possible combinations of possible swaps and calculates the travel time for each combination, this travel time can be reduced significantly. The following is the initial schedule with the arrows indicating the swaps that should be made to obtain the optimal schedule. Gates HH 1 2 21259a 21260a 21301b 3 21259b 21260b 4 21341 21300 5 Porter Wean 21122a 21120a 21122b 21325 21120b Doherty 21131 21127a 7 21257 21355 21127b 8 21241c 21111 21441 21476 21373 21393 21256 21112 (HH: Hammerschlag, Mar Mor: Margaret Morrison) Scaife Mar Mor 21350 21235a 21369 6 Baker 21241a 21121 21366 21301a 21241b 21201 21120c 21259c 21371 21235b 21370 As shown in the table above, five two-way swaps and one three-way swap would result in optimal schedule. After these swaps have occurred, the final travel time would be 5527.8 minutes, which is a decrease of 1275.9 minutes. This is nearly 19% decrease, which is rather significant. However, note that these results are based on estimated data and for a very limited pool of students and courses. With real data and more courses, the results might turn out to be not so significant. Possible Improvements / How to Extend the Project There are many improvements that can be made for this sample problem. One thing that can make this solution more realistic is to get more accurate data. The travel times are estimates depending on our personal experience and the course selections are estimates depending on our personal experience and the undergraduate catalog. The data of the number of students going from a certain course to another can have a significant effect since that is one of the main variables that our solution depends on. Concerning the travel times, our solution can be improved if we take into account the time from the different classrooms within the same building. As of now, we assumed that it would take a minute moving within the same building. However, there is a case where a student must go from the lowest floor to the highest floor, or a student has two courses back-to-back in the same classroom. Also, we disregarded the recitations for each lectures as that would have given us about 50 more courses to be included in our program, and we did not have enough time to do so. Therefore, by regarding each recitation as a separate course, we would be able to find the optimal solution and consider the courses offered on Tuesdays and Thursdays. Moreover, there were a couple of 80-minute lecture courses held on Tuesdays and Thursdays that were not included in our sample program as we were not really sure how to include them in the program. Therefore, finding such way could increase our solution, even though just looking at math courses, it would not really make much impact since there are very few courses taught on Tuesdays and Thursdays. It would also be better if we can fix some classes to a classroom to begin with and disregard those classes for our swaps. This can be done with introductory level courses with large numbers of students. In this manner we also need to fix classes that need special facilities such as lab classes or sports classes. To extend this project, one can include the courses from other departments. For our sample problem, we only included math courses, and many non-Math-majors take math courses as well. Therefore, our sample problem is not very realistic. We can also just consider all the courses offered in Carnegie Mellon University this semester and find the optimal schedule regarding all of the courses. However, considering that our program took about two minutes to run with only 39 math courses, it may take a very long time to get the optimal solution. Conclusion / What We Have Learned As students of math, we must always be prepared to try different approaches to a given problem. Through this project, we learned that just because the optimal solutions are hard or impossible to find, does not mean that we should give up on the problem. There will always be the ‘optimal’ suboptimal solution, and we just need to figure out ways to work around our limitations.