Sie sind auf Seite 1von 4

A Data-Driven Parallel Strategy applying for the University Academic Class Scheduling

Bui Hoai Thang Ho Chi Minh City University of Technology Department of Information Technology A3 Block, 268 Ly Thuong Kiet St., Dist. 10, Ho Chi Minh City, Vietnam thang@dit.hcmut.edu.vn http://www.dit.hcmut.edu.vn/~thang/
Abstract. This text describes the parallel strategy applying to the class scheduling problem in the datadriven way. The scheduler first constructs set of partitions by grouping classes of students who are in the same year and major into the same partition. The partitions later are made to be disjointed in sense of common students by pre-scheduling some classes, in which students in different partitions attended. In the second phase, a feasible timetable is constructed by constructing feasible timetables for each partition in parallel mode. In the third phase, some search algorithms such as Simulated Annealing are applied to separated timetables of partitions to improve them, again, in parallel. Finally, the last improvement step is applied to the whole timetable to make it acceptable.

1. Introduction
The academic class scheduling[4] is a process of constructing a feasible timetable satisfying all the hard constraints and minimizing the soft constraint violations for given data sets of classes and their days; rooms and their capacities, types; and students and their classes. In this work, I use a set of three hard constraints: (1) no student seats in more than one class at the same time, (2) only one class is in each room at any timeslot, and (3) an assigned room for a class must be big enough for all the attending students and satisfies all the features required by that class; and a set of four soft constraint violations: (1) a student takes adjacent timeslots over lunch, (2) a student has only one class a day, (3) a student has more that 6 timeslot a day, and (4) a student takes classes in adjacent timeslots that occur in different rooms. For each semester, the university forms classes from the registrations to satisfy the teaching rules, such as the number of students in a class should not be exceeded 120. Then there are many classes opened for a course in a particular semester. Naturally, classes are related in sense of common students, who join in more than one class. Therefore, the scheduler has to consider the large number of related classes to schedule a feasible timetable. In this text, I present the new parallel strategy to solve such problem for a large set of related data.

2. The partition
Analyzing the class schedules at some universities in recent academic years shows that students in different level or major register quite different courses. For example, the first year students always register for basic courses and not for major courses, and most of students do not take the courses in majors other than that in their major. Hence, a partition is defined as a set of classes, in which students of the same year and major are attended. Of course, students may register classes in more than one partition. For example, a student can register common courses that involved in many partitions of the first year students.

Therefore, partitions are not disjointed since classes in different partitions are related directly or indirectly (through other classes) in sense of class common students. Let call classes in different partitions that consist of common students are weak elements, since they hold the connections among partitions. Those weak elements can be easy located by checking the registrations to find out if there are more than one kind of student (major or year) attended in one class. Breaking down those connections separates the partitions and make them disjointed for scheduling in parallel.

weak elements

partition

3. The algorithm
The global algorithm is outlined procedure GlobalProc as follows: At first, the sets of intput: a problem data are examined to generate set output: a feasible timetable of partitions and make them 1: call GeneratePartitionsProc disjointed. Then, a feasible 2: for each partition 1: call AssignTimeslotProc in parallel timetable is constructed by 3: call RoomAllocationProc constructing feasible timetables 4: for each partition for each partition in parallel 1: call SimulatedAnnealingProc in parallel mode. Next, some search 5: call LastImprovementProc algorithms such as Simulated Annealing are applied to separated timetables of partitions to improve them. Last, another improvement algorithm is applied to the whole timetable to make it acceptable. 3.1. Generating partitions First, we examine the set of classes and separate them into NP partitions, where NP = (Number of majors)*(Number of student years). Later, we try to solve the weak elements to take partitions apart. To do that, just arrange them in timeslot so that there is no conflict in the first hard constraint.
procedure GeneratePartitionProc intput: a problem output: a set of disjointed partitions 1: set all partitions to empty 2: for each class 1: get the major, year of student in that class 2: arrange the class to corresponding partition 3: set the weak elements to empty 4: for each partition 1: for each class 1: for each class in other partition 1: if they have common students 1: add to weak elements 5: call AssignTimeslotProc for the weak elements

For the partitions of first year students, students join into many classes opened for common course and make each of classes be related to most of the others over partitions. In this case, we can mix them into one bigger partition the freshman partition. 3.2. Making the first feasible timetable We perform this action in two stages: first, assigning timeslot to all classes, and next assigning rooms to all of them. The first one can be done in parallel as showed in the GlobalProc. For the second stage, we just simple allocate rooms by first fix strategy.

For each partition, classes can be sort by the number of related classes in the same partition. Picking up class, the timeslot will be chosen randomly. Of course, the checking for the first hard constraint should be performed. To allocate rooms for all classes result from the first stage, define the room-class matrix as a twodimensional array {aij} of size NclassxNroom, where a=1 means that the class i can be assign into room j and a=0 means the opposite. Define another matrix roomtimeslot matrix as an array {bij} of size NtimeslotxNroom, where Ntimeslot=(Number of working days) * (Number of periods a day) and b=1 means the room j is assigned to some class in timeslot i.

procedure AssignTimeslotProc intput: a set of classes output: a set of timeslot-assigned classes 1: sort classes for number of related in descending order 2: for each class in sorted classes 1: while have not choose a feasible timeslot 1: randomly choose a timeslot 2: check conflict with the related classes procedure RoomAllocationProc intput: all timeslot-assigned classes output: the first timetable 1: calculate {aij}, {bij} 2: for each class 1: for each non-zero room in class row at {aij} 1: if bkj = 0 1: assign class into room 2: update two matrices 2: if there is no suitable room 1: add the class to unassigned classes 3: for each class in unassigned classes 1: assign to a room in class row at {aij}

The process continuously chooses a suitable room for a class by checking the room-class matrix and room-timeslot matrix. If there are some classes that cannot be assigned into any room, put them into a set of unassigned classes. If there is such a set, relax the second hard constraints and assign suitable room for them. Then, the result of that step in fact may not be a feasible timetable. It is just an initial timetable for the next step. 3.3. Using Simulated Annealing to improve the separated timetables The system temperature in this algorithm can be calculated from the temperature of the previous step (or from the initial temperature) with a cooling factor. The cooling factor is simply a number between 0.9 and 0.99[1][2]. Some other problems are also discussed in [3].
procedure SimulatedAnnealingProc intput: initial timetable output: feasible timetable 1: set current state to the initial timetable 2: while not meets some stop conditions 1: set T to the system temperature 2: set next state to a randomly selected successor 3: set delta to the change in the fitness 4: if delta > 0 1: set current state to next state 5: else 1: set current state to next state with probability e-delta/T

The successors of the current state can be obtained by making some exchange: from a pair of assignments (class, room, timeslot), the exchange can be made by swap class, room, or timeslot; or move an assignment to an empty timeslot, unassigned room. Since the initial timetable may have some conflicts on room assignment, the state of the process is not always feasible. Therefore, the exchange has to follow the first and the third hard constraint but the second. The cost function (fitness) in this case will be construct by the following expression: (wr*r + wi*si), where wi is coefficients, r is the number of rooms that violate the second hard constraint, and si is the number of violations of soft constraint i. The coefficient wr should be as large as possible to lead the result of the algorithm to a feasible timetable at the end of the process.

3.4. The last improvement for the whole timetable The whole timetable is now constructed by combining all the partial timetables resulted from previous step. Again, the result timetable may not be feasible since the simultaneous processes exchange classes and rooms in their own data independently and may lead to the conflicts on room from partition to partition. The last improvement process needs to consider the second hard constraint by using again the cost function of the previous step. At this step, the parallel version of Simulated Annealing algorithm[1] will be applied to reduce the total time. This algorithm performs multiple permutations concurrently to allow each permutation is independent of the other permutation.
procedure LastImprovementProc intput: initial timetable output: feasible timetable 1: set the shared timetable to initial timetable 2: for i in number of concurrent processes 1: call ParallelSimulatedAnnealingProc in parallel procedure ParallelSimulatedAnnealingProc intput: shared timetable output: update shared timetable 1: while not meets some stop conditions 1: set T to the system temperature 2: while not success 1: randomly select an unlocked assignment 2: lock the assignment 3: set next state to a permutation on the assignment 4: set delta to the change in the fitness 5: if delta > 0 1: update shared timetable with next state 6: else 1: update shared timetable with next state with probability e-delta/T

The timetable in this case must be held in the shared memory area accessible for all processes. Each process independently chooses an element to move (from a from period), and a to period. In order to prevent other processes from choosing the same element and the to period, they must lock the element. Similarly, the lock has to be issued for the from period.

4. Conclusions and future works


Applying parallel computing to university timetabling in this data-driven strategy can be used in most of the university in Vietnam when most of the Vietnamese students neither take courses in majors other than that of their major nor take courses of academic years other than that of their years. However, the algorithm should be improved by applying more search algorithms for each phase to study the performance of the system. Another problem has to study is how to reduce the conflict on rooms when we improve parts of timetable in parallel mode. References [1] Abramson, D. Constructing School Timetables using Simulated Annealing: Sequential and Parallel Algorithms, Management Science Vol. 37-1(1991), pp.98-113. [2] Abramson, D., Krishnamoorthy, M., and Dang, H. Simulated Annealing Cooling Schedules for the School Timetabling Problem, Asia-Pacific Journal of Operational Research Vol. 16 (1999), pp.1-22. [3] Elmohamed, S., Fox, G., and Coddington, P. A comparison of annealing techniques for academic course scheduling, Proc. 2nd Int. Conf. on Practice and Theory of Automated Timetabling(1998), pp.92-115. [4] Schaerf, A. A survey of automated timetabling, Artificial Intelligence Review No.13(1999), pp. 87-127.

Das könnte Ihnen auch gefallen