Tải bản đầy đủ (.pdf) (49 trang)

khóa luận tốt nghiệp tiếng anh :TIMETABLINGPROBLEM

Bạn đang xem bản rút gọn của tài liệu. Xem và tải ngay bản đầy đủ của tài liệu tại đây (350.03 KB, 49 trang )

VIETNAM NATIONAL UNIVERSITY
UNIVERSITY OF SCIENCE
FACULTY OF MATHEMATICS , MECHANICS AND INFORMATICS
Nguyen Anh Hoang
TIMETABLING PROBLEM
Undergraduate Thesis
Advanced Undergraduate Program in Mathematics
Hanoi - 2012
VIETNAM NATIONAL UNIVERSITY
UNIVERSITY OF SCIENCE
FACULTY OF MATHEMATICS , MECHANICS AND INFORMATICS
Nguyen Anh Hoang
TIMETABLING PROBLEM
Undergraduate Thesis
Advanced Undergraduate Program in Mathematics
Thesis advisor: Dr. Hoang Nam Dung
Hanoi - 2012
Contents
Chapter 1. The Timetabling Problem . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
1.1. Definitions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
1.2. Applications. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
1.2.1. E x amination Timetabling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
1.2.2. Po st En rollment based Course Timetabling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
1.2.3. Curriculum based Course Timetabling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
Chapter 2. Some General Algorithms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
2.1. Genetic Algorithms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
2.1.1. In troduction and Some Fu n damentals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
2.1.2. Main Ideas of Genetic Algorithm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
2.2. Memetic Algorithms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
2.2.1. Solution Representation. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
2.2.2. Generating the First Popu lation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15


2.2.3. The Evolutionary Operator s. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
Chapter 3. Specific Method for the International Timetabling Competition 19
3.1. Algorithm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
3.1.1. Cons truction Phase . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
3.1.2. Hill Climbing Phase . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
3.1.3. Great Deluge Phase . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
3.1.4. Simulated Annealling Phase . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
3.2. Applying to Competition Problems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
3.2.1. Applying to Examination Timetabling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
3.2.2. Applying to Post Enrollment based Course Timetabling . . . . . . . . . . . . . . . . . . . 24
3.2.3. Applying to Curriculum based Course Timetabling . . . . . . . . . . . . . . . . . . . . . . . 25
i
Chapter 4. Applying to the University Timetabling Problem . . . . . . . . . . . . . . . 27
4.1. Definition of the Problem . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
4.2. Algorithm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
4.2.1. Deal with Hard Constraints . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
4.2.2. Deal with Soft Constraints . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
4.3. Results . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32
4.3.1. Imp rove t h e Original Timetable . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
4.3.2. Apply the Algorithm to Create a Brand New Timetable . . . . . . . . . . . . . . . . . . . . 33
4.3.3. Comparing Solution between Original Timetable and New Timet able. . . . . . 41
ii
ACKNOWLEDGM ENTS
I am grateful to all those who spent their time and support for this report.
Foremost among this group is my advisor and instructor- Dr Hoang Nam Dung.
Thank you for your dedication, patience, enthusiasim and encouragement to this
report. Sincere thanks to spent hours to meet me and encourage me to continue this
project and broad my knowledge.
Second, sincere thanks to all professors and lecturers of Faculty of Mathe-
matics, Mechanics and Informatics for their help throughout my university’s life at

Hanoi University of Science.
Finally, I would like to thank my family and friends who always support and
give me advice during my career at school.
iii
Introduction
Nowadays, the timetabling problems are widely common in the real world.
They can be seen and considered in every university in any country. They often con-
tain some constraints that needed to be satisfied, with the purpose to set an efficient
timetable. Many algorithms are now gradually being constructed and developed ,
since finding the absolutely optimal solution is almost impossible. However, peo-
ple’s attempts for seeking the best method to solve the timetabling problems are
very important and meaning to the world.
This thesis is organised as follows:
Chapter 1 presents definitions of the timetabling problem and its applica-
tions. It can be constructed weekly timetable for a university.
Chapter 2 will give you some algorithms that can be used to solve this kind
of problems. Up to now, people have found many ways to deal with scheduling
problem, and some of those are quite effective.
Chapter 3 is devoted for the specific methods that the winners of the Interna-
tional Timetabling Competition 2007 used to solve the problems.
At last, Chapter 4 will illustrates an application at Hanoi University of Sci-
ence timetabling problem and some of writter’s ideas to tackle this problem.
iv
CHAPTER 1
The Timetabling Problem
1.1. Defin i tions
In the context of a university, a typical timetabling problems generally in-
volves assigning a set of events (lectures, exam, tutorials and so on) to a limited
number of timeslots and rooms in such a way as to satisfy a set of constraints.
The two most common forms of this problem are exam-timetabling problems and

course-timetabling problems, and in reality, the constraints imposed upon these can
often be quite similar. However, the crucial difference between them is usually con-
sidered to be that in exam timetables, multiple events can take place in the same
room at the same time (as long as the seating capacity is not exceeded), while in
course-timetabling problems, we are generally only allowed one event in a room
per timeslot [3].
In automated timetabling, the constraints for both types of timetabling prob-
lems generally tend to be separated into two groups: the hard constraints and the
soft constraints. Hard constraints have a higher priority than soft, and usually be
mandatory in their satisfaction. Indeed, timetable will usually only be considered
feasible if and only if all of the hard constraints of the problem have been satisfied.
Soft constraints, meanwhile, are those that we want to obey if possible, and more
often than not they will describe what it is for a timetable to be good with regards
to the timetabling policies of the universities concerned, as well as the experiences
of the people who will have to use it [3].
1
1.2. Appli cations
Timetabling problems and the methods to solve them have many applica-
tions to the real world. For example, it can be used to schedule the weekly timetable
in the universities, or schedule the worktime in some companies. To have a wider
view, in this section, we are interested in the second International Timetabling com-
petition and its problems.
The second I nternational Timetabling competions consisted of three prob-
lems, each representing a different problem in educational timetabling, name ly, ex-
amination timetabling, post enrollment based course timetabling, and curriculum
based course timetabling. This section provides a brief descriptscription of these
problems.
1.2.1. Examination Timetabling
1
The examination timetabling problem model presented in this problem is an

extension of the model commonly worked on. The fundame ntal problem involves
timetabling exams into a set of periods within a defined examination session while
satisfying a number of ha rd constraint. Like other areas of timetabling, a feasible
solution is one in which all the hard constraints are satisfied. The quality of the
solution is measured in terms of soft constraints satisfaction.
The problem consists of the following:
• A list of periods covering a specified length of time. The number and length
of periods are provided.
• A set of exams that are to be scheduled into these periods.
• For each e xam, a set of enrolled students is provided. Each student is enrolled
into a number of exams.
• A set of rooms with individual capacities.
1
This section is cited from T.Muller (200 7) [5], page 2.
2
• A set of additional period (e.g., exam A after exam B ) and room (exam A must
use room R) hard constraints.
• Soft constraints which contribute to a penalty if they are violated (including
details on weightings of these constraints).
A feasible timetable is one in which all examinations have a period and a
room assigned and the following hard constraints are satisfied:
• No student sits for more than one examination at a time.
• The capacity of individual rooms is not exceeded at any time during the ex-
amination session. Note that, unlike course timetabling, exams are explicitly
allowed to share rooms.
• Period lengths are not violated.
• Additional hard constraints must be satisfied.
The problem includes the following soft constraints:
• Two exams in a row: The number of occurrances when students have to sit for
two exams in a row on the same day.

• Two exams in a day: The number of occurrances when students have to sit for
two exams on the same day.
• Period spread: The number of occurances when students have to sit for more
than one e xam during a time interval specified by the institution. This is often
used in an attempt to be as fair as possible to all students taking exams.
• Mixed durations: The number of occurrances of exams timetabled into rooms
along with an exam with a different duration.
• Larger exams constraints: The number of l arge exams appearing in the latter
portion of the timetable. De finition of large and latter portion is a part of the
descriptscription of a particular instance.
• Room penalty: The number of times a room is used which has an associated
penalty. This is multiplied by the actual penalty as different rooms may have
the different associated weightings.
3
• Period penalty: The number of times a period is used which ha s an associated
penalty. This is multiplied by the actual penalty as different periods may have
the different associated weightings.
1.2.2. Post Enrollment based Course Timetabling
2
The timetabling problem in this problem is intended to simulate the real
world situation when students are given a choice of lectures that they wish to at-
tend, and the timetable then constructed according to these choices.
The problem consists of the following:
• A set of events that are scheduled into 45 timeslots (5 days and 9 hours each).
• A set of rooms, each of which has a specific capa city, in which the events take
place.
• A set of features that are satisfied by rooms and which are required by events.
• A set of students who attend various different combinations of events.
• A set of available timeslots for each of the events.
• A set of precedence requirements that state that certain events should occur

before certain others.
The aim is to try and insert each of the given events into timetable (that is,
assign each event to one of the rooms and one of the 45 timeslot) while obeying
following hard constraints:
• No students should be required to attend more than one event at the same
time.
• In each case, the room should be big enough for all of the attending students
and should satisfy all of the features required by the event.
• Only one event is put into each room in any timeslot.
2
This section is cited from T.Muller (200 7) [5], page 3-4.
4
• Events should only be assigned to timeslots that are pre-defined as available for
those events.
• Where specified, events should be scheduled to occur in the correct order dur-
ing the week.
Note that the first three hard constraints above are exactly the same as the
hard constraints used in the first problem. The last two hard constraints, however,
are new additions to the model.
In addition, to the five hard constraints given above, the following soft constraints
are included in the problem:
• Last timeslot of the day: Students should not be scheduled to attend an event
in the last timeslot of a day.
• More than two in a row: Students should not have to attend three or more
events in consecutive timeslots occuring in the same day.
• One class on a day: Students should not be required to attend only one event
in a particular day.
Note that these three soft constraints are the same as those used in the first
problem. The overall penalty is the sum of occurrances of a student in the soft con-
straints that are violated.

In this problem, it is allowable to produce an incomplete solution (some
events ma y be left una ssigned), however, all hard constraints on the assigned events
must be satisfied. Unplaced events are used to calculate a Distance to Feasibility
measure. This is calculated by identifying the number of students that are required
to attend each of the unplaced events and then simply adding these values together.
5
1.2.3. Curriculum based Course Timetabling
3
The curriculum based timetabling problem consists of the weekly scheduling
of lectures for several university courses within a given number of rooms and time
periods. Conflicts between courses are determined a ccording to the curricula pub-
lished by the University and not on the basis of enrollment data.
The problem consists of the following entities:
• Days, Timeslots and Periods: A number of teaching days in the week are
given (typically 5 or 6). Each day is splited into a fixed number of timeslots,
which is equal for all days. A period is a pair composed of a day and a timeslot.
The total number of scheduling periods is the product of the number of days
times the number of daily timeslots.
• Courses and Teachers: Each course consists of a fixed number of lectures to be
scheduled in distinct periods, is attended by a given number of students, and
is taught by a teacher. For each course there is a minimum number of d ays
over which the lectures of the course should be spread, moreover, there are
some periods during which the course cannot be scheduled.
• Rooms: Each room has a capacity, expressed as the number of available sea ts.
All rooms are equally suitable for all courses (if large enough).
• Curricula: A curriculum is a group of courses such that any pair of courses in
the group has students in common. Conflicts between courses, and other soft
constraints, are based on curricula.
The solution of the problem is an assignment of a period (day and timeslot)
and a room to all lectures of each course. The following hard constraints must be

satisfied:
• All lectures of a course must be scheduled, and they must be assigned to dis-
tinct periods.
• Two lectures cannot take place in the same room in the same period.
3
This section is cited from T.Muller (200 7) [5], page 4-5.
6
• Lectures of courses in the same curriculum, or taught by the same teacher,
must be scheduled in different periods.
• If the teacher of the course is not available to teach that course in a given pe-
riod, then no lectures of the course can be scheduled in that period.
The problem includes the following soft constraints:
• Room capacity: For each lecture, the number of students that attend the course
must be less than or equal to the seats in all the rooms that host its lectures.
Each student above the capacity counts as 1 point of penalty.
• Minimum working days: The lectures of each course must be spread into the
given minimum number of days. Each day below the minimum counts as 5
points of penalty.
• Curriculum compactness: Lectures belonging to a curriculum should be ad-
jacent to each other (i.e. in consecutive periods). For a given curriculum we
account for a violation everytime there is one lecture that is not ad jacent to any
other lecture within the same day. Each isolated lecture in a curriculum counts
as 2 points of penalty.
• Room stability: All lectures of a course should be given in the same room.
Each distinct room used for the lectures of a course, beside the first, counts as
1 point of penalty.
7
CHAPTER 2
Some General Algorithms
Nowadays, there are many algorithms produced to tackle the time prob-

lems. Here we will introduce to you some of the algorithms which can be con-
sidered as ’quite good’ for the experiments and results that they can provided for
the timetabling problems.
2.1. Genetic A l gorithms
1
2.1.1. Introduction and Some Fundamentals
Genetic algorithms are a general purpose optimization tool based on Dar-
win’s theory of evolution. They have the capability to produce solutions even when
the dimensions of the problem increase and for this reason they have been success-
fully applied to a wide variety of problems.
Genetic algorithms operate on a population of solutions represented by some
coding. A population consists of a number of genes, each of them is a unit of infor-
mation. New solutions are produced by combining genes from various population
members (we call it ’crossover’) to create offspring or by altering existing popula-
tion members (we call it ’mutation’). On the other ha nd, we also define 2 types of
mutition, that is light mutation (or small alteration) and heavy mutation (or large
scale alteration). Then a simulation of ’natural selection’ take place by first calculat-
ing the quality of each solution and choosing the fittest one to survive to the next
generation. Beside that, there are some important concepts that we should care such
as: chromosome (solution), gene (part of solution), allele (value of genes).
1
See M.A.Ay din (2008) [2] for more precisely details.
8
Now we are going to have a quick view about some important concepts in
genetic algorithm. That is chromosome and fitness function.
Chromosome Representation
Designing chromosomes plays an important role in genetic algorithm, since
each chromosome carry information for the solution a nd affect to the performance
of the algorithm. At the beginning, we consider how to design chromosomes by the
type of problem. There are two ways to design the structure of chromosomes. The

first one is direct encoding, which directly represents a solution by a chromosome.
However, since it is too simple, sometimes it caused troubles and make the solution
infeasible. In this case, indirect encoding is applied to perform the solution, where
each chromosome now is encode only the instruction of building a solution, not a
solution itself.
Fitness of a Solution
In genetic algorithm, fitness function is used to measure how good a chro-
mosome will be. The fitness function is a specific problem. For instance, if we want
to minimize a function, or in other words, minimize its cost, then the fitness func-
tion is the cost itself. In the most timetabling problems, quality of a chromosome is
measured by number of constraints satisfied.
2.1.2. Main Ideas of Gene t ic Algorithm
In genetic algorithm, the main ideas consist of 3 steps. The first step is cre-
ating a set of solutions (a population) randomly. The next step is selecting chromo-
somes from the initial population for the next generation. This selection is based on
some criterias and there are some different methods to cope with it. Finally, the last
step is recombining the selected chromosomes from step 2 to create the n ew popu-
lation.
9
Now we focusing on the second step, that is the step of selecting chromo-
somes from the initial population. Here fitness function is used to decice which
parents will be chosen by evaluating the quality of solutions represented by those
chromosomes in the population. Those with higher fitness value will have a greater
chance of being chosen than those with lower fitness value. There are many differ-
ent methods of selection in genetic algorithm. One of them is a standard method
which called Roulette Wheel. In this kind of method, each chromosome will be de -
scribed as a slice in a circular wheel, and the chromosome with higher fitness value
will ha ve larger slice in the wheel. For example, if there are N chromosomes in the
population, the wheel will rotate N times. Each time the wheel rotate, it will stop at
any chromosome, and that chromosome will be chosen as parents to the next gener-

ation. So the selection is end up with N selected chromosomes, keeping the number
of chromosomes in the population. It is clear that the chromosome with higher fit-
ness value will have more chance of being chosen than the one with lower fitness
value, since it has a larger slice in the wheel. Note that a chromosome can be cho-
sen more than once. Another method is called ’Tournamen Selection’. In this kind
of method, two chromosomes will be chosen randomly from the population, a nd
the one with higher fitness value will be sele cted as the parent. After that, the two
chromosomes will be returned to the initial population, and they can be selected
again.
After finishing the second step, the last step ’recombination’ will take place.
From the second step we can see that the selected chromosomes are the ones with
high quality (since they have high fitness value), so it is reasonable to believe that
the ne xt generation will be better than the previous one. Now the question is: how
to recombination these chromosomes? In genetic algorithm, there are two main re-
combination operators, which called ’crossover’ and ’mutation’ (as shown in 2.1.1).
Crossover
In the crossover operation, the material of selected chromosomes will be mixed to
create offspring. If chromosomes are represented in bitstring, it will be done as fol-
lows. A crossover probability will be defined first. Then a random number will be
chosen in the interval [0;1]. If the crossover probability is greater than the random
number, the crossover operation will be applied . If not, the crossover operation will
not be applied, and the child chromosomes are the copies of their parents. Note that
the crossover probability plays an important role here.
10
There are many method used in designing crossover operator in literature.
Although they can be changed by problem type, the most common used in crossover
operators are as follows:
N-points Crossover In N-points crossover method, one-point crossover and two-
point crossover are the simplest and widely used crossover method. These methods
can be described as follows. For instance, in one-point method, a number less than

the length of chromosome will be selected randomly as the crossover point. Then
the genetic material before the crossover point will remain unchanged, while the ge-
netic material after the crossover point is exchanged between the parents. The idea
of one-point crossover can be generalized to N-point crossover by using N crossover
point rather than just one. For instance, in two-point crossover, 2 numbers less than
the length of chromosome will be selected randomly and represent crossover points.
Then the genetic material between these two points will be swapped, while others
remain unchanged. An example of two-point crossover method is given in Figure
2.1.
Figure 2.1: Two-point crossover
Uniform Crossover In uniform crossover a swapping probability is defined in order
to give a chance for an allele to be exchanged with the gene of the other parent. This
11
probability usually takes the value of 0.5.
Partially Matched Crossover (PMX) In partially matched crossover, two parents
are randomly selected and two crossover points are generated randomly. Alleles
within the two crossover points of a parent are exchanged with the alleles corre-
sponding to those mapped by the other parent. Figure 2.2 illustrates an e xample
of partially matched crossover. According to the example, firstly the genes between
two crossover points are swapped between two parents. Then the first gene value in
Parent 1 within the two crossover points, 7 , maps to 9 in Parent 2. Therefore, genes
7 and 9 are swapped i n Parent 1. Similarly, 8 and 2, also 4 and 1 a re exchanged
to create the offspring Offspring 1. Corresponding changes are done in Parent 2 to
create the offspring Offspring 2 [2].
Figure 2.2: Partially matched crossover
Mutation
In genetic algorithms, most chromosomes in the population seem like each other
after a number of generations. What it means is that, no crucial changes in the pop-
ulation, therefore in the search space do not occur. To overcome this problem and
add diversity to the population mutation operator is used. Mutation operator has

the effect of creating a new chromosome which cannot be created by the original
crossover operator [2].
12
After the crossover is appied and offsprings are formed, they have a chance
of being mutated. Mutation operators change one or more gene values in a single
chromosome. For the chromosomes represented in binary string, the mutation op-
erator works as follows: A number in the interval [0;1] is generated randomly and
compared to a predetermined mutation rate. Mutation rates used in literature are
usually very small (e.g. 0.001). If the random number is greater than the mutation
rate, mutation is not applied. If not, then the gene value is changed artificially from
0 to 1 and 1 to 0 (see Figure 2.3)
Figure 2.3: Mutation operator
Replacement
After new offsprings are created by crossover operation and mutation oper-
ation, forming up the successor generation is the next step. Note that the parents
were selected according to their fitness value, so we have reasons to expect that the
new offsprings will increase the fitness value of the population generation. Through
replacement, genetic algorithms decice whether offsprings will survive or not. Some
of the most common replacements are described below.
13
Complete Replacement All the members of the previous generation will be deleted
and replaced by the same number of new chromosomes that have just bee n created.
Steady-state Just n members of the previous generation will be deleted i nstead of
all. Then n new chromosomes will replace them. The choice of n and which mem-
bers to be deleted is an important point here.
Replacement with elitism Like the complete replacement, all the old members will
be deleted but only one or two of the new chromosomes that have the highest fitness
value will be chosen for the next generation.
2.2. Memetic Algorith ms
2

The concept of a memetic algorithm was first introduced by Moscato and
Norman to describe evolutionary algorithms in which local search is used to a large
extent. This ide a has further been formalised by Radcliffe and Surrey and a compar-
ison between memetic and genetic algorithms made. A meme can be thought as a
unit of information that reproduces itself as people exchange ideas. A meme differs
from a gene in that as it is passed between individuals, each individual adapts the
meme as it sees best whereas genes are passed unaltered [1].
2.2.1. Solution Representation
Each solution in the population is represented as a number of memes. Each
meme contains information on what exams are scheduled in which rooms for a par-
ticular period. A further meme is used to hold exams which could not be scheduled
in the prescribed period. Figure 2.4 shows an example of an encoded solution, where
e
i
is exam number i.
2
See E.K.Burke, J.P.Newall and R.F.Weare [1]for more precisely details.
14
Figure 2.4: The problem encoding
2.2.2. Generating the First Population
The initial population will be created by a weighted roulette wheel which
used to decide which period will be assigned for an selected event e based on the
scheduled events. This idea consists of 3 following steps:
• Step 1: Choosing randomly an event e from those events which are unassigned.
• Step 2: Decide which period will be assigned for that selected event by the
following fitness function (note that the chosen period must be legal for the
selected event)
numCommon + Size + 1
penalty + 1
(1)

where numCommon is the number of neighbor that e has in common with the
exams already scheduled in that period, Size is the number of exams that al-
ready scheduled in the period and penalty is the cost of placing e in that pe-
riod. This function shows that the fitness value of a period is proportional to
the number of neighbor that event e has in common with the events that have
been scheduled in this period. Moreover, this function tries to find the period
which increases penalty the least by biasing the roulette wheel.
15
• Step3: Construct and execute a roulette wheel based on the values calculate to
choose a period in which to place e.
By this way, a higher quality population will be produced rather than a normal
random population. Beside that, the diversity of population is still kept, as expect
as in Genetic Algorithm.
2.2.3. The Evolutionary Opera tors
There has been some debates as to whether should be the main operator in
a Genetic Algorithm. It has been also suggested that local search has a part to play,
this approach being known as memetic s. A directed mutation approach has also been
found to achieve good results. [1]
The algorithms presented here has been found to work well using a combination
of light and heavy random mutation, follow directly by the Hill Climbing me thod.
Figure 2.5 shows how this combination works.
The light mutation operator This operator chooses n e vents at random to resched-
ule into some other periods (hard constraints should be satisfied, obviously), then it
is followed by Hill Climbing algorithm, which is described below.
The heavy mutation operator This period is given in order to construct a good so-
lution quickly. In this operator, a period or a whole periods will be destroyed. The
periods which is considered as ’good’ will be kept, and the events in the remaining
periods will be rescheduled. Now the question is, how can we measure the quality
of a period. In this situation, the following steps is performed to cope with it.
• Consider each period i at a time, assume that all the events scheduled to period

j (with j is not equal to i) are fixed. Calculate the penalty caused by events
which are assigned to period i.
• If this pe nalty is lower than the average penalty then the probability of being
destroyed of that period is measured as follows.
P (disr upt) =
penalty + 0.2
2.averag e
(2)
16
Figure 2.5: The evolutionary operator
• If this penalty is greater than the average penalty, then there are 2 cases. Case
1, if the la st period was not destroyed then destroy the next period instead of
the current considered period. Case 2, if the last period was destroyed, then
destroy the current considered period.
After the destroyed periods are deciced, ea ch exam in these periods will
be considered to move to the first other legal period. Followed by Hill Climbing
method, one can hope that improvements will be made . This method uses a tech-
nique of calculating the penalty caused by scheduling a particular event to a partic-
ular method, given the other events are fixed. This has advantage when trying to
reschedule individual event, the improvement can be found in a fraction of time that
it would take to perform a full evaluation. The idea of this method can be described
as follows.
• Choose a period i in turn. For each event e in this period, schedule it to each
period in the timetable. If no hard violation is made, then calculate the penalty
caused by this arrangement.
• Choose the period which increase the total penalty the least.
• Try to schedule the unscheduled events.
17
In order to ascertain the value of a solution the evaluation function is appied
to it to calculate its fitness, and therefore its ability to survive in the total popula-

tion. For the trials shown below the objective was to schedule all events in the given
number of periods such that if a student has two exams on the same day then there
should at least be a full p eriod between them. This evaluation function can be ex-
pressed as:
10numEvents
200numUnscheduled +

numPeriods−1
i=0
NumCon f licts(Period
i
, Period
i+1
)
where numEvents is the number of events in the timetable, numUnscheduled is the
number of events not scheduled in a period yet, and NumConflict is a function re-
turning the number of conflicts, weighted by student numbers, between two periods
on the same day [1].
After applying those operators above, the size of population is overwhelm-
ing. To pass this situation, only some events will be chosen to the next generation.
This can be done by using the classic roulette wheel selection, in which each event
is performed as a slice proportional to its fitness value. This wheel will rotate the
same number of times as the total number of events in the new population.
Beside that, there are some good algorithms should be considered in the
problem such as: tabu search, group-based operators, conflict-based statistics, etc.
But these methods are still hard to be used to find an optimal solution quickly and
efficiently.
18
CHAPTER 3
Specific Method for the International

Timetabling Competition
3.1. Algori thm
1
Here is an algorithm given by an competitor in the second International
Timetabling competition. The algorithm consists of several phases. In the first
phase, a complete solution is found by using an Iterative Forward Search algorithm.
This algorithm make use of Conflict-based Statistics to prevent itself from cycling. In
the next phase, a local optimum is found by using a Hill Climbing algorithm. once a
solution can no longer be improved using this m ethod, the Great Deluge technique
is used. The Great Deluge algorithm is altered so that it allows some oscillations of
the bound that is imposed on the overall solution value. Optionally, Simulated An-
nealling can also be used between bound oscillations of the Great Deluge algorithm.
The search ends after a predetermined time limit ha s been reached. The best
solution found within that limit is returned.
3.1.1. Construction Phase
Initially, a complete solution is found using Iterative Forward Search algo-
rithm. It starts with all variables unassigned. In e ach iteration, an unassigned vari-
able will be chosen and assigned to a value in its domain. If any hard violation
is made, then the conflicting variables are unassigned. For example, if there is an-
other class in the selected room and selected time, that class will be unassigned. The
1
SeeT.Muller (2007) [5], p age 5-7 f or more precisely details.
19

×