You are on page 1of 6

See discussions, stats, and author profiles for this publication at: https://www.researchgate.

net/publication/261081293

Design and implementation of course timetabling system based on genetic


algorithm

Conference Paper · November 2013


DOI: 10.1109/ICCES.2013.6707195

CITATIONS READS

3 1,129

2 authors:

Hamdy M. Mousa Ashraf El-Sisi


Menoufia University - Faculty of Computers and Information Menoufia University
43 PUBLICATIONS   98 CITATIONS    69 PUBLICATIONS   385 CITATIONS   

SEE PROFILE SEE PROFILE

Some of the authors of this publication are also working on these related projects:

Intrusion detection systems View project

Accelerated Parallel Training of Logistic Regression using OpenCL View project

All content following this page was uploaded by Hamdy M. Mousa on 13 April 2015.

The user has requested enhancement of the downloaded file.


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
{hamdimmm@hotmail.com, ashrafelsisi@hotmail.com}

Abstract— University course timetabling is one of the most Soft constraints are desirable but can be relaxed if
important and time-consuming problem which takes place necessary. In a course timetabling problem, a number of
frequently in all the educational institutes. This paper proposes courses are assigned into classrooms and a limited number of
design and implementation system to generate timetable based on timeslots within a week. Students and lecturers are assigned to
genetic algorithm using different combinations selection courses. Of course, course timetabling also comes along with a
algorithm and mutation types. Two cases small problem and big set of constraints that can also been classified as hard and soft
problem are studied. The results show that two cases tournament constraints as mentioned above. Individual academic
selection is giving solutions better than roulette wheel Selection. institutions usually have a combination of specific constraints
The worst pair is roulette wheel selection and mutation. Mutation
and most of research in course timetabling investigated
error method helps to reach to the best solution faster. In case of
conflicts and no solution, our system generates a report,
particular real world problems in their own institutions. In
containing conflict constraints that must be remove or modified. literature, research on course timetabling is grouped as class-
teacher timetabling, student scheduling, teacher assignment and
Keywords—Courses timetabling; Genetic algorithm; classroom assignment. In our work we deal with class-teacher
Optimization; Crossover and Mutation operators timetabling and room capacities as a hard constraint. Various
methods have been investigated to solve educational
I. INTRODUCTION timetabling problems [6-7]. In the early days of educational
Timetabling is one of the areas that have been studied timetabling research, graph theoretic methods represented the
extensively in recent decade. Among different timetabling state of the art [8-9]. Techniques such as graph coloring were
issues, course timetabling has been studied extensively due to widely used to solve the problems. For example, in [10]
its application. This is one of the most important and time- developed a heuristic based on graph coloring approach that
consuming task which takes place frequently (every year / split the exams into groups and schedule them together. The
term) in all the educational institutes. The quality of number of timeslots correspond the number of colors needed.
timetabling is vital on different groups such as professors, Sequential assignment approach was also investigated in some
students and managers. Setting the timetabling of university is work, where the events were ordered by heuristics to be
the specification of each pilot period and timing, professor and scheduled one by one and backtracking was usually carried out
classroom on the grounds that these resources and the students’ to obtain a feasible solution [11]. Other techniques that were
registration are taken into account [1]. The timetabling problem also widely employed in the early days of timetabling research
is in class of NP-hard problems. This means that the amount of included integer linear programming [12-13]. Also meta-
time and work required solving this type of problems increases heuristic methods used in educational timetabling, such as
exponentially with the problem size. This makes these simulated annealing was a widely studied method on
problems more difficult and time consuming. The optimal use course/school timetabling problems. In [14] studied a simulated
of educational resources depends on the best optimization of annealing that were implemented on a multiprocessor and
course scheduling. Optimization of course scheduling must be presented further research issues arise from this approach.
achieved hard constraints and as possible as soft constraints [2- Some work concluded that the implementation of simulated
5]. Hard constraints include: annealing is highly dependent on various settings and
• Two courses cannot be scheduled into the same timeslot. parameters (e.g. solution space, cooling schedule,
neighborhood generation, cost function) on both examination
• A course should be carried out n times a week (at least n=1). and course/school timetabling problems thus careful selection
• Each course has a specific room requirement with type and on parameters and settings on this algorithm are needed [15-
capacity. 16]. Genetic algorithms and evolutionary algorithms have been
• There are a specified number of periods for each course. widely studied in timetabling, concerning different aspects of
timetabling problems [17]. In [18] which investigated parallel
The soft constraints may be including: genetic algorithms for course timetabling that greatly reduced
• One course should be scheduled before or after another. the execution time to solve the problem. In [19] studied a
• Course should/should not be scheduled into a fixed timeslot genetic algorithm with greedy algorithm that used domain
• Course should/should not be scheduled into a timeslot knowledge for room and timeslot scheduling. In [20]
consecutive to that of another. 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 group. The lecturer fields aree lecturer index, lecturer name,
the fitness function should convey as much information about available intervals per day lectuurer type, number of courses and
the quality of the solution as possible. In [221] propose a new courses codes. The rooms andd the labs fields are room index
method of genetic algorithm with searchh bank strategies and room capacity after recordding rooms then store lab index
namely local which increase the solutions,, guided and tabu and lab capacity.
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. Fig. 1. Process of
o Genetic Algorithms
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 The following example represents lecturer and his
present a proposed design system using gennetic algorithm for variables.
timetabling problem. Proposed design system m implementation,
results and discussion are shown in sectionn 4. Finally some
conclusion is put forward in section 5. This record represents Dr_AAshraf lecturer with his index is
II. GENETIC ALGORITHM
MS
8 and his available intervals. And
A he teaches two courses and
their codes are 2200 and 2500.
Evolutionary Computation (EC) is a field f of computer
science that uses biological processes as a model for solving And the group example;
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 This record represents Firsst_Year group and its index is 1.
can produce acceptable results in many praactical problems is This group studies 6 courses anda contains 100 students. This
composed of three operators, reproductioon, crossover and group divides to 4 sections andd every 25 students represent one
mutation [24]. Fig. 1 shows the structure thaat is used by GAs. section. Also, this group studiees English course as lecture and
First, a population of chromosomes is ranndomly initialized. so on.
These chromosomes each contain a collecttion of genes and
A. Chromosome Representatioon
each gene has a value (called an allele). A single chromosome
is an encoded version of a solution to the problem. The GA In our implementation, twoo chromosomes are suggested to
performs exploration/exploitation of the probblems search space avoid wrong assignment of particular
p rooms/labs for some
by evolving the population of chromosomes through
t a series of classes. The first chromosome represents rooms and the other
generations. During each generation off the GA, parent represents labs. The length of o chromosome equals to the
chromosomes are selected from the populatiion. These parent multiplication of the number of
o days, number of intervals and
chromosomes are combined to form children chromosomes and the number of Rooms/Labs. So each place in that array
then the child chromosomes are mutated. Until to get best represents a Room/Lab at a parrticular interval time of the day.
solutions, repeat the selection and mutation. As the following example; Where any place in that array holds
a course code represent the Leccture/Section that will be hold in
III. PROPOSED AUTOMATED GENETIC TIMEETABLING SYSTEM that Room/Lab at that day innterval, otherwise that place is
The automated genetic timetabling system m designed in this equal zero to mean that room is
i empty at the day interval. Fig.
paper study deals with a simplified versionn of the university 2 and Fig. 3 are shown two dayys chromosome array for rooms
timetabling problem. At the beginning of proposed algorithm and chromosome array for labs as example.
the size of university course timetabling andd its constraints are To make chromosome is flexible,
fl easily readable and has
defined. In the first step of proposed design,, groups, lecturers, more information, the course index,
i group index and sections
rooms, labs, and their variables are encodedd as the following, index are encoded as the followwing:
the group fields are group index, number of courses,
c number of Course numbers: 100 200 3000 ... 700 800 900
students, number of sections, max number of o students per one Group number: 01000, 02000, 03000,
0 04000, … , 99000
section, group name, course name, course type,t course index Section numbers: 1, 2, 3, 4, 5, …,
… 99
and then repeat the last three fields for eacch course for this
As example: the code is 03504, this mean: 3rd Group – course must be scheduled exactly once and so on before two
course number 5 (i.e. course number 5 in 3rd Group) – section new chromosomes replaced the two old chromosomes in the
4. 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
Fig. 2 shown chromosome array for rooms. 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:
Fig. 4 Algorithm to Compute Group_double_booked_Error
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 Fig. 5 Algorithm to Compute Classroom_Small_Error
selected chromosomes. The first one is uniform crossover. The
These errors may be multiplied by weights for each of them
change of any gene in two chromosomes is available in this
in the previous equation. Our system select one of two types of
method by randomly copied from the first or from the second
mutations which called normal mutation and mutation error.
parent. The second method is one point crossover. Two
When any error of four previous errors is take place, mutation
selected chromosomes are swapped at random position to process manipulate with this error by exchange gene with
create new two chromosomes. The Repair chromosomes another one in the same chromosome randomly.
procedure is used to scan and repair from errors such that every
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
Fig. 6 Algorithm to Compute Lecturers_double_booked_Error in Fig. 8 and Fig. 9.

Fig. 7 Algorithm to Compute Lecturer_Unavailable_Error

IV. IMPLEMENTATION, RESULTS AND DISCUSSION Fig. 8 The results for the small problem (Ps)
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 %
Fig. 9 The results for the big problem (Pb)
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 In the first problem four combinations of selection and
Max number of Students per one Section, the Group Name. mutation are roulette wheel selection and mutation (WM),
After that the courses of that group is written as the following: tournament selection and mutation (TM), Roulette wheel
the Course Name, then the Course Type, then the Course Index selection and mutation error (WME), and tournament selection
and that is repeated for each course for that group. Third part and mutation error (TME). The results illustrated that
contains the lecturers and their variables as the following: The tournament selection and mutation error is achieved the desired
Lecturer Index followed by the Lecturer Name, the Available fitness at third generation in average time 120 ms, roulette
Array which its size is equal to the multiple of number of wheel selection and mutation error is achieved the desired
fitness at ninety seventh generation in average time 430 ms and [6] Michael W. Carter, Gilbert Laporte, “Recent developments in practical
tournament selection and mutation is achieved the desired examination timetabling”, Lecture Notes in Computer ScienceVolume
1153, pp 1-21, 1996.
fitness at second generation in average time 100 ms. But the
[7] Michael W. Carter, Gilbert Laporte, “Recent developments in practical
other roulette wheel selection and mutation not reach to course timetabling”, Lecture Notes in Computer Science Volume 1408,
solution before (10000) generation. So the better combinations pp 3-19, 1998.
are TM and TME which achieved the desired goal in time less [8] Daniel Brelaz, “New methods to colour the vertices of a graph”,
than 130 ms. In the big problem run, two types of selection Communication of the Association for Computing Machinery, 22, 251 –
and two types of mutations are used. The results that are shown 256, 1979.
in Fig. 9, illustrated the tournament selection and mutation [9] Werra D., “Graphs, hypergraphs and timetabling”, Methods of
error combination is achieved the desired fitness at thirty third Operations Research (Germany F.R.), 49, 201 – 213, 1985.
generations in average 475 ms. But the other combinations not [10] Burke EK, Elliman DG, Weare RF, “A university timetabling system
reach to solution before maximum number of generation. So based on graph colouring and constraint manipulation”, Journal of
Research on Computing in Education, 27, 1 – 18, 1994.
the TME is the better combination to optimize the big problem
[11] Michael W. Carter, Gilbert Laporte, “Examination timetabling:
timetabling scheduling. After analysis our results we find that algorithmic Strategies and applications”, Journal of the Operational
the best pair is using Tournament Selection and MutationError Research Society, 74, 373 – 383, 1996.
methods for different timetabling scheduling problems and the [12] Arabinda Tripathy, “School timetabling - A case in large binary integer
worst pair is Roulette Wheel Selection and Mutation. When linear programming”, Management Science, Vol. 30, 1473 – 1489, 1984.
running program with conflicted hard constrains, conflicted [13] Natashia Bolanda, Barry D. Hughesa, Liam T.G. Merlotb, Peter J.
report is created after reaching maximum number of Stuckey, “New integer linear programming approaches for course
generation. For example Lecturer unavailable is an error; we timetabling”, Computers & Operations Research, vol.35, pp. 2209 –
2233, 2008.
can solve this problem by changing the available array for
some lecturers or by increasing the number of the intervals per [14] Abramson, “Constructing school timetables using simulated annealing:
sequential and parallel algorithms”, Management Science, 37, 98 –113,
the day or by increasing the number of the lecturers. 1991.
[15] Thompson and Dowsland, “A robust simulated annealing based
V. CONCLUSIONS examination timetabling system”, Computers and Operations
This paper is design and implemented the system to Research,25, 637 – 648, 1998.
generate timetable based on genetic algorithm. Also [16] Abramson, Dang and Krisnamoorthy, “Simulated annealing cooling
combination of selection and mutation are suggested as roulette schedules for the school timetabling problem, Asia-PacificJournal of
Operational Research, 16, 1 – 22, 1999.
wheel selection and mutation, tournament selection and
[17] Corne, Ross and Fang, “Evolutionary timetabling: practice, prospects
mutation, roulette wheel selection and mutation error, and and work in progress” Proceedings of UK Planning and Scheduling SIG
tournament selection and mutation error. Two cases are small Workshop, 1994.
problem and big problem, are tested. The results show that the [18] Abramson and Abela, “A parallel genetic algorithm for solving school
worst selection pair is roulette wheel selection and mutation. In timetabling problem”, The fifteenth Australian Computer Science
the other two cases tournament selection is giving solutions Conference, 1 – 11, 1992.
better than roulette wheel Selection. Mutation error method [19] David C. Rich, “A smart genetic algorithm for university timetabling”,
helps to reach to the better solution faster. In case of conflicts Lecture Notes in Computer Science Volume 1153, pp 179-197, 1996.
and there is no solution such as the intervals are insufficient, [20] Wilhelm Erben, “A grouping genetic algorithm for graph colouring and
our system generates a report, containing conflict constraints exam timetabling”, Lecture Notes in Computer Science Volume 2079,
pp 132-156, 2001.
that must be remove or modified. In future work we try to
[21] Mahiba A., Durai C., “Genetic algorithm with search bank strategies for
study scaling factor of problem size practically for university course timetabling problem”, Procedia Engineering 38, pp.
implemented system to achieve acceptable performance against 253 – 263, 2012.
generation table time. [22] P. J. Angeline, “Adaptive and self-adaptive evolutionary computations,”
Computational Intelligence: A Dynamic System Perspective,
REFERENCES Piscataway, IEEE Press, pp. 152-163, 1995.
[1] Mohamed Tahar Ben Othman, “Ant Universal Tool for University [23] M. Mitchell, An Introduction to Genetic Algorithms, MIT Press, 1998.
Course Schedule Using Genetic Algorithm”, (IJCNS) International [24] Haupt R. Haupt S., “Practical Genetic Algorithms” 2nd ed. John Wiley
Journal of Computer and Network Security, Vol. 2, No. 6. 2010. & Sons, Inc. 2004.
[2] Abdelaziz Dammak, Abdelkarim Elloumi, Hichem Kamoun,
“Classroom assignment for exam timetabling”, Advances in Engineering
Software, 37, 659–666, 2006.
[3] Christopher Head, and Sami Shaban, “A heuristic approach to
simultaneous course/student timetabling”, Computers & Operations
Research, vol. 34, pp. 919–933, 2007.
[4] 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.
[5] 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.

View publication stats

You might also like