Sei sulla pagina 1di 5

JOURNAL OF COMPUTING, VOLUME 4, ISSUE 10, OCTOBER 2012, ISSN (Online) 2151-9617 https://sites.google.com/site/journalofcomputing WWW.JOURNALOFCOMPUTING.

ORG

56

A Hybrid GA - SA Algorithm for University Timetabling Problem


Nguyen Tan Tran Minh Khang, Tran Thi Hue Nuong
AbstractThis paper presents a hybrid GA - SA algorithm for solving a university timetabling problem in Vietnam. The hybrid algorithm combines Genetic Algorithm and Simulated Annealing. It is tested on 14 real-world data and compared with other aproaches. The computation results indicate the effectiveness of the proposed algorithm. Index Terms course timetabling, university school timetabling, curriculum-based course timetabling, metaheuristic, exploration, exploitation, genetic algorithm, simulated annealing, hybrid heuristics.

1 INTRODUCTION
NIVERSITY course timetabling problem refers to assignment of a set of courses to a given number of periods and rooms satisfied many hard and soft constraints. Hard constraints must be satisfied to create a feasible solution. Soft constraints should be satisfied as much as possible. The timetabling problems are NPcomplete problems [11]. In the timetabling literature, there are many meta-heuristic approaches [9][10] for solving these problems include: Genetic Agorithm [12], Harmony Search [5], Simulated Annealing [2], Bees Algorithm [7], Variable Neighborhood Search [8] etc. In the report of ITC07 [1] - the International Timetabling Competition 2007, the university course timetabling problem can be classified into two groups: curriculum-based course timetabling problems and post enrolment-based course timetabling problems. In Vietnam, nany approaches have been done research in the curiculum-based course timetabling problem [7,8]. In this paper, we present the hybrid algorithm of Genetic Algorithm and Simulated Annealing for this problem. Our approaches is tested over 14 real-world data which is taken from the Faculty of Information Technology, HCMC University of Science in Vietnam and compared with previous works [7,8]. The results show that our approach is able to finding high quality solutions for this problem and has been confirmed by comparing with known results in the literature [7,8]. This paper is organized as follow: section 2 describes the details of the considered curriculum-based university timetabling problem, section 3 explains details of the proposed algorithm, section 4 presents the experimental results to evaluate the performance of the heuristic, and section 5 shows the conclusion.

2 PROBLEM DESCRIPTION

The curriculum-based university timetabling problem considered in this paper involves finding a weekly map between a set of courses and a set of periods, rooms and devices in such a way that satisfies the universitys requirements as much as possible. Major concepts of this problem are described below. A course is a group of lectures (a lecture lasts one period) that have the same teacher, the same attending classes and subject. The main information of a course includesthe teacher teaching this course, one or someattending classes, the subject that this teacher will teach in this course and the number of lectures in a week that belonging to this course, i.e., the number of periods that this course must hold in a week. Each course may be split into blocks (a block is a group of consecutive lectures of the same course in a day), the size of the blocks must be in the range of [minConsecutivePeriods, maxConsecutivePeriods]. For example, the values of minConsecutivePeriods and maxConsecutivePeriods of the course named A are 2 and 3respectively, and the number of lectures in a week of this course is 5. Then we could split course A into two blocks, one lasts 2 periods and the other takes 3 periods. Some courses may be pre-assigned, i.e., their periods and rooms are pre-determined by people, these courses will not be re-scheduled again but theirpre-assigned information (e.g., the assignment of their teacher, classes) will be considered duringthe timetabling process of the other courses. Another importantconcept in the university timetabling problem is curriculum. A curriculum is a group of courses that should notbe overlapped due to the special requirements of the university.In our considered problem, a course is allowed to belong to more than one curriculum. Courses that have the same teacher, or the same at Nguyen Tan Tran Minh Khang is with the Faculty of Software Engineering, University of Information Technology, Ho Chi Minh city, Vietnam. tending classes, or belong to the same curriculum will be Tran Thi Hue Nuong is with the Faculty of Mathematics, University of grouped into a clashed-course group, i.e., the group that Science, Ho Chi Minh city, Vietnam. contains courses that cannot be overlapped. 2012 Journal of Computing Press, NY, addition to those major concepts, another informaIn USA, ISSN 2151-9617

JOURNAL OF COMPUTING, VOLUME 4, ISSUE 10, OCTOBER 2012, ISSN (Online) 2151-9617 https://sites.google.com/site/journalofcomputing WWW.JOURNALOFCOMPUTING.ORG

57

The 8th low weighted soft constraint (S8): The number tion involving our considered problem are the planned number of students attending each class (this is just a of periods that a teacher is assigned in a day should be planned number because the enrollment of students to equal or less than maxTeachingPeriods. The 9th low weighted soft constraint (S9): The number courses may not be done yet), the capacity of each room, the buildings of the faculty (each building is often dis- of days that a class was assigned to should be as small as tanced far from the others, so there should be some con- possible. The 10th low weighted soft constraint (S10): In the timestraints to eliminate the movement of teachers and students between these buildings in the same day), the max- table of a class in session, if there are three periods in imum number of periods that a teacher can teach and a stu- which this class is idle, these should be consecutive pedents should study per day. Moreover, there is another riods (this is a special constraint requested by the our time concept called session, which is a group of consecu- timetabling staff because they need use these idle periods tive periods that form a part of a day, for example: morn- for another purpose). The 11th low weighted soft constraint (S11): All courses ing session of Monday will contain all periods on Monthat belong to the same curriculum which are scheduled to days morning. Our problem has 7 hard constraints (constraints that the same session should be assigned to the same building must be satisfied), and 12 soft constraints (constraints that at that session. (Note that each course has its own minConsecutiveLecshould be satisfied as much as possible). Soft constraints are divided into two groups: high weighted soft con- tures, maxConsecutiveLectures, minSessions and maxSessions straint group (1 constraints) and low weighted soft con- parameters). The objective function f (q) is used to evaluate a timestraint group (11 constraints): The 1st hard constraint (H1): The number of a course's table q: n consecutive lectures in a day must be in the range of f (q) wi di [minConsecutiveLectures, maxConsecutiveLectures]. i 1 nd hard constraint (H2): Teachers, classes, rooms The 2 and devices could not be assigned to periods at which wi and di are the weight and the violation number of they're not available. the ith soft constraint, n is the total number of soft conThe 3rd hard constraint (H3): All the lectures of all straints. courses must be assigned. The 4th hard constraint (H4): The pre-assignment of any 3 THE ALGORITHM course must be respected. th hard constraint (H5): The capacity of a room 3.1 Hybrid GA-SA Algorithm The 5 that is assigned to a course should be equal or greater than A. Genetic Algorithm (GA) the planned number of students attending that course. Genetic algorithm was proposed by John Holland The 6th hard constraint (H6): Courses that have the (1975) [3]. It is a search algorithm based on natural evolusame teacher or class cannot be overlapped. tionary mechanisms such as Selection, Mutation and The 7th hard constraint (H7): No room or device could Crossover. Every solution is presented as a individual be assigned to two simultaneous courses. chromosome in the algorithm. Every individual chromoThe 1st high weighted soft constraint (HS1): Courses some is a set of gene values and is evaluated by means of that belong to the same curriculum should not be over- fitness function. Main ideal of the algorithm is starting lapped. with a intitial population (a set of initial solutions) that The 1st low weighted soft constraint (S1): The move- evolves into new population by choosing two solutions ment of a teacher between two buildings in the same day based some probability distribution. Then, these solutions should be avoided. are combined through a crossover operator to create new The 2nd low weighted soft constraint (S2): The move- solutions. Mutation operator is used to guarantee populament of a class between two buildings in the same day tion diversity by altering one or more gene values in a should be avoided. individual chromosome. Finally, the solutions from one The 3rd low weighted soft constraint (S3): Courses generation are selected for the next generation based on should be assigned to periods that they're preferred. their tness value. The 4th low weighted soft constraint (S4): The idle time 1. Initialize population with random solutions. between consecutive courses in the same sessionfor a 2. Evaluate fitness values of solutions in populateacher or a class should be avoided. tion. The 5th low weighted soft constraint (S5): The number 3. Find the solution with the best fitness value of periods that a class is assigned in a day should be equal called SBestCurrent. or less than maxStudyingPeriods. 4. Set the best solution SBest = SBestCurrent The 6th low weighted soft constraint (S6): The idle time 5. Evaluate fitness value fBest = f(SBest) between consecutive courses in the same day for a teacher 6. Initialize parameters' values: or a class should be avoided. + Iter = 0, IterMax, Niter = 0, NiterMax The 7th low weighted soft constraint (S7): The number + Stop = False of sessions that a teacher was assigned to should be as 7. While (Stop=False) 2012 Journal of Computing Press, NY, USA, ISSN 2151-9617 small as possible. 8. Select pair of solutions from a population

JOURNAL OF COMPUTING, VOLUME 4, ISSUE 10, OCTOBER 2012, ISSN (Online) 2151-9617 https://sites.google.com/site/journalofcomputing WWW.JOURNALOFCOMPUTING.ORG

58

(called parent solutions). Create new solutions from parent solutions using crossover operator and mutation operator 10. Evaluate fitness values of new solutions. 11. Selection: Replace least-fit population with new solutions 12. Find the current solution with the best fitness value in current called SBestCurrent. 13. Evaluate fBestCurrent = f(SBestCurrent) 14. If(fBestCurrent < fBest) + Update the best solution SBest = SBestCurrent + Update fBest = fBestCurrent + Niter = 0 15. Niter = Niter + 1 16. Iter = Iter + 1 17. If(Iter=IterMax or Niter=NiterMax) + Stop = True 18. If(fBest = 0) + Stop = True 19. End While 20. Return the best solution sBest Algorithm 1 - The basic steps of Genetic Algorithm B. Simulated Annealing (SA) Simulated Annealing is a probabilistic local search and derived from Metropolis-Hasting Algorithm [6] proposed by Metropolis in 1953. Then it is considered by researchers for solving combination optimization problems. In 1983, Kirkpatrick et al [4] introduced a temperature schedule for efficient search based on the simularity to physical annealing process. Starting on initialize solution in the search space, a radom solution is made. At each step, SA try to replace current solution by a neighbour solution. If the new solution is better than the current solution, it is accepted. However, if it is a worst solution, it is accepted with a decreasing probability over time. This allow SA to escape from local optima. 1. Initialize parameters' values: + Initialize solution s0 + Set the init temperature T0 + Iter = 0, Niter = 0, T = T0, sCurrent = s0 + SBest = sCurrent + Stop = False 2. While(Stop=False) 3. Iter = Iter + 1 4. Niter = Niter + 1 5. MinorIter = 0 6. Value = f(sCurrent) 7. While(MinorIterMinorIterMax) + MinorIter = MinorIter + 1 + Create a neighbour solution s ' Ns Current + Evaluate f f (s ') f (sCurrent ) + If( f 0 ) sCurrent = s' + Else Generate a random value r (0,1] 9. If(

8. 9. 10. 11.

Niter = 0 End While If(f(sCurrent) < Value) + Niter = 0

3.2 Hybrid GA-SA Algorithm for The CurriculumSCurrent = s' based Course Timetabling Problem + If (f(sCurrent) <f(SBest)) 2012 Journal of Computing Press, NY, USA, ISSN 2151-9617 A. Initialize SBest = sCurrent

re

f T )

If(Iter=IterMax or Niter=NiterMax) + Stop = True 12. If(fBest = 0) + Stop = True 13. End While 14. Return the best solution sBest Algorithm 2 - The basic steps of Simulated Annealing C. Hybrid GA-SA Algorithm The Hybrid GA SA algorithm combines the optimization capabilities of Genetic Algorithm with Simulated Annealing. The main goal of the Hybrid GA SA algorithm is good at avoiding convergence to a locally optimal solution, it could be used to nd a globally optimal solution. 1. Initialize population with random solutions. 2. Evaluate fitness values of solutions in population. 3. Find the solution with the best fitness value called SBestCurrent. 4. Set the best solution SBest = SBestCurrent 5. Evaluate fitness value fBest = f(SBest) 6. Initialize parameters' values: + Iter = 0, IterMax, Niter = 0, NiterMax + Stop = False 7. While (Stop=False) 8. Select pair of solutions from a population (called parent solutions). 9. Create new solutions from parent solutions using crossover operator and mutation operator 10. Evaluate fitness values of new solutions. 11. Selection: Replace least-fit population with new solutions 12. Choose a random solution srand in population. 12. Improve solution srand using Simulated Annealing 13. Find the current solution with the best fitness value in current called SBestCurrent. 14. Evaluate fBestCurrent = f(SBestCurrent) 15. If(fBestCurrent < fBest) + Update the best solution SBest = SBestCurrent + Update fBest = fBestCurrent + Niter = 0 16. Niter = Niter + 1 17. Iter = Iter + 1 18. If(Iter=IterMax or Niter=NiterMax) + Stop = True 19. If(fBest = 0) + Stop = True 20. End While 21. Return the best solution sBest Algorithm 3 - The Hybrid GA-SA Algorithm

T T

JOURNAL OF COMPUTING, VOLUME 4, ISSUE 10, OCTOBER 2012, ISSN (Online) 2151-9617 https://sites.google.com/site/journalofcomputing WWW.JOURNALOFCOMPUTING.ORG

59

A solution (timetable) can be presented by a set of block elements. Every block element includes 4 components: course, first period, length (number of continuous periods), room. When creating a new solution, we only alter components' values of block element: first period and room. For example: Duration of course C is 6 periods. This course has the value of minConsecutiveLectures and maxConsecutiveLectures is 2 and 4. So we will have 3 block splitting ways: BSW={(2,2,2); (3,3); (2,4)}. Every element in a block splitting way is a block element. Initialize a random solution: In a random initial solution, we have 2 steps for asigning first period and room. Firstly, every block element choose a random period p in a set of given periods (This period p is only assigned to a block element if this block element's teacher and classes are available at period p). Secondly, choose a random room that is equal or greater than the planned number of attending students for this block element. B. Operators in Genetic Algorithm In phase GA, every individual chromosome is a solution and every gene value is a block element in the solution for this problem. Operators in GA only alter components' values: first period and room in every block element. Crossover: In this problem, crossover operator creates 2 new solutions with new first periods and new rooms from 2 random solutions (called parent solutions). We use 3 crossover strategies: One-point crossover, Two-point crossover and Uniform crossover. Mutation: In mutation operator, we choose randomly one block element in solution, and then altering randomly new first period and new room. Selection: In this problem, solutions with lower fitness values will not be exist and replace individuals with higher fitness value. We use 2 kind of selection: Ranking selection, Tournament selection. C. Creating Neighbour Solution in Simulated Annealing. In phase SA, we use 2 moves: Single move and Swap move. Neighbour solution s' is created from current solution s by randomly choosing a kind of move in two kind of these moves. These moves are used for searching in the neighbourhood of solution s and we choose 10 percent of a random available set of block elements of solution s.

er than the planned number of attending students. Finally, we choose the best single move in a set of single move (b, p, r) which are created above. Swap move is a move that exchanges either the first period value or the room value of two block elements. Swap move includes 2 components: block element i and block element j. We consider a set of block elements (randomly 10 percent of all block elements of solution x) (called N). Firstly, for each block element i in N, examine all block element j in N which is able to swap first period and room with block element i. Secondly, we choose the best swap move in a set of swap move (i, j) which are created above. D. Stop criteria The hybrid algorithm will stop when the stop criteria (maximum number of iterations) is met.

4 EXPERIMENTAL RESULTS
In this problem, we implemented 3 algorithms: Genetic Algorithm, Simulated Annealing and the hybrid GA-SA algorithm in C++ language by the authors. The computer used to test has configuration of Core2 Duo CPU, 2GB RAM and Windows XP OS. 14 real- world data instances taken from the Faculty of Information Technology, HCMC University of Science in Vietnam are used to evaluate the hybrid algorithm. The algorithms were tested on these 14 instances for ten times and the best and average results are reported in table I. In this implemetation, the weights of soft constraints are: w(HS1) = 60, w(S1) = 15, w(S2) = 10, w(S3) = 10, w(S4) = 5, w(S5) = 2, w(S6) = 5, w(S7) = 10, w(S8) = 10, w(S9) = 5, w(S10) = 10, w(S11) = 10. In Genetic algorithm, we choose population size Popsize {50,100,200,500}, the number of generation Ngeneration {200,300,400}, probability of crossover pcrossover {0.5,0.7,0.8,0.9} and probability of mutation pmutation (0.01,0.02,0.03,0.04}. We test all possible pairs of these parameters values and find out that the pair {Popsize=500, Ngeneration=300, pcrossover =0.9, pmutation =0.02, uniform crossover, Ranking selection} gives the best result. In Simulated Annealing, we choose TP0 {0,10}, MaxIter {400,500,600}, MinorIterMax {50,80,100}. We find out that the pair {TP0=10, MaxIter=500, MinorIterMax=100} gives the best result. The hybrid GA-SA Algorithm: In phase GA, we choose population size Popsize {50, 100, 200, 500}, the number of generation Ngeneration {200,300,400}, probability of crossover pcrossover {0.5,0.7,0.8,0.9} and probability of mutation pmutation (0.01,0.02,0.03,0.04}. In phase SA, we choose TP0 {0,10}, MaxIterSA {10,15,20}, MinorIterMax {2,5,10}. We find out that the pair {Popsize=200, Ngeneration=400, pcrossover =0.8, pmutation=0.03, one-point crossover, Tournament selection, TP0=10, MaxIterSA=15, MinorIterMax=2} gives the best result. The results are compared with those in the literature mentioned below: + Bees Algorithm (2011) [7]. + Variable Neighborhood Search - VNS (2011) [8].

Single move is a move that alters either the first period value or the room value of a block element of solution s. Single move includes 3 components: block element b, first period p and In phase SA, we use 2 moves: Single move and Swap move. Neighbour solution s' is created from current solution s by randomly choosing a kind of move in two kind of these moves. These moves are used for searching in the neighbourhood of solution s and we choose 10 percent of a random available set of block elements of solution sroom r. We consider a set of block elements (randomly 10 percent of all block elements of solution s) (called N). Firstly, for each block element b in N, list all available first period p for this block element b. Secondly, find approriate room r which is available at period p and this capacity of this 2012 r is equalComputing Press, NY, USA, ISSN 2151-9617 room Journal of or great-

JOURNAL OF COMPUTING, VOLUME 4, ISSUE 10, OCTOBER 2012, ISSN (Online) 2151-9617 https://sites.google.com/site/journalofcomputing WWW.JOURNALOFCOMPUTING.ORG

60

TABLE I. # courses 82 80 95 84 89 51 96 88 107 78 83 87 84 102 TABLE II. #instance Data 1 Data 2 Data 3 Data 4 Data 5 Data 6 Data 7 Data 8 Data 9 Data 10 Data 11 Data 12 Data 13 Data 14 Hybrid GA-SA Algorithm 334 1152 656 1686 531 1485 303 529 372 362 382 428 340 343

DETAILS OF 14 DATA INSTANCES # teachers 44 44 44 45 48 31 50 44 43 47 45 52 51 55 # classes 13 10 14 11 12 19 14 11 15 12 13 21 20 26 # rooms 40 46 45 40 51 45 47 47 46 48 53 53 53 53 # curricula 11 10 11 10 11 0 9 5 5 3 7 5 6 9

[3]

#instance Data 1 Data 2 Data 3 Data 4 Data 5 Data 6 Data 7 Data 8 Data 9 Data 10 Data 11 Data 12 Data 13 Data 14

BEST RESULTS ON 14 DATA INSTANCES Genetic Simulated Bees Algorithm Annealing Algorithm 366 397 482 392 1531 2180 426 628 484 2797 958 524 4005 745 410 400 475 420 445 255 435 515 385 400 430 415 495 410 435 382 569 405 444 1876 498 1420 480 343 343 315 466 297 VNS 2647 1209 767 867 693 1595 1343 358 564 312 354 319 405 490

Goldberg, D. E. "Genetic Algorithms: In Search, Optimization and Machine Learning", Addison-Wesly Publishing Co., 1989. [4] Kirkpatrick, S, Gelatt, C.D, Vecchi, M.P, "Optimization by Simulated Annealing", Science, vol 220 (4598), pp. 671-680, 1983. [5] M. A. Al-Betar, A.T. Khader, T.A. Gani, A harmony search algorithm for university course timetabling, PATAT 2008. [6] Metropolis, N., Rosenbluth, A.W., Rosenbluth, M.N, Teller, A.H., Teller, E. "Equation of State Calculation by Fast Computing Machines", Journal of Chemistry and Physical, vol. 21, pp 1087-1091, 1953. [7] NTTM Khang, NB Phuc, TTH Nuong, The Bees Algorithm for a Practical University Timetabling Problem in Vietnam, Computer Science and Automation Engineering (CSAE), 2011 IEEE International Conference, pp. 42-47, Shanghai, 2011. [8] NTTM Khang, NT Quang, TTT Hien, NB Phuc, TTH Nuong, "Variable Neighborhood Search for a Real-world Curriculumbased University Timetabling Problem", The Third International Conference on Knowledge and Systems Engineering (KSE 2011), Hanoi, 2011. [9] R. Lewis, A survey of metaheuristic-based Techniques for University Timetabling Problems, Springer, 2008. [10] S. Abdullah, Heuristic Approaches for University Timetabling Problems, PhD thesis, 2006. [11] TB Cooper and JH Kingston, The Complexity of Timetable Construction Problems in the Practice and Theory of Automated Timetabling, ed. EK Burke and P Ross, pp. 283-295, Springer-Verlag (Lecture Notes in Computer Science), 1996. Basser Department of Computer Science, University of Sydney, Australia, 1996. [12] W. Erben, J. Keppler, "A genetic algorithm solving a weekly course-timetabling problem", in Practice and Theory of Automated Timetabling, vol. 1153, pp. 198-211, 1996.

5 CONCLUSION
In this paper, we presented 3 algorithms: Genetic Algorithm, Simulated Annealing, the hybrid GA-SA Algorithm to solve a real-world university timetabling problem. The results show that the hybrid GA-SA algorithm is capable of solving for this problem and has been confirmed by comparing with known results: The Bees Algorithm, VNS. For future research, the hybrid GA-SA algorithm can be applied on other timetabling problems like, examinating timetabling, high school timetabing

Nguyen Tan Trang Minh Khang received B.S degree and M.S degree in Computer Science from HCMC University of Science, Vietnam in 1996 and 2001. Currently, he is a Ph.D candidate in Computer Science in HCMC University of Science, Vietnam. Since 1996, he has been a lecturer at Faculty of Information Technology, HCMC University of Science, Vietnam. His research interests include timetabling problem, optimization problem. Khang Nguyen is coauthor over ten papers in international conferences and national conferences. Prof. Dr. Tran Thi Hue Nuong received Ph.D degree in Mathematics from University of Warsaw, Poland in 1989. Currently, she is a lecturer at Faculty of Mathematics, HCMC University of Science, Vietnam. Her research interests include timetabling problem, optimization problems, optimization global. Nuong Tran is co-author over thirty papers in international journals and international conferences.

REFERENCES
[1] B. McCollum, P. McMullan, B. Paechter, R. Lewis, A. Schaerf, L. Di Gaspero, A. J. Parkes, R. Qu, E. Burke: "Setting the Research Agenda in Automated Timetabling: The Second International Timetabling Competition. Technical Report", International Timetabling Competition 07-08, 2007 D. Abramson. "Constructing school timetables using simulated annealing: sequential and parallel algorithms". In Management Science, vol.37, pp. 98-113, 1991. 2012 Journal of Computing Press, NY, USA, ISSN 2151-9617

[2]

Potrebbero piacerti anche