Design and Implementation of Course Timetabling System Based on Genetic Algorithm Hamdy M. Mousa and Ashraf B. El-Sisi Computer Science dept., Faculty of Computers and Information, Menofia University, Egypt {
[email protected],
[email protected]} Abstract— University course timetabling is one of the most important and time-consuming problem which takes place frequently in all the educational institutes. This paper proposes design and implementation system to generate timetable based on genetic algorithm using different combinations selection algorithm and mutation types. Two cases small problem and big problem are studied. The results show that two cases tournament selection is giving solutions better than roulette wheel Selection. The worst pair is roulette wheel selection and mutation. Mutation error method helps to reach to the best solution faster. In case of conflicts and no solution, our system generates a report, containing conflict constraints that must be remove or modified. Keywords—Courses timetabling; Genetic Optimization; Crossover and Mutation operators
I.
algorithm;
INTRODUCTION
Timetabling is one of the areas that have been studied extensively in recent decade. Among different timetabling issues, course timetabling has been studied extensively due to its application. This is one of the most important and timeconsuming task which takes place frequently (every year / term) in all the educational institutes. The quality of timetabling is vital on different groups such as professors, students and managers. Setting the timetabling of university is the specification of each pilot period and timing, professor and classroom on the grounds that these resources and the students’ registration are taken into account [1]. The timetabling problem is in class of NP-hard problems. This means that the amount of time and work required solving this type of problems increases exponentially with the problem size. This makes these problems more difficult and time consuming. The optimal use of educational resources depends on the best optimization of course scheduling. Optimization of course scheduling must be achieved hard constraints and as possible as soft constraints [25]. Hard constraints include: • Two courses cannot be scheduled into the same timeslot. • A course should be carried out n times a week (at least n=1). • Each course has a specific room requirement with type and capacity. • There are a specified number of periods for each course. The soft constraints may be including: • One course should be scheduled before or after another. • Course should/should not be scheduled into a fixed timeslot • Course should/should not be scheduled into a timeslot consecutive to that of another.
Soft constraints are desirable but can be relaxed if necessary. In a course timetabling problem, a number of courses are assigned into classrooms and a limited number of timeslots within a week. Students and lecturers are assigned to courses. Of course, course timetabling also comes along with a set of constraints that can also been classified as hard and soft constraints as mentioned above. Individual academic institutions usually have a combination of specific constraints and most of research in course timetabling investigated particular real world problems in their own institutions. In literature, research on course timetabling is grouped as classteacher timetabling, student scheduling, teacher assignment and classroom assignment. In our work we deal with class-teacher timetabling and room capacities as a hard constraint. Various methods have been investigated to solve educational timetabling problems [6-7]. In the early days of educational timetabling research, graph theoretic methods represented the state of the art [8-9]. Techniques such as graph coloring were widely used to solve the problems. For example, in [10] developed a heuristic based on graph coloring approach that split the exams into groups and schedule them together. The number of timeslots correspond the number of colors needed. Sequential assignment approach was also investigated in some work, where the events were ordered by heuristics to be scheduled one by one and backtracking was usually carried out to obtain a feasible solution [11]. Other techniques that were also widely employed in the early days of timetabling research included integer linear programming [12-13]. Also metaheuristic methods used in educational timetabling, such as simulated annealing was a widely studied method on course/school timetabling problems. In [14] studied a simulated annealing that were implemented on a multiprocessor and presented further research issues arise from this approach. Some work concluded that the implementation of simulated annealing is highly dependent on various settings and parameters (e.g. solution space, cooling schedule, neighborhood generation, cost function) on both examination and course/school timetabling problems thus careful selection on parameters and settings on this algorithm are needed [1516]. Genetic algorithms and evolutionary algorithms have been widely studied in timetabling, concerning different aspects of timetabling problems [17]. In [18] which investigated parallel genetic algorithms for course timetabling that greatly reduced the execution time to solve the problem. In [19] studied a genetic algorithm with greedy algorithm that used domain knowledge for room and timeslot scheduling. In [20] investigated a grouping genetic algorithms in which the representation was based on the grouping character of the graph coloring problem, and tested the genetic algorithm on
real-world examination timetabling problem and suggested that the fitness function should convey as much information about the quality of the solution as possible. In [221] propose a new method of genetic algorithm with searchh bank strategies namely local which increase the solutions,, guided and tabu searches. This paper proposes design annd implementation system to generate timetable based on genetic algorithm. In the first, encode of the group’s variables, initialiize the population, and reproduce with different ways (seleection algorithms, crossover, mutation, mutation error) ann individual and termination criteria are defined. The gennetic algorithm is usually terminated if the fitness exceeds a certain threshold value or a certain pre-specified number off generations have been produced. Small problem (Ps) and big problem (Pb), are considered as examples to running sevveral times using implemented system. The results show that using tournament selection and mutation error methods and the worst pair is roulette wheel selection and mutation. In twoo cases tournament selection is giving solutions best than roulettte wheel selection. Mutation error method helps to reach to the best b solution faster. The organization of paper as followingg, in section 2, introduction to genetic algorithms is presenteed. In section 3 we present a proposed design system using gennetic algorithm for timetabling problem. Proposed design system m implementation, results and discussion are shown in sectionn 4. Finally some conclusion is put forward in section 5. II.
MS GENETIC ALGORITHM
Evolutionary Computation (EC) is a field f of computer science that uses biological processes as a model for solving problems [22]. Genetic Algorithms (GAs), first proposed by John Holland in the 1960s, are a categoryy of EC that use concepts derived from evolution. A good ovverview of how to design a GA is given in [23]. A basic geneetic algorithm that can produce acceptable results in many praactical problems is composed of three operators, reproductioon, crossover and mutation [24]. Fig. 1 shows the structure thaat is used by GAs. First, a population of chromosomes is ranndomly initialized. These chromosomes each contain a collecttion of genes and each gene has a value (called an allele). A single chromosome is an encoded version of a solution to the problem. The GA performs exploration/exploitation of the probblems search space by evolving the population of chromosomes through t a series of generations. During each generation off the GA, parent chromosomes are selected from the populatiion. These parent chromosomes are combined to form children chromosomes and then the child chromosomes are mutated. Until to get best solutions, repeat the selection and mutation. III.
PROPOSED AUTOMATED GENETIC TIMEETABLING SYSTEM
The automated genetic timetabling system m designed in this paper study deals with a simplified versionn of the university timetabling problem. At the beginning of proposed algorithm the size of university course timetabling andd its constraints are defined. In the first step of proposed design,, groups, lecturers, rooms, labs, and their variables are encodedd as the following, the group fields are group index, number of courses, c number of students, number of sections, max number of o students per one section, group name, course name, course type, t course index and then repeat the last three fields for eacch course for this
group. The lecturer fields aree lecturer index, lecturer name, available intervals per day lectuurer type, number of courses and courses codes. The rooms andd the labs fields are room index and room capacity after recordding rooms then store lab index and lab capacity.
Fig. 1. Process of o Genetic Algorithms
The following example represents lecturer and his variables. Ashraf lecturer with his index is This record represents Dr_A 8 and his available intervals. And A he teaches two courses and their codes are 2200 and 2500. And the group example;
This record represents Firsst_Year group and its index is 1. This group studies 6 courses and a contains 100 students. This group divides to 4 sections andd every 25 students represent one section. Also, this group studiees English course as lecture and so on. A. Chromosome Representatioon In our implementation, twoo chromosomes are suggested to avoid wrong assignment of particular p rooms/labs for some classes. The first chromosome represents rooms and the other o chromosome equals to the represents labs. The length of multiplication of the number of o days, number of intervals and the number of Rooms/Labs. So each place in that array represents a Room/Lab at a parrticular interval time of the day. As the following example; Where any place in that array holds a course code represent the Leccture/Section that will be hold in that Room/Lab at that day innterval, otherwise that place is equal zero to mean that room is i empty at the day interval. Fig. 2 and Fig. 3 are shown two dayys chromosome array for rooms and chromosome array for labs as example. fl easily readable and has To make chromosome is flexible, more information, the course index, i group index and sections index are encoded as the follow wing: Course numbers: 100 200 3000 ... 700 800 900 Group number: 01000, 02000, 03000, 0 04000, … , 99000 Section numbers: 1, 2, 3, 4, 5, …, … 99
As example: the code is 03504, this mean: 3rd Group – course number 5 (i.e. course number 5 in 3rd Group) – section 4.
Fig. 2 shown chromosome array for rooms.
course must be scheduled exactly once and so on before two new chromosomes replaced the two old chromosomes in the population. There are four types of errors may happen in the timetable. 1) Group of students may be double booked. 2) A classroom may be small to hold one or more of courses booked to it. 3) Lecturers may be double booked. 4) A lecturer may be booked when he/she is unavailable. Fig. 4 to Fig. 7 shown the procedures are used to compute how many times each error of errors is occurred and then computes the costs and fitness of the chromosomes using the following equation: Cost = GdbError + CsError + LdbError + LUError
(1)
Where GdbError is Group_double_booked_Error, CsError is Classroom_Small_Error, LdbError is Lecturers_double_booked_Error, and LUError is Lecturer_Unavailable_Error. Fig. 3 Chromosome array for labs.
Our main GA algorithm consists of the following steps: 1) Randomly generate 20 chromosomes to create the initial population. 2) Select chromosomes for crossover. 3) Do crossover for the selected chromosomes. 4) Perform the mutation and update. 5) Repair the chromosomes. 6) Compute the costs and fitness for each chromosome. 7) Survive the next generation and store the elitism. 8) Repeat steps from 2 to 7 until zero cost chromosomes or maximum number of generation are reached. Two methods are used to select parents for the new generation; the first one is Roulette wheel selection. Roulette wheel selection is implemented as follows: 1) Sum the fitness of all the population members. Call this TF (total fitness). 2) Generate a random number n, between 0 and TF. 3) Return the first population member whose fitness added to the preceding population a member is greater than or equal to n. Another method is Tournament selection and is implemented as the following: 1) Choose four chromosomes randomly 2) Return with the index of the chromosome with the smallest cost. There are two methods are used to crossover the two selected chromosomes. The first one is uniform crossover. The change of any gene in two chromosomes is available in this method by randomly copied from the first or from the second parent. The second method is one point crossover. Two selected chromosomes are swapped at random position to create new two chromosomes. The Repair chromosomes procedure is used to scan and repair from errors such that every
Fig. 4 Algorithm to Compute Group_double_booked_Error
Fig. 5 Algorithm to Compute Classroom_Small_Error
These errors may be multiplied by weights for each of them in the previous equation. Our system select one of two types of mutations which called normal mutation and mutation error. When any error of four previous errors is take place, mutation process manipulate with this error by exchange gene with another one in the same chromosome randomly.
Fig. 6 Algorithm to Compute Lecturers_double_booked_Error
intervals per day to the number of days, the Lecturer Type, the Number of courses. After that the courses codes which that lecturer will teach are written. Fourth part contains the rooms then the labs variables as the following: the Room Index followed by the Room Capacity then the labs is also represented by placing the Lab Index followed by the Lab Capacity. The two problems used to test our program are small problem (Ps) and big problem (Pb). The small problem (Ps) contains “24” lectures and sections and “6” lecturers and “6” days with “4” intervals in each day and two rooms and two labs. The big problem (Pb) contains “93” lectures and sections and “31” lecturers and “6” days with “4” intervals in each day and “3” rooms and “6” labs. Configuration of the problem for combination of selection and mutation for small and big problems are ran several times on the same machine with the same number of Population and Mutation Rate and Crossover Rate. The average results of these two problems are as shown in Fig. 8 and Fig. 9.
Fig. 7 Algorithm to Compute Lecturer_Unavailable_Error
IV.
IMPLEMENTATION, RESULTS AND DISCUSSION
The proposed design is implemented by using java programming, under windows 7, running on Intel core 2 duo t725 2 GHz. The text file stores some basic data that used in the main system program. Text file is divided into four parts. First part contains the constraints and variables the GA will need as the following: Number_of_Groups =5 Number_of_Intervals =4 Number_of_Days =6 Number_of_Rooms =3 number_of_Labs =6 Number_of_Stuff = 31 Numder_of_Population = 20 Uniform_Crossover_Rate = 50 % Mutation_Rate = 10 % Second part contains the groups and their variables as the following: The Group index followed by the Number of Courses, the Number of Students, the Number of Sections, the Max number of Students per one Section, the Group Name. After that the courses of that group is written as the following: the Course Name, then the Course Type, then the Course Index and that is repeated for each course for that group. Third part contains the lecturers and their variables as the following: The Lecturer Index followed by the Lecturer Name, the Available Array which its size is equal to the multiple of number of
Fig. 8 The results for the small problem (Ps)
Fig. 9 The results for the big problem (Pb)
In the first problem four combinations of selection and mutation are roulette wheel selection and mutation (WM), tournament selection and mutation (TM), Roulette wheel selection and mutation error (WME), and tournament selection and mutation error (TME). The results illustrated that tournament selection and mutation error is achieved the desired fitness at third generation in average time 120 ms, roulette wheel selection and mutation error is achieved the desired
fitness at ninety seventh generation in average time 430 ms and tournament selection and mutation is achieved the desired fitness at second generation in average time 100 ms. But the other roulette wheel selection and mutation not reach to solution before (10000) generation. So the better combinations are TM and TME which achieved the desired goal in time less than 130 ms. In the big problem run, two types of selection and two types of mutations are used. The results that are shown in Fig. 9, illustrated the tournament selection and mutation error combination is achieved the desired fitness at thirty third generations in average 475 ms. But the other combinations not reach to solution before maximum number of generation. So the TME is the better combination to optimize the big problem timetabling scheduling. After analysis our results we find that the best pair is using Tournament Selection and MutationError methods for different timetabling scheduling problems and the worst pair is Roulette Wheel Selection and Mutation. When running program with conflicted hard constrains, conflicted report is created after reaching maximum number of generation. For example Lecturer unavailable is an error; we can solve this problem by changing the available array for some lecturers or by increasing the number of the intervals per the day or by increasing the number of the lecturers. V.
CONCLUSIONS
This paper is design and implemented the system to generate timetable based on genetic algorithm. Also combination of selection and mutation are suggested as roulette wheel selection and mutation, tournament selection and mutation, roulette wheel selection and mutation error, and tournament selection and mutation error. Two cases are small problem and big problem, are tested. The results show that the worst selection pair is roulette wheel selection and mutation. In the other two cases tournament selection is giving solutions better than roulette wheel Selection. Mutation error method helps to reach to the better solution faster. In case of conflicts and there is no solution such as the intervals are insufficient, our system generates a report, containing conflict constraints that must be remove or modified. In future work we try to study scaling factor of problem size practically for implemented system to achieve acceptable performance against generation table time.
[6]
[7]
[8]
[9] [10]
[11]
[12] [13]
[14]
[15]
[16]
[17]
[18]
[19] [20]
[21]
[22]
REFERENCES [1]
[2]
[3]
[4]
[5]
Mohamed Tahar Ben Othman, “Ant Universal Tool for University Course Schedule Using Genetic Algorithm”, (IJCNS) International Journal of Computer and Network Security, Vol. 2, No. 6. 2010. Abdelaziz Dammak, Abdelkarim Elloumi, Hichem Kamoun, “Classroom assignment for exam timetabling”, Advances in Engineering Software, 37, 659–666, 2006. Christopher Head, and Sami Shaban, “A heuristic approach to simultaneous course/student timetabling”, Computers & Operations Research, vol. 34, pp. 919–933, 2007. P. De Causmaecker et al., “A decomposed metaheuristic approach for a real-world university timetabling problem”, European Journal of Operational Research Volume 195, Issue 1, Pages 307–318, 2009. Natashia Bolanda, Barry D. Hughesa, Liam T.G. Merlotb, Peter J. Stuckey, “New integer linear programming approaches for course timetabling”, Computers & Operations Research vol.35, pp. 2209 – 2233, 2008.
[23] [24]
Michael W. Carter, Gilbert Laporte, “Recent developments in practical examination timetabling”, Lecture Notes in Computer ScienceVolume 1153, pp 1-21, 1996. Michael W. Carter, Gilbert Laporte, “Recent developments in practical course timetabling”, Lecture Notes in Computer Science Volume 1408, pp 3-19, 1998. Daniel Brelaz, “New methods to colour the vertices of a graph”, Communication of the Association for Computing Machinery, 22, 251 – 256, 1979. Werra D., “Graphs, hypergraphs and timetabling”, Methods of Operations Research (Germany F.R.), 49, 201 – 213, 1985. Burke EK, Elliman DG, Weare RF, “A university timetabling system based on graph colouring and constraint manipulation”, Journal of Research on Computing in Education, 27, 1 – 18, 1994. Michael W. Carter, Gilbert Laporte, “Examination timetabling: algorithmic Strategies and applications”, Journal of the Operational Research Society, 74, 373 – 383, 1996. Arabinda Tripathy, “School timetabling - A case in large binary integer linear programming”, Management Science, Vol. 30, 1473 – 1489, 1984. Natashia Bolanda, Barry D. Hughesa, Liam T.G. Merlotb, Peter J. Stuckey, “New integer linear programming approaches for course timetabling”, Computers & Operations Research, vol.35, pp. 2209 – 2233, 2008. Abramson, “Constructing school timetables using simulated annealing: sequential and parallel algorithms”, Management Science, 37, 98 –113, 1991. Thompson and Dowsland, “A robust simulated annealing based examination timetabling system”, Computers and Operations Research,25, 637 – 648, 1998. Abramson, Dang and Krisnamoorthy, “Simulated annealing cooling schedules for the school timetabling problem, Asia-PacificJournal of Operational Research, 16, 1 – 22, 1999. Corne, Ross and Fang, “Evolutionary timetabling: practice, prospects and work in progress” Proceedings of UK Planning and Scheduling SIG Workshop, 1994. Abramson and Abela, “A parallel genetic algorithm for solving school timetabling problem”, The fifteenth Australian Computer Science Conference, 1 – 11, 1992. David C. Rich, “A smart genetic algorithm for university timetabling”, Lecture Notes in Computer Science Volume 1153, pp 179-197, 1996. Wilhelm Erben, “A grouping genetic algorithm for graph colouring and exam timetabling”, Lecture Notes in Computer Science Volume 2079, pp 132-156, 2001. Mahiba A., Durai C., “Genetic algorithm with search bank strategies for university course timetabling problem”, Procedia Engineering 38, pp. 253 – 263, 2012. P. J. Angeline, “Adaptive and self-adaptive evolutionary computations,” Computational Intelligence: A Dynamic System Perspective, Piscataway, IEEE Press, pp. 152-163, 1995. M. Mitchell, An Introduction to Genetic Algorithms, MIT Press, 1998. Haupt R. Haupt S., “Practical Genetic Algorithms” 2nd ed. John Wiley & Sons, Inc. 2004.