You are on page 1of 6

A Greedy and Genetic Fusion Algorithm for Solving

Course Timetabling Problem

Kaixiang Wang,Wenqian Shang *, Mengyu Liu,


Weiguo Lin Hao Fu
School of Computer Science GuiZhou Esgyn Information Technology Co., Ltd
Communication University of China Guizhou, China
Beijing, China 13511022320@139.com
wangkaixiang1996@163.com

Abstract— In 1976, S. Even and Cooper proved that Course different time periods in the case of reasonable allocation of
Timetabling Problem (CTP) is a nondeterministic polynomial resources [2].
time-complete problem which is hard to be solved. Though many
intelligent methods have been applied to solve the Course The object of the CTP study can be treated as a five-tuple
Timetabling Problem in recent years, there is still a lot of room for [3,4]:
improvement. This paper proposed a Greedy and Genetic Fusion =< , , , , >
Algorithm (GGFA) to solve Course Timetabling Problem
efficiently, which can obtain the local optimal solution by using
TABLE I. RESOURCES OF CTP
Greedy Algorithm and provide a high-quality initial population
for Genetic Algorithm. Simulation results prove that Greedy and Symbols Description
Genetic Fusion Algorithm proposed in this paper has the stronger
optimal ability and faster convergence speed than standard Class Collection { , , ,…, }
Genetic Algorithm, which could solve the CTP effectively and Teacher Collection { , , ,…, }
achieved good results.
Classroom Collection { , , , … , }
Keywords— Course Time-tabling Problem; Genetic Algorithm;
Time-slot Collection { , , , … , }
Greedy Algorithm; Fusion Algorithm
Subject Collection { , , ,…, }
I. INTRODUCTION
With the increasing number of students and courses, manual
course scheduling has become a difficult problem. Scheduling The goal of solving this problem is to find the reasonable
course reasonably and efficiently in the limited resources of match for resources. The result must meet some certain
teachers and time becomes a complex system engineering. constraints [5-7] and meet the requirements of experience.
The Course Timetabling Problem, which belongs to the Hard constraints include but not limited to:
scheduling problem, is a typical Combinatorial Optimization
• The same student only attends one lesson arranged in
Problem. Many scholars have conducted extensive research on
the same time.
this problem. The pioneer can be traced to 1962. Professor
Gotlieb.C.C made a formal description of the Course Scheduling • The same teacher only takes one course arranged in the
Problem. S. Even et al. proved that the course timetabling same time.
problem is an NP-complete problem in the paper of “On the
Complexity of Time Table and Multi Commodity Flow • The same classroom only has one course arranged in the
Problem” in 1976 [1]. same time.

In section 2 we present the formulation of the Course In addition, there are some conditions which improve the
Timetabling Problem and in section 3 the Greedy and Genetic optimal allocation of resources called feasible conditions,
Fusion Algorithm (GGFA) optimizer tool is discussed in detail. which is called soft constraints [8]. These may include but not
Section 4 presents the results of several experiments conducted, limited to:
followed by the conclusion in section 5. • Core courses should be arranged in the morning as
II. PROBLEM DEFINITION possible.

A. Mathematic Model of Course Timetabling Problem • The number of courses per day should be as balanced as
possible.
Course Timetabling Problem is to optimize the combination
of teachers, students, and courses according to specific rules at • Arranging some teachers should meet the requirements
of the special time.
*Corresponding author

978-1-5386-5892-5/18/$31.00 ©2018 IEEE 344


ICIS 2018, June 6-8, 2018, Singapore
The objective of this problem is to satisfy the hard words, it does not consider the overall optimal solution, and its
constraints and to minimize the violation of the soft constraints choice is only the local optimal solution in some sense.
[9].
Murat Kalender’s experiment showed that the greedy
With the development of artificial intelligence, many diverse gradient heuristic selection method outperforms the other
methods have been proposed in the literature for solving approaches when combined with simulated annealing
timetabling problem. These methods come from many scientific acceptance criterion. However, if we use Greedy Algorithm to
disciplines like Operations Research, Artificial Intelligence, and create the initial population for Genetic Algorithm, we can get
Computational Intelligence. The intelligent algorithms include the global optimal solution by taking the advantages of Genetic
but not confined to Genetic Algorithm, Greedy Algorithm, Algorithm
Simulated Annealing Algorithm and Ant Colony Algorithm. We
compared these methods in table 2. B. Genetic Algorithm
The Genetic Algorithm was first proposed by professor J.
TABLE II. COMPARISON OF COMMON ALGORITHMS. Holland of the University of Michigan in 1975 and gradually
developed into an iterative and adaptive heuristic search
Algorithm Advantages Disadvantages algorithm.
• Take too many
• Fast and convenient. A Genetic Algorithm (GAs) is a parallel and evolutionary
parameters.
Genetic search algorithm based on the Darwinian evolution theory [13].
• Great tolerance for
Algorithm • Large calculating
error.
quantity. In computer science and operations research, Genetic Algorithm
is a metaheuristic inspired by the process of natural selection that
• Low time belongs to the larger class of Evolutionary Algorithms (EA).
complexity. • Cannot get optimal
Greedy Genetic algorithms are commonly used to generate high-quality
Algorithm • Provide initial value solution. solutions to optimization and search problems by relying on bio-
for other algorithms. inspired operators such as mutation, crossover, and selection
• Difficult to select [14].
Simulated • Convenient. parameters.
Annealing C. Greedy and Genetic Fusion Algorithm
• Global convergence. • Consume too many
Algorithm
resources. Steps of solving examination timetabling problem are shown
in figure 1.
• Long computing time.
Ant Colony • Strong robustness. • Easily immersing into
Algorithm
stagnation. Begin

B. Definition for resources of Genetic Algorithm


Create Initial Population
It can be considered as an eight-tuple when solving Course (Greedy Algorithm)
Timetabling Problem by using Genetic Algorithm.
=< , , , , , , , >
Evaluate Population

TABLE III. NOTATIONS USED TO FORMALIZED THE CTP

Symbols Description
YES Meet Termination
Method of individual coding Condition?

Evaluation fuction NO

0
Initial Population Genetic Operation

Size of the population

Φ Selection operator
Generate Offspring
Γ Crossover operator

Ψ Mutation operator
Repair Function
Termination conditon ( Iterations, etc..)

III. GREEDY AND GENETIC FUSION ALGORITHM Determine Optimal


Solution
A. Greedy Algorithm
Greedy Algorithm always makes the best choice in the End
current situation when solving a problem [11,12]. In other

345
Fig. 1. Flow chart of GGFA =∑ ( 1 + 2 + 3) (1)
D. Coding
Evaluation function evaluates the fitness of the individuals
GA optimization process does not deal with the parameters through three aspects:
in the genetic space, but convert them into chromosomes or • 1: Fitness of Gene.
individuals that are composed of a certain structure.
Chromosome coding is very important because encoding 1=∑ × ( ) (2)
structures, that is the first problem that needs to be solved when
applying Genetic Algorithm, will have a direct impact on the represents the weight of each course. ( )
effectiveness of algorithm [8]. calculates the score of each course in a arranged
Focusing on Course Timetabling Problem, the encoding timetable.
method proposed included as follow:
1) Binary encoding: The hamming cliff is one of the • 2: Evenness of Time.
disadvantages of binary coding, which is that there is a large
hamming distance between the binary codes of some 2= ×∑ ( − ) +1 (3)
adjacent integers, making the crossover and mutation of
genetic algorithm difficult to cross.
2) Matrix encoding: Matrix coding is not suitable for represents the number of total courses in some day
representing Course tuple. and represents the average number of the courses in a
Therefore, we put forward a new encoding method, Tuple week.
Structure Encoding in this paper. This method regards a teaching
• 3: Evenness of Courses.
plan as a tuple. The coding scheme is shown in figure 2.

3=∑ ×∑ ( − ) +1 (4)
Gene 1 Subject Teacher Class Day of Week Section of Day

Gene 2 Subject Teacher Class Day of Week Section of Day


The course evenness function is used to evaluate the
Gene 3 Subject Teacher Class Day of Week Section of Day degree of uniformity of a course in the arranged
curriculum. represents the number of total courses in
...
the same subject in a day and represents the average
Gene N Subject Teacher Class Day of Week Section of Day number of the courses in the same subject in a week.
In the evolutionary process of Genetic Algorithm, the
Fig. 2. Chromosome coding shceme evolutionary direction is determined according to the
evaluation function. Therefore, the evaluation function
E. Initial Population determines the optimal speed of the scheduling scheme and the
The Standard Genetic Algorithm (SGA) adopts the random optimal solution directly.
method to produce the initial population, which is prone to G. Roulette Wheel Selection
precocity. To optimize initial population, we use Greedy
We used Roulette Wheel Selection to generate offspring in
Algorithm to generate the initial population as evenly and
reasonably as possible in the genetic space. In this way, we can genetic space. Roulette Wheel Selection(RWS), also known as
ensure that Genetic Algorithm can get the global optimal fitness proportionate selection, is a genetic operator used in
scheduling scheme and avoid the precocity. genetic algorithms for selecting potentially useful solutions for
recombination.
The size M of the population represents the number of If f is the fitness of individual i in the population, its
individuals in the group. When the value of M is small, it can probability of being selected is P = f ⁄∑ f , where N is the
improve the running speed of Genetic Algorithm, but reduce the
diversity of the population. However, when the value of M is number of individuals in the population.
large, it will reduce the operating efficiency of the algorithm. H. Genetic Operation
and the general recommendation is that M value is 20-100.
The genetic operation consists of three operations:
F. Evaluation Function Crossover Operation, Mutation Operation, and Reserve
The evaluation function is an indicator of the chromosome Operation.
in the population. In each generation, the fitness of the whole • Crossover Operation: The crossover of genetic
population is evaluated, multiple individuals are stochastically algorithms is the most important operation. There are
selected from the current population based on their (fitness), many crossover operators, we use the common multi-
modified (mutated or recombined) to form a new population, point crossover operator [8], randomly generated
which becomes current in the next iteration of the algorithm. intersection points, but the basic switching unit is the
GA coding segment, and the specific process is showed
The Evaluation Function used is as follows:

346
in figure 4. The probability of crossover operation is probabilities of each operation. These simulate the process of
usually 0.4~0.99. biological evolution.
• Mutation Operation: The Mutation Operation is Begin
mutating a gene on the chromosome selected by
Roulette Wheel Section into a different solution in the
genetic space. The probability of mutation operation is RWS
usually 0.0001~0.001.
select genetic
• Reserve Operation: The Reserve Operation is to add the operation
selected chromosome directly to the next generation
population without any changing. The probability of
reserve operation is usually 0.001~0.1. Mutation Crossover Reserve
Zong [15] used an adaptive crossover and mutation Operation Operation Operation
operation to speed up the algorithm efficiency and achieved a
good result.
RWS Select
First Parent
Mutate and No
TechingPlan Day of Week Section of Day
Create
RWS Select
TechingPlan Day of Week Section of Day
Second
TechingPlan Day of Week Section of Day Parent
...
Crossover
Add to Add to
TechingPlan Day of Week Section of Day and Add to
Offspring Offspring
Offspring

Repair Operation
TechingPlan Day of Week Section of Day
(Check all hard constraints
TechingPlan Day of Week Section of Day and solve them)
TechingPlan Day of Week Section of Day
... Meet Termination
Condition?
TechingPlan Day of Week Section of Day
Yes
End
TechingPlan Day of Week Section of Day
Fig. 4. Flow Chart of Genetic Operation
TechingPlan Day of Week Section of Day
TechingPlan Day of Week Section of Day I. Repair Function
After crossover and mutation operations, the chromosome,
TechingPlan Day of Week Section of Day
which represents a course timetable, may become infeasible
TechingPlan Day of Week Section of Day and unsatisfied the hard constraints [10]. There are three ways
to deal with infeasible solutions:
...
• Remove infeasible timetables.
TechingPlan Day of Week Section of Day • Apply a high penalty in the fitness function, so that they
are unlikely to survive.
Fig. 3. Crossover Operation • Repair infeasible timetable.
First, we choose an individual (chromosome) in the current J. Termination Condition
population using Roulette Wheel Selection according to its There are two termination conditions of Genetic Algorithm:
fitness. Then, we select an operation randomly based on the one is the population fitness is stable for several generations,

347
the other is setting the maximum of iterations. Generally, it is Parameters Value
500~5000. Size of Population 20
Maximum Generation 1000
IV. EXPERIMENT
Crossover Probability 0.9
Based on Greedy and Genetic Fusion Algorithm, by taking
Visual Studio 2016, using C# as developing language, we Mutation Probability 0.09
implemented GGFA model for Course Timetabling Problem. Reserve Probability 0.01

A. Simulation Data C. Result and Analysis


To test whether the algorithm can be applied, we prepared We ran GGFA and SGA ten times respectively to make the
some data and simulate the real situation. Numbers of the data results more convincing. Taking the average of the ten results as
are shown in table 4. the final result, figure 5 shows the evolution of individual
fitness.It can be seen from the figure 5 that the GGFA has a good
TABLE IV. QUANTITY OF RESOURCES convergence.
Resource Number The following conclusions are drawn from the
Teacher 20 corresponding relationship between the individual phenotype
Subject 8 and the numerical example data of chromosome individuals with
Class 10 multiple test results:
Classroom 10 • The average fitness value shows an obvious
Total Couses 300 evolutionary trend.
• The chromosome coding scheme and fitness function
B. Parameters of GGFA mentioned in this paper can reflect the demand for the
The parameters of GGFA is important. After testing several course.
values of them, we took the value of table 5:
• After calculating the simulation data, not only the
TABLE V. PARAMETERS SETTING OF GGFA feasible solution but also the satisfactory near-optimal
solution is obtained.

650
Fitness
600

550

500

450

400

350

300

250
EPOCH
200
24
46
68
90
2

112
134
156
178
200
222
244
266
288
310
332
354
376
398
420
442
464
486
508
530
552
574
596
618
640
662
684
706
728
750
772
794
816
838
860
882
904
926
948
970
992

SGA GGFA

Fig. 5. Fitness of EPOCH

348
[5] Saeid Agahian, Huseyin Pehlivan, Rahim Dehkharghani, “Adaptation and
Use of Artificial Bee Colony Algorithm to Solve Curriculum-based
V. CONCLUSION Course Time-Tabling Problem”, 2014 5th International Conference on
Intelligent Systems, Modelling and Simulation, pp. 77-82.
The traditional timetabling method is inefficient, and the [6] Sawaphat Jaengchuea, “Dome Lohpetch A hybrid genetic algorithm with
course conflict rate is high, which affects the teaching local search and tabu search approaches for solving the post enrolment
efficiency. Using the intelligent method for Course Timetabling based course timetabling problem: Outperforming guided search genetic
Problem has been widely researched and discussed all over the algorithm”, 2015 7th International Conference on Information
Technology and Electrical Engineering (ICITEE), pp. 29-34.
world. However, there is still no method that can solve CTP in
[7] Hamdy M. Mousa, Ashraf B. El-Sisi, “Design and implementation of
different schools commonly. course timetabling system based on genetic algorithm”, 2013 8th
This paper introduces a Greedy and Genetic Fusion International Conference on Computer Engineering & Systems (ICCES),
pp. 167-171.
Algorithm to solve the Course Timetabling Problem and has
[8] Yong OuYang, Yi Chen, “Design of automated Course Scheduling
achieved good results. Due to the lack of experience, our system based on hybrid genetic algorithm”, 2011 6th International
insufficient consideration of conflict detection in the algorithm Conference on Computer Science & Education (ICCSE), pp. 256-259.
needs to be further studied and improved in the future. It is [9] Salwani Abdullah, Hamza Turabieh, “Generating University Course
certain that combining different algorithms and providing a Timetable Using Genetic Algorithm and Local Search”, 2008 Third
good initial value for heuristic algorithm can obtain a better International Conference on Convergence and Hybrid Information
effect. Technology, vlo.1, pp. 254-2.
[10] C. Blum and A. Roli, “Metaheuristics in combinatorial optimisation:
REFERENCES Overview and conceptual comparison,” ACM Computing Surveys, vol.
35 (3), pp. 268–308, 2003.
[1] S. Even, A. Itai, A. shamir, “On the complexity of time table and multi-
commodity flow problems”, 16th Annual Symposium on Foundations of [11] Dezhen Zhang et al., “A novel greedy heuristic algorithm for university
Computer Science (SFCS 1975), pp. 184-193. course timetabling problem”, Proceeding of the 11th World Congress on
Intelligent Control and Automation, year: 2014, pp.5303-5308.
[2] Shengxiang Yang; Sadaf Naseem Jat, “Genetic Algorithms With Guided
and Local Search Strategies for University Course Timetabling”, IEEE [12] Murat Kalender, et al., “A greedy gradient-simulated annealing hyper-
Transactions on Systems, Man, and Cybernetics, Part C (Applications and heuristic for a curriculum-based course timetabling problem”, 2012 12th
Reviews), Volume: 41, Issue: 1, pp. 93-106, 2011. UK Workshop on Computational Intelligence (UKCI).
[3] Zhu Guanyu, “Genetic Algorithm for Solving Curriculum Schedule [13] D. Goldberg, “Genetic Algorithms in Search, Optimization, and Machine
Problem of Senior High School”, Computer Engineering and Learning”, New York: Addison-Wesley, 1989.
Applications, vol. 27, year:2004, pp.215-218. [14] Ade Jamal, “Multiple Scattered Local Search for Course Scheduling
[4] O. Mahdi, R. N. Ainon, and R. Zainuddin, “Using a genetic algorithm Problem”, 2017 International Conference on Soft Computing, Intelligent
optimizer tool to generate good quality timetable,” in Proc. of the 10th System and Information Technology (ICSIIT), pp. 114-119.
IEEE International Conference, vol. 3, pp. 1300–1303, 2003. [15] ZONG Wei, “Research and Realization of University Timetable System
Algorithm”, Computer Simulation, 12nd ed., vol. 28, pp. 390-392, 2011.

349

You might also like