Professional Documents
Culture Documents
Timetabling
by
Yam Ling CHAN
Master of Applied Science in Information Technology
email yam@numbat.cs.rmit.oz.au
i
Declaration
I certify that all work on this thesis was carried out between August 1993 and March
1994 and it has not been submitted for any academic award at any other college, institute
or university. The work presented was carried out under the supervision of Dr Vic Ciesiel-
ski who proposed using an iterative process together with a generic Genetic Algorithms
to solve timetabling problems. Dr Vic Ciesielski also helped clarifying ideas suggested to
implement the system. All other work in the thesis is my own except where acknowledged
in the text.
Signed,
ii
Acknowledgement
I would like to thank Dr Vic Ciesielski for his supervision and Mr Alex Rosenberg for
helping with the proof-reading.
iii
Contents
1 Introduction 2
1.1 General Outline : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : 2
1.2 Goal : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : 3
2 Literature review 4
2.1 Outline : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : 4
2.2 Timetabling : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : 4
2.2.1 Piece-wise Incremental Construction : : : : : : : : : : : : : : : : : 5
2.2.2 Heuristic Tree Search : : : : : : : : : : : : : : : : : : : : : : : : : : 6
2.2.3 Iterative Scheduling : : : : : : : : : : : : : : : : : : : : : : : : : : : 7
2.2.4 Genetic Algorithms : : : : : : : : : : : : : : : : : : : : : : : : : : : 7
2.2.5 Simulated Annealing : : : : : : : : : : : : : : : : : : : : : : : : : : 8
2.3 Constraint Analysis : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : 9
2.3.1 Constraint classication : : : : : : : : : : : : : : : : : : : : : : : : 9
2.3.2 Constraint representation : : : : : : : : : : : : : : : : : : : : : : : 9
2.3.3 Macroscopic constraint structure : : : : : : : : : : : : : : : : : : : 10
2.4 Genetic Algorithms : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : 10
2.4.1 General introduction : : : : : : : : : : : : : : : : : : : : : : : : : : 10
2.4.2 Application consideration : : : : : : : : : : : : : : : : : : : : : : : 12
2.4.3 Encodings in GA : : : : : : : : : : : : : : : : : : : : : : : : : : : : 13
2.4.4 Fitness evaluation : : : : : : : : : : : : : : : : : : : : : : : : : : : : 17
2.4.5 Choosing genetic operators : : : : : : : : : : : : : : : : : : : : : : : 18
2.4.6 Choosing run parameters : : : : : : : : : : : : : : : : : : : : : : : : 21
2.4.7 Deceptiveness : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : 23
3 Iterative Timetabling Model 25
4 Generic GA Shell 26
4.1 Chromosome structure and dynamic encoding : : : : : : : : : : : : : : : : 26
4.2 Constraint representation and generic tness evaluation : : : : : : : : : : : 27
4.2.1 General principle : : : : : : : : : : : : : : : : : : : : : : : : : : : : 27
4.2.2 Constraint data structures : : : : : : : : : : : : : : : : : : : : : : : 27
4.2.3 Generic tness evaluation : : : : : : : : : : : : : : : : : : : : : : : 29
4.3 Generic GA environment : : : : : : : : : : : : : : : : : : : : : : : : : : : : 30
5 Improving Eciency 31
5.1 Constraint propagation : : : : : : : : : : : : : : : : : : : : : : : : : : : : : 31
5.1.1 Single valued constraint propagation : : : : : : : : : : : : : : : : : 31
5.1.2 Propagation sequence : : : : : : : : : : : : : : : : : : : : : : : : : : 32
5.1.3 Pseudo code : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : 33
5.2 Handle illegal variable values : : : : : : : : : : : : : : : : : : : : : : : : : : 33
iv
5.3 Improved Fitness Evaluation Function : : : : : : : : : : : : : : : : : : : : 34
6 Two Experiments 35
6.1 Master by coursework timetable : : : : : : : : : : : : : : : : : : : : : : : : 35
6.1.1 The chromosome : : : : : : : : : : : : : : : : : : : : : : : : : : : : 36
6.1.2 Constraints : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : 36
6.1.3 Constraint representation : : : : : : : : : : : : : : : : : : : : : : : 37
6.1.4 Fitness evaluation examples : : : : : : : : : : : : : : : : : : : : : : 38
6.1.5 Result : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : 38
6.2 University faculty timetable : : : : : : : : : : : : : : : : : : : : : : : : : : 39
6.2.1 The chromosome : : : : : : : : : : : : : : : : : : : : : : : : : : : : 39
6.2.2 Constraints : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : 40
6.2.3 Constraint representation : : : : : : : : : : : : : : : : : : : : : : : 40
6.2.4 Constraint compilation : : : : : : : : : : : : : : : : : : : : : : : : : 42
6.2.5 Fitness evaluation : : : : : : : : : : : : : : : : : : : : : : : : : : : : 43
6.2.6 Result : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : 43
7 Conclusion 60
7.1 Summary : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : 60
7.2 Further work : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : 60
v
Abstract
We present a new approach to timetabling which is a typical Constraints Satisfac-
tion Problem. The new approach is based on an iterative scheduling model equipped
with a generic Genetic Algorithm (GA) search engine. The iterative model is the
model that practitioners used to schedule school time tables. Generality of the GA
engine is achieved by dynamic chromosome encoding, generic constraint data struc-
ture and robust GA operators. The implemented system has been tested on two
university timetabling problems. The rst one is a departmental timetable with hy-
pothetical schedule requirements. The second one is also a departmental timetable
which is specied in a previous research. Timetables generated in the second ex-
periment are comparable to previous work using parallel machines. Performance is
satisfactory, although performance data was not available in previous work for further
comparison.
1
1 Introduction
1.1 General Outline
Timetabling problems usually have huge and highly constrained solution spaces. They are
typical combinatorial optimization problems which are computationally NP-complete, that
is, there are no known polynomial time algorithms which can guarantee nding a solution.
Genetic algorithms (GAs), rst specied by John Holland in the early seventies, are very
successful in solving many complicated optimization problems. GAs are especially success-
ful in providing near optimal solutions to many NP-complete problems within polynomial
time frames. GAs should be good tools to solve timetabling problems.
However, GAs are not generic. We need to hand craft a solution representation and a
program to evaluate and compare potential solutions for each new problem. Besides, the
performance of a GA is sensitive to run parameters which are problem dependent. Subop-
timal run parameters will cause a GA to get stuck in a suboptimal solution or will cause
a GA to take a longer time to reach the global optimum. GAs are also non-deterministic.
No algorithm can estimate how long will it take a GA to converge to the optimal solution
and whether the solution reached is optimal or not.
A practical timetabling problem usually involves a large solution. A single department in
a university may have over a hundred classes (including lectures, tutorial and laboratory
sessions) to schedule. It is dicult to review the whole solution at once. Furthermore,
there will also be a large number of constraints. It is dicult to accurately estimate their
priorities all at once. A timetabling process is therefore usually an iterative process :
1. Specify classes to be scheduled.
2. Specify constraints.
3. Generate a potential time table.
4. Review the potential time table.
5. Modify constraints (add some, remove some, relax some and/or tighten some).
6. Re-generate the potential time table.
The review, modify and re-generate processes are repeated until a satisfactory time table is
found. This practical iterative process can help to solve the domain dependent run param-
eters and non-deterministic draw backs of GAs. In an iterative GA environment, the GA
will be set to stop after running for a xed time frame. Best solution found at that point
will be reviewed and new constraints are generated to guide the search in next iteration.
2
In this study, we will investigate the potential of developing a generic GA engine geared
with the iterative process to generate a generic scheduler that can be applied to solve
timetabling problems for dierent universities and/or high schools.
1.2 Goal
Scheduling a new time table in the iterative GA environment will look like this :
1. Specify the time table and constraints.
2. Compile the time table data and constraints to formats which the GA engine can
recognize.
3. Search potential time table.
(a) generate the time table representation in the GA
(b) run the GA for a xed time frame (with reference to the constraint data)
(c) report the best time table found so far
4. Review.
(a) review the best time table found
(b) conrm the acceptable part of the best time table
(c) modify constraints
5. Repeat the search and the review process until whole time table is acceptable.
The rst goal of this research is to study the possibility of, and if possible, those ways
of adapting a GA engine to the generic iterative timetabling environment, that is a GA
engine capable of doing step 3 above. The GA engine should also be able to accept partial
time table conrmed in step 4.
The second goal of this research is to study ways of improving the performance of the
generic GA engine.
While it has been necessary to make some decisions about and implement a constraint
specication language, the corresponding compiler, a user interface and a timetabling re-
lated databases, that is, systems required to perform steps 1, 2 and 4 above, these are not
the primary objectives of this study.
3
2 Literature review
2.1 Outline
Timetabling basically involve two processes, specication and search.
The specication process species the basic elements of the problem and also the con-
straints to be imposed on these basic elements.
Basic elements of a timetabling problem include classes to be scheduled, time slots avail-
able, rooms available, teachers available.
Constraints to be imposed on these elements include schedule preferences and avoiding
con
icts. An example of schedule preferences can be that lectures are better scheduled in
the morning, but if we cannot t all lectures into the limited time slots in the morning, it
is still acceptable to schedule some of them in the afternoon. An examples of con
ict can
be that no two classes can be scheduled in the same room at the same time.
The search process searches through the solution space for a solution with no, or least
constraint violations. Various search methods can be employed here.
In recent years, GA has emerged as a promising general purpose search algorithm. Al-
though GA cannot guarantee to return the optimal solution, and also although GA cannot
guarantee the search time under dierent requirements and conditions, various experiments
and studies have indicated that GA can provide solutions to NP-complete problems which
traditional search method fail to provide.
In this section, we will take a closer look at the following areas :
The timetabling problem, its analysis and various approaches employed to tackle the
problem
Constraints, their classication and representation
Genetic Algorithms, a general introduction and an analysis of their strengths and
weaknesses.
2.2 Timetabling
Timetabling is a typical Constraint Satisfaction Problem (CSP). An instance of a CSP
involves a set of variables, a domain for each variable specifying the values that each vari-
able may be assigned and a set of constraints on the variables. There are two categories of
constraints. Hard constraints dene which combinations of domain values are allowed and
which are not. Soft constraints dene which combinations of domain values are preferred
4
over some other combinations. To solve a CSP is to assign values to variables such that all
hard constraints are satised simultaneously and the variable values are the most preferred
values as specied by the soft constraints ([Nuijten et al. 93], [Feldman and Golumbic 90],
[Rossi 88]).
In timetabling, the variables are classes, time-slots, rooms, teachers etc. Domains are
classes to be scheduled, time-slots, rooms and teachers available for scheduling each class.
Examples of constraints are :
Each class should be scheduled once and only once.
There should not be any time clashes. That is, no two classes should have the same
time-slot and room assignments and no two classes should have the same time-slot
and teacher assignments.
Rooms should be large enough to accommodate the classes to which they are assigned.
Therefore, a timetabling problem can be approached with CSP techniques.
In general, a CSP problem can be formulated and solved with an incremental construction
approach or with a heuristic repair approach.
In the incremental construction approach, each node of the tree is dened as the pair (vars,
vals) where vars is the set of instantiated variables and vals is the current instantiations
of vars. The current instantiations should violate no constraint. Going from one node to
another is done by instantiating an additional variable. At any node, a limited number of
additional variables may be instantiated, this dened the edges of the tree. The root of the
search tree is the node with no variable instantiated and current instantiation is empty. A
feasible solution is a leaf node with all variables instantiated and with current instantiation
not empty for every variable ([Nuijten et al. 93], [Feldman and Golumbic 90], [Rossi 88]).
Instead of constructing a solution by extending consistent partial assignment as is in the
incremental construction approach, the heuristic repair approach starts by assigning a ten-
tative value to every variable, resulting in a possible inconsistent full assignment. The
algorithm then modies this assignment by replacing variable assignments that reduce the
number of remaining con
icts, until all con
icts are resolved. We can use any local search
procedure to search for the variables to be modied and for the new assignment values
([Nuijten et al. 93], [Abramson and Abela 91], [Abramson 87]).
Below, we will discuss some previous work on solving a scheduling problem in general.
5
2.2.1 Piece-wise Incremental Construction
This approach starts with a partial schedule that satises all simple hard constraints (refer
to 2.3 for denition of hard constraints), such as the lectures for course CS028 must be
scheduled in the rst time-slot in Monday and Tuesday afternoon. Then, a schedule with
other classes that involved more constraints are built on top of this partial schedule. Users
are responsible for selecting the variable and value for next instantiation and also for dead
end backtrack handling. The system will only check and report constraint violations for
the current instantiations. This is a typical incremental construction approach with no
search heuristic encoded.
[Murphy 87] has implemented TIMELOG with this approach to schedule high school
timetables. In TIMELOG, commands are provided to add or delete a (class, time-slot,
teacher, room) assignment. TIMELOG will check for constraints and resources viola-
tion and do the necessary updates. Partial and/or group assignments are also allowed.
TIMELOG will try to search, with a Prolog engine, for those missing values in the partial
assignment. However, users are not encouraged to use this automatic scheduling facility
when the number of classes to be scheduled and the number of available resources remain
large.
2.2.2 Heuristic Tree Search
Although exhaustive search through the solution space is not feasible, we can use heuristics
to reorder and/or reduce the solution space to increase the chance of reaching a feasible
solution in an early stage of the search.
Below are some examples of heuristics used in solving CSP problems :
Constraint propagation. The instantiation of some variables, through the set of
constraints, will restrict the domains of those not yet instantiated variables. This can
reduce the number of edges, that is the size, of the current subtree ([Nuijten et al. 93],
[Feldman and Golumbic 90]).
Partial constraint propagation. Propagate constraints with order (refer to 2.3 for
denition of constraint order) equal to or higher than three is again a NP-complete
problem. A modied approach is to propagate only unary and binary constraints.
([Feldman and Golumbic 90]).
Critical variable selection. Select the critical variable which is the variable with the
smallest number of remaining values for next instantiation. This will help the search
to avoid dead end subtrees, and if the current search subtree is a dead end, this will
help the search to reach the dead end earlier ([Nuijten et al. 93]).
6
Least constraining value selection. Select the least constraining value which is the
value that make the variable participate in most solution for next instantiation. This
will increase the chance of reaching a feasible solution ([Nuijten et al. 93]).
[Butler and Morley 92] have used an incremental construction algorithm to work out the
networked power transmission equipment maintenance timetable. The algorithm works
quite well for about a dozen power distribution stations. As the number of power stations
increase, knowledge on outstanding work and resources available become unmanageable.
The paper suggested a distributed environment to improve the algorithm.
[Srinivasan and Sterling 92] have used an incremental construction algorithm to schedule
oil tanker routes to meet crude oil requirements of dierent renery locations and to sched-
ule truck vehicles on various routes to meet material requirements of destinations.
[Feldman and Golumbic 90] used the partial constraint propagation approach to solve the
student scheduling problem. The system developed can help students to choose courses
that do not cause any time con
ict for the coming semester.
Two problems are common to these studies. First, we need domain specic scheduling
heuristics to improve performance. Second, time taken for a solution deteriorates expo-
nentially with increase in number of variables and the size of variable domain. To tackle
the second problem, [Nuijten et al. 93] have introduced the randomized dead end restart
tree search algorithm to maximize the chance of nding a solution within a xed time
frame.
2.2.3 Iterative Scheduling
Basically, this is also an incremental construction approach. But it allows user intervention
to remove system allocations, add, remove or modify constraints until the system nd an
acceptable solution. This user intervention helps to reduce the search space. But domain
specic knowledge is expected from the user. This approach diers from piece-wise incre-
mental approach in that the system will try to do as much assignments as it can in each
iteration.
[White and Wong 88] have implemented a university timetabling system using this ap-
proach. Results have shown that the system can nd a timetable with no con
ict when
used at the departmental level.
8
remark on this implemented algorithm is same as that on [Abramson and Abela 91] above.
9
Finally, we can represent constraints as something between pure data and pure logic. The
choice of representation is application dependent and will signicantly aect the processing
eciency.
2.3.3 Macroscopic constraint structure
A single schedule requirement can be satised by more than one condition, e.g. both
Thursday and Friday can satisfy the requirement after Wednesday. A schedule require-
ment can therefore be represented as a single constraint which consists of disjunction of
several conditions.
A timetabling problem usually has a number of schedule requirements to be satised si-
multaneously, therefore, the constraints or the set of constraints to a timetabling problem
is a conjunction of a number of schedule requirements which is in turn a disjunction of sev-
eral conditions. Obviously, the natural macroscopic constraint structure to a timetabling
problem is the conjunctive normal form.
With the representation in conjunctive normal form, evaluation of constraint violation
for a timetable will be simplied to the evaluation of each individual conjunction. To-
tal constraint violation of a timetable will be the sum of violations for each individual
conjunction.
10
The general algorithm can be roughly outlined as follows :
Procedure GA
begin
initialize Population;
evaluate Population;
while (not terminate) do
begin
select individuals from Population to form Parent Population;
crossover parents in Parent Population to form Child Population;
mutate Child Population;
evaluate Child Population;
create new Population from Child Population
or from both Child and Parent Population;
end
end
Initialize set up the initial population. It can be a random population evenly covering
the solution space or can be seeded with possibly high performance individuals from users
input.
Evaluate calculates the objective function value for all individuals in the population. Eval-
uation represents the only problem- specic part of a genetic algorithm.
Select choose parent individuals to undergo crossover. Selection is a probabilistic function
of each individual's performance. This performance biased selection directs the search pro-
cess to focus on more promising areas of the solution space.
Crossover recombines string segments from two parent individuals to form new, hopefully
better performing osprings.
Mutate inverts single bits of individuals based on a user dened probability. Mutation
introduces innovation into the population.
Create new replace the Old Population with the Child Population in the classical al-
gorithm. In steady state GA, elistist selection is used to create the new population by
retaining the best performing individual(s) found in both the Child and Parent Population.
GAs dier from traditional search techniques in several ways. First, genetic algorithms
are designed to optimize the trade-o between exploring new points in the search space
and exploiting the information discovered thus far. This was proved using an analogy with
the two armed bandit problem [Goldberg 89a]. Second, GAs have the property of implicit
parallelism. Implicit parallelism means that GAs process a large number of schemata (re-
fer to common terms used in the GAs literature below for denition) concurrently. For
11
a GA with an population size m, the number of schemata sampled is on the order of m3
[Goldberg 89a]. Third, genetic algorithms are randomized algorithms, as GAs use oper-
ators whose results are governed by probability. The results for any given operation are
based on the value of a random number. Fourth, GAs operate on several solutions si-
multaneously, gathering information from many current search points to direct subsequent
searches. Their ability to maintain multiple solutions concurrently makes GAs less suscep-
tible to the problems of local maxima and noise.
Much research has been done since GAs were introduced in early seventies. Many enhance-
ments are suggested to improve GA's performance and extend its application problem do-
mains. We will only discuss those enhancements which are related to the current study.
Before we go further, let us dene some common terms used in the GA literature :
chromosome - a solution or a point in the solution space, usually represented by a
binary string.
gene - a segment of the chromosome that represents a particular attribute of the
solution.
allele - the value taken by a particular gene.
locus - the position of a gene in the chromosome.
schema - lower order space (hyperplane) in the solution space, denoted as an ordered
list of symbols. Each symbol is either a legal allele or a wild card symbol which
matches any value.
subschema of a schema - lower order space (hyperplane) of a schema. It is denoted
as an ordered list of symbols same as that denote the schema, except some genes are
replaced by wild card symbols.
order - a measure of the schema's specicity, that is the number of symbols in the
schema that are not wild card symbols.
defining length - the distance between the left most and right most specic or non-
wild card symbols in a chromosome. It is equal to the number of symbols, both
specic and wild card, between them plus one.
fitness - the performance of a chromosome as measured by the evaluation function.
2.4.2 Application consideration
GAs are the principal heuristic search method of classier systems, a form of stochastic
production system; they have been tried on NP-hard combinatorial optimization problems,
such as network link optimization and the traveling salesperson problem; and they are of
12
interest in themselves as primitive models for natural selection.
GAs have also been applied to problems such as design of semiconductor layout and factory
control, and have been used in AI systems and neuromorphic networks to model processes
of cognition such as language processing and induction. Like associative memories, neuro-
morphic networks, and simulated annealing, GAs and GA-based heuristic algorithms are
one way to achieve sub-symbolic, graceful, and adaptive systems.
Applying GA to solve an optimization problem involves the following tasks :
encode (represent) solutions to the problem to a chromosome (by a bit string)
formulate tness evaluation function
select or create the appropriate genetic operators (crossover, mutation, selection etc)
select run parameters (population size, cross-over rate, mutation rate, generation
gap, convergence criteria etc.)
We shall discuss, in the following sections those enhancements suggested in these areas, as
well as suggestions to improve GA's eciency in general.
2.4.3 Encodings in GA
1. Cardinality
In GA, a chromosome is encoded as a string of symbols. The symbols can be of any
cardinality. Binary symbol is most commonly used in chromosome encoding because
it is simple, it can represent maximum information with minimum number of bits
and because a binary chromosome can be operated with common genetic operators
found in most GA packages.
However, higher cardinality sometimes can provide benet that binary encoding can-
not provide. For example, higher cardinality can help avoiding illegal chromosomes
created by genetic operators. For example, if a variable can take 5 valid values, 3
bits are needed to represent this variable. With 3 bits, the 5 valid values can be
represented by the binary value 0-4, binary value 5-7 generated from crossover or
mutation will be illegal.
But if we use an octal encoding, the invalid values can rst be avoided in the creation
of initial population. Subsequent crossover and mutation will treat the 3 bits as a
single unit and will only split the chromosome at the 3 bits boundary. Results of the
genetic operation will thus be all valid values. The drawback of this higher cardinal-
ity encoding is that it requires a larger population to obtain the appropriate allele
13
coverage [Goldberg 89a]. The optimal population size will depend on the cardinality.
In addition, special genetic operators are required.
2. Approaches to encoding
There are many researches on applying GAs to solve scheduling problems. Analysing
them shows that there are mainly three approaches to encode a scheduling problem
[Michalewicz and Janikow 91].
(a) Direct encoding
This is a simple, strict forward approach. This method directly represents a
solution by a chromosome. Constraints violation is penalized by decreasing the
chromosome tness. A penalty function is included in the tness evaluation
function.
[Abramson and Abela 91] used a variable length, direct representation to solve
a timetabling problem with parallel GA. Their representation will produce il-
legal solutions to amend which need special operators. [Corne et al. 92] used
a direct representation to solve an examination scheduling problem. Schedule
tness is inversely proportional to the number of constraints violated.
(b) Indirect encoding
Direct encoding is not always possible or eective. When the solution space is
highly constrained, we will need domain specic operators to restrict the search
to within the legal solution space.
An alternate scheme is to encode only the raw information of the solution instead
of the whole solution. A solution builder or decoder equipped with constraint
information is used to process the raw information and build a legal solution.
With this scheme we can use a simple chromosome structure and genetic oper-
ator.
[Syswerda and Palmucci 91] used this scheme to solve a job shop scheduling
problem. They encoded only the tasks' order as the chromosome and used a
schedule builder to build a legal schedule from the tasks' order.
This indirect encoding scheme shifted part of the search load to the solution
builder. The solution builder usually uses a heuristic approach to search for the
legal schedule from the raw information. Therefore, a problem with indirect
encoding is that we have to decide how to divide the search load between the
solution builder and GA. But, as GAs are powerful search engines, search load is
better put on GA as long as it does not require domain specic operators. Along
this line, [Bagchi et al. 91] used a similar scheme with the additional problem
14
specic information such as job priority also encoded in the chromosome. This
additional information has extended the solution space to be searched by GA
and yielded a more desirable result.
Other examples of indirect encoding include [Smith 85] targeting a bin packing
problem, and [Davis 85] targeting another job shop scheduling problem.
But luckily, GA is robust. GA is robust in the sense that no matter what encoding
we use, as long as we can supply the corresponding tness evaluation function and
as long as the the encoding is not deceptive (we shall discuss deceptiveness again in
2.4.7), GA will be able to return an optimal or near optimal solution [Goldberg 87].
In this sense we do not have to worry too much about the encoding.
However, in a real life practical application, besides nding a solution, we are also
constrained by available resources like computer processing power, memory, time
available to solve the problem etc. Although dierent encodings will all lead to sim-
ilar near optimal solutions, some encodings are more ecient than others.
[Davidor 91] proposed and dened a measure to represent epistasis and suggested a
statistical way to estimate the measure from a sample population. However, for this
16
measure to be of practical value, we still need a condence measure that ensures the
accuracy of the epistasis measure. Research is still going on in this area.
We will not go into Walsh function analysis here. Please refer to [Goldberg 89a] for
more details.
17
2.4.5 Choosing genetic operators
Classical GAs use k-point (mainly 2-point) crossover operators (kX). In a 2-point crossover
(2X), 2 points in the parent chromosomes are chosen randomly, the segments of genetic
materials enclosed by these two points are exchanged. e.g.
parent 1: 1 1 | 1 1 1 1 | 1 1 1
parent 2: 0 0 | 0 0 0 0 | 0 0 0
* *
child 1 : 1 1 | 0 0 0 0 | 1 1 1
child 2 : 0 0 | 1 1 1 1 | 0 0 0
* *
K-point crossovers are eective in recombining genetic materials to exploit the new solution
space. At the same time, they are disruptive to schemata of long dening length. To avoid
the disruption caused by k-point crossover, we can use the uniform crossover operator
(UX). The uniform crossover exchanges bits rather than segments. Each position in the
parent chromosomes is chosen with a probability (typically 0.5). Genetic materials from
two parents are exchanged at those chosen positions. e.g. 1's in the mask below represent
those chosen positions.
mask : # 1 1 1 # # 1 # 1
parent 1: 1 1 1 1 1 1 1 1 1
parent 2: 0 0 0 0 0 0 0 0 0
child 1 : 1 0 0 0 1 1 0 1 0
child 2 : 0 1 1 1 0 0 1 0 1
18
the same order have an equal chance of being disrupted or preserved.
Uniform crossover (UX) exchanges corresponding bits from two parents with a probabil-
ity of 0.5. The probability of schema disruption is now proportional to the order of the
schema and independent of its length. To further avoid the crossover bias towards low
order schemata, [Louis and Rawlins 91] suggested a masked crossover (MX).
Similar to the uniform crossover, crossover points in MX are dened by a binary mask.
However in masked crossover, one mask is dened for each parent and is part of the par-
ent chromosome. High performance schema of the chromosome are identied by 1's in
the mask. During crossover, a child will inherit every bit from one parent, the dominant
parent, except those high performance bits identied by the second parent but not by the
dominant parent. They will be inherited from the second parent.
The children's masks are inherited from the parent's mask with modication according to
the relative performance of the children and parents. Parents' masks will also be updated
according to how t a child they can produce. e.g.
Before crossover :
p mask 1 : 1 1 1 # 1 # 1 # # # #
parent 1 : 1 1 1 1 1 1 1 1 1 1 1
p mask 2 : 1 1 # 1 1 # 1 # # 1 #
parent 2 : 0 0 0 0 0 0 0 0 0 0 0
child 1 : 1 1 1 0 1 1 1 1 1 0 1
child 2 : 0 0 1 0 0 0 0 0 0 0 0
p mask 1 : 1 1 1 # 1 # 1 # # # #
p mask 2 : 1 1 # 1 1 # 1 # # 1 #
c mask 1 : 1 1 1 1 1 # 1 # # 1 #
c mask 1 : 1 1 1 1 1 # 1 # # 1 #
The masked crossover tries to preserve schemata identied by the masks. When the prob-
lems involve high epistasis, the masked crossover is preferred.
19
[Schaer and Morishima 87] discussed a similar crossover strategy called the punctuated
crossover (PX). Its major dierence from MX is that the mask denes crossover loci in-
stead of preserving loci and the mask is updated through crossover and mutation instead
of heuristic.
All the above discussion has assumed that tness only depends on the gene values and
the meaning of a gene is linked to its locus, its position. However, in many practical
problems, such as job shop scheduling and the traveling salesman problem, chromosome
tness depends only on genes order. The operators above discussed will fail to search the
solution space represented by the order of genes. A set of sequence or reordering operators
is designed to tackle the sequence or order optimization problem.
Sequence operators can be divided into two classes: unary operators which require one
parent to produce one or more children and binary operators which require two parents.
[Starkweather et al. 91] [Goldberg 89a].
Unary operators take an initial sequence of symbols and reorder a part of that sequence,
keeping part of the original sequence intact. The most primitive reordering operator, swap,
simply exchanges two symbols in a sequence. The splice operator removes those symbols
between two cut points and splices them onto the end of the sequence. The inversion
operator reverses the order of those symbols between two cut points. Splice and inversion
can be implemented by repeated application of the swap operator [Fox and McMahon 91].
Binary operators are more sophisticated in theory and implementation. Since they draw
information from two parents, binary operators have a greater opportunity to reproduce
common or valuable attributes.
The order crossover (OX) [Davis 85] creates children which preserve the order and po-
sition of symbols in a subsequence of one parent, while preserving the relative order of
the remaining symbols from the other parent. OX rst selects two random cut points,
the same cut points will apply to both parents. It then copies the symbols between the
cut points from the rst parent into the child, into the same positions as they appear
in the parent. Finally, starting just after the second cut point, OX copies the symbols
from the second parent into the child, omitting any symbols that were copied from the
rst parent. When the end of the second parent sequence is reached, this process contin-
ues with the rst symbol in the second parent until all of the symbols have been copied
into the child. A second child is constructed by switching the roles of the parent sequences.
The cycle crossover (CX) [Oliver 87] creates children so that the position of each symbol
in a child is determined by one of its parents. CX rst divides the set of symbols into two
subsets such that the positions of symbols of the rst subset are disjoint from the positions
of symbols in the second subset. CX then copies symbols from the rst subset into the
20
child, into the same positions as they appear in the rst parent and follows by copying
symbols from the second subset into the child, into the same positions as they appear in the
second parent. A second child is constructed by switching the roles of the parent sequences.
A set of symbols can be divided into two subsets that satisfy this requirement by a set
closure algorithm. First choose a single symbol to serve as the seed of the subset under
construction. Then, repeatedly apply the following rule: if symbol X is in the subset under
construction and if X con
icts with symbol Y, then symbol Y should be added to the
subset under construction. Two symbols X and Y con
ict with each other if X holds the
same position in one parent as Y holds in the other parent.
Partially mapped crossover (PMX) [Goldberg 89a] creates children which preserve the or-
der and position of symbols in a subsequence of one parent while preserving the order
and position of some or many of the remaining symbols from the other parent. PMX rst
selects two random cut points, the same cut points will apply to both parents. The rst
child begins as an exact copy of the rst parent. The goal is to modify the child so that
the symbols between cut points are an exact copy of the symbols between cut points in
the second parent. This is accomplished by a series of swap operations where each symbol
which appear between the cut points is swapped with the symbol that occupies its desired
position (The method is slightly more complicated when one of the subject symbols al-
ready occupies a position between the cut points). A second child can be constructed by
switching the roles of the parent sequences.
Edge recombination (ER) [Whitley et al. 89] creates children which preserve edges, or
immediate predecessor/successor relationships found in the parent sequences. It is im-
plemented by constructing an edge map that lists the neighbors of each symbol in the
sequence. The rst symbol to be placed into the child is chosen at random. The next sym-
bol is chosen from the list of the rst symbol's neighbors. The process of choosing symbols
from the previous symbol's list of neighbors is continued until all symbols are chosen or
until there are no neighbors to choose from but there are symbols left. In this case, any of
the remaining symbols is chosen at random.
To better analyse the sequence operation [Fox and McMahon 91] suggested a formal model
of sequence. In their model, they used a N by N boolean matrix to represent predecessor
and successor relationships of a sequence of N symbols. Two new operators, intersection
and union, were created from this model. Experimental results show that both intersection
and union outperform those sequence operators discussed above. As our study needs only
positional operators, our discussion on sequence operators will stop here.
21
2.4.6 Choosing run parameters
Dierent GAs need dierent parameter settings, e.g. population size, generation gap,
crossover rate, and mutation rate. Choice of parameters will aect the run eciency and
quality of the nal result.
Various ways have been suggested to choose optimal run parameters.
Hand optimization.
Derive a general formula that denes the relationships between dierent run parame-
ters. Parameter values can be calculated according this formula. [Goldberg 89b] has
proposed ways to estimate population sizes for serial and parallel GA. However, it is
dicult to nd a single formula that work for every parameter and every problem.
Using GA.
Build, on top of the GA for a problem, a higher level GA that use the lower level
GA as its tness evaluation function. Fitnesses returned will be the time to nd
the optimal solution or if optimal solution cannot be found, the performance of the
best solution found by dierent parameter settings. In this approach, each tness
evaluation is an independent GA run, this is a time consuming approach.
Brute force search
Try every possible combination of parameter settings and compare the results. This
is even worse than the GA approach.
Use robust parameters.
Locate a set of robust parameters which is applicable to a wide range of problems, by
various methods (e.g. those mentioned above). Apply this set of parameters to the
current problem. In general, GAs using such robust parameters perform reasonably
well. The drawback of this approach is that we cannot guarantee the parameters will
best t the current problem.
Adaptive parameters setting.
Encode the parameters in the chromosome, GA search, in addition to the solution,
the parameter values [Schaer and Morishima 87]. Not much research is going on in
this area.
New GAs that do not require these parameters settings.
The algorithm CHC1 is a very good example. In CHC, growth in the number of
better than average schemata is achieved by elistist selection of next generation.
Population diversity is achieved by HUX, by avoiding incest mating and selective
1 CHC stands for (C)ross generational elitist selection, (H)eterogenous recombination, and (C)ataclysmic
mutation.
22
generation2 of a new population when the old population starts to converge. CHC
therefore no longer depends on crossover rate, mutation rate and population size to
control the population diversity. They can be got rid of all at once ([Eshelman 91]).
2.4.7 Deceptiveness
Although GAs are powerful generic search tools, there still exist a situation that causes
them diculty in trying to search for the global optimal solution. The situation is decep-
tion which is rst introduced in [Goldberg 87].
Fundamental theorem of genetic algorithms, the schema theorem is based on the building
block assumption. The building block assumption assumes that global optimal schema,
if corrupted or does not exist in the population, can be constructed by combining sub-
schemata in dierent chromosomes through crossover [Goldberg 89a]. However, the build-
ing block assumption may not always hold true. Depending on the problem or encoding,
chromosomes with lower order subschemata of the global optimal schema may be tter
than those with higher order subschemata of the global optimal schema. They will have
a higher chance of being chosen for crossover. As a result, the population will tend to be
dominated by chromosomes with lower order subschemata. The global optimal schema can
only be constructed by random mutation, that is, by chance [Whitley 91].
For example, assume that the optimal chromosome has an order 7 schema, 1111111. It
is unlikely that this schema be created in the initial random population or by random
mutation. However, it can be created by combining two shorter subschemata through
crossover, e.g. 11111## 3 crossover with ##11111. The chance that chromosomes with
these two subschemata are chosen for crossover is proportional to their tness. If in this
problem chromosomes with the order 6 subschema are less t than those with the order 5
subschema and those with the order 5 subschema are less t than those with the order 4
subschema and so on, the population will tend to be lled with more and more low order
schemata. The chance of constructing the schema 1111111 is no better than random search!
We call such problems in which subschemata lead the search away from the optimal solu-
tion deceptive problems and the related functions deceptive functions.
Various methods have been suggested to tackle deceptive problems. First, we can reduce
the chance of disruption of global optimal schema by encoding it as one with short dening
2 When population converge, individuals in the new population are generated by including the best
chromosome found so far and by randomly
ipping 35% of the bits in the best chromosome. This can
produce individuals with appropriate hamming distance from each other and provide a fair coverage of
the solution space. For problems with long chromosomes, that is large solution space, fair coverage can
be achieved by several population regeneration even with small population size. 35% is a gure chosen in
[Eshelman 91] and he found that it works well for a wide range of problems
3 # is a wild card symbol, it represent any possible value, i.e. 0 or 1 in this case
23
length. This is called the tight building block approach. This approach requires problem
domain knowledge which is not always available to guide the encoding.
Second, we can use operators that do not bias towards schemata of short dening length,
e.g. UX, HUX, MX (refer to 2.4.5) and the cut and splice operators used in Messy GA
[Goldberg et al. 89], [Goldberg et al. 90] and [Deb 90]. The eect of using such operators
is equivalent to packing schemata by discarding all the don't care symbols between the left
most and right most specic symbols. Just like the tight building block approach, such
operators can reduce the chance of disrupting global optimal schema. In addition, they do
not require any problem specic knowledge.
These two approaches can only prevent the disruption of global optimal schema if it exists
in a population. But if it does not exist, deceptiveness still prevents its construction from
subschemata. The best way would be getting rid of deceptiveness from the problem.
Very often, deceptiveness arises from the encoding. Dierent encodings for the same prob-
lem may introduce or eliminate deceptiveness. [Battle and Vose 91] shown that for every
encoding, there exist a matrix transformation that maps the encoding to one that behaves
according to the schemata theorem (i.e. the number of an above average schema in a
population will grow exponentially with time) under appropriate genetic operators. They
have shown that gray coding is a typical encoding transformation that reduces the decep-
tiveness of a problem. The third method is therefore to transform encodings. Researches
is in progress in this area to nd a general algorithm that can derive the transformation
matrix or matrices for a particular deceptive problem encoding ([Battle and Vose 91]).
24
3 Iterative Timetabling Model
We have discussed ve approaches to timetabling in 2.4. Piece-wise incremental con-
struction is actually a manual scheduling procedure. The computer only provides help in
checking constraint violations in each step. We do not suggest this labor intensive approach.
Processing time for a heuristic tree search will increase exponentially with the number of
variables and the number of values for the variables. It will only perform well with small
schedules. It is not considered.
GA has successfully been applied in many scheduling problems ([Abramson 88],
[Bagchi et al. 91], [Cleveland and Smith 89], [Corne et al. 92], [Davis 85],
[Feldman and Golumbic 90], [Gabbert et al. 91], [Juli 93], [Murphy 87], [Nakano 91],
[Schaer and Morishima 87], [Syswerda and Palmucci 91]). Although it cannot guarantee
to return the optimal solution, research shows that the solution returned is reasonably
close to optimal if the solution itself is not optimal. GA is a reasonable choice as the time
table search engine.
A practical timetabling problem usually involves a large solution. It is dicult to view
the whole solution at once. Besides, there are usually a large number of constraints. It
is dicult to rectify constraint con
icts and guarantee that feasible solutions exist before
scheduling starts. Therefore, the timetabling process is usually an iterative process that
allow users to construct the timetable through a number of iterations. An increasing por-
tion of the timetable will be conrmed by users in each iteration (refer to 2.2.3). Iteration
process also allows users to readjust the constraint priorities when more information about
the eect of the constraints on the timetable is provided by the partial timetable.
Since GA is non-deterministic (refer to 2.2.4), we cannot calculate the expected search time
before scheduling start. We have to check the schedule generated between xed intervals.
This gives yet another reason to support the iterative approach.
We therefore chose a hybrid GA and iterative approach. The GA engine is built with
robust genetic operators (refer to 2.4.5 and 2.4.7) and run parameters (refer to 2.4.6). Each
schedule will be set to run for a xed number of generations. The best schedule found at
that point will be reported for user review. If part of the schedule seems acceptable while
others still violate many constraints, users can conrm the acceptable part. Subsequence
search will not modify this part. Users can re-adjust the constraint priorities (allowing
less important constraints to be violated and leaving room for more important constraints
to be satised) or users can do nothing and let the system continue to search for some
more generations. The above search, review and adjust process can be repeated until a
satisfactory schedule is found.
25
4 Generic GA Shell
As discussed in 2.4.2, the main tasks of applying GA to solve a problem are encoding the
solution as a chromosome, developing a tness evaluation function and chosing an appro-
priate GA environment (including appropriate genetic operators and run parameters). A
generic GA shell should therefore have a generic chromosome encoding, a generic tness
evaluation function, robust genetic operators, and a set of robust run parameters that
works for every university and high school.
26
number of values time-slot can take = 30 (need 5 bits to represent)
number of values room can take = 16 (need 4 bits to represent)
With these parameters, we can dynamically dene the chromosome as a bit string of length
36. The rst 20 bits represent the four time-slot variables, one for each class and each
variable is 4 bits in length. The remaining 16 bits represent the four room variables, one for
each class and each variable is 4 bits in length. Our generic GA shell uses this mechanism
to dene the chromosome dynamically for dierent timetabling problems.
27
1. Eliminate inequalities.
Three of the four variables in a timetabling problem, class, room and teacher are
nominal. That is, they take unrelated discrete values. They will not involve inequal-
ities. If we further divide the remaining variable, time into three, namely day-of -
week, session within a day and time-slot within each session, each of them can only
take a small number of values. For example, there are only ve days a week, at most
three sessions (morning, afternoon and evening) a day, about four one-hour time-slots
in each session. We can therefore treat all these variables as nominal. Inequalities
can therefore be eliminated. For example, the constraint after Wednesday can be
expressed as equal to Thursday or equal to Friday.
29
Ternary and higher order constraints are more complicated. For example, if we have the
constraint v1 = v2 = v3 = v4 = v5 and if in a solution we have v1 = v2 = v3 and v4 = v5
but v1; v2; v3 not = v4 and v5, there are four equalities satised, three for v1 = v2 = v3
and one for v4 = v5. This solution corresponds to a distance of four units towards feasibility.
The overall constraint to a timetabling problem is a conjunction of individual constraints
(refer to 2.3.3), overall reward or penalty to a chromosome is therefore a simple sum on
the unit distance from feasibility calculated for each individual constraint.
In order to further dierentiate chromosomes with little tness dierence, we applied a
square function on the overall reward or penalty. We kept the sign of the overall reward
or penalty unchange to dierentiate between reward and penalty.
The evaluation function is outlined as follows :
Procedure Evaluate
begin
For each individual constraint, do
begin
check the number of equalities satised, n;
calculate reward or penalty R as (n constraint weighting);
cumulate R to total reward T ;
end
calculate chromosome tness as (sign of T T 2);
end
5 Improving Eciency
5.1 Constraint propagation
With a close study on the constraints in a timetabling task, we found that they have al-
ready provided much information about the feasible solutions. For example, the binary
constraint v1 = v2 tells us that v1 and v2 should be equal in the optimal solution. If we
are already given the value of v1 it would be not necessary for us to ask GA to search for
the value of v2 which we already know should be same as v1.
The mechanism that propagates a constraint to restrict the legal value of some variable
is called constraint propagation in Constraint Satisfaction Problem (CSP) (refer to 2.2.2).
We can employ the same principle to reduce the search load on GA.
31
For example, if we have four constraints k1; k2; k3 and k4 as follows :
k1 : v1 = 1; 2 or 3
k2 : v2 = 3; 4 or 5
k3 : v3 ? v1 = 2
k4 : v1 = v2
The net result is v1 = 3; v2 = 3; v3 = 3. Satisfying k1; k2 and k4, but still violating k3 .
Second cycle of propagation which start with values propagated in rst cycle may look like
this :
k1 : v1 = 3
k2 : v2 = 3
k3 : v3 = v1 + 2 = 5
k4 : v1 = v2 = 3
All four constraints are satised. If there are still some constraints left unsatised, we can
continue with the third cycle. If there are still some constraints left unsatised after the
third cycle, we will leave it for GA to search for the legal solution.
[Nakano 91] used a similar approach called forcing. Forcing replaces an illegal chromosome
with a legal one which is generated with minor modication to the illegal one.
[Michalewicz and Janikow 91] used a similar logic to reduce the number of variables and
the values these variables can take before encoding the problem.
32
Single value unary constraints uniquely determine the values of some variables and are
independent of other constraints, they should be propagated rst. Multiple valued unary
and higher order constraints have no preference sequence over one another. They are prop-
agated in random order.
In case the solution space is highly constrainted, propagation of soft constraints may reduce
the chance of locating values that satisfy all hard constraints. For example, if classA is
preferred to be scheduled in the morning, xing classA in the morning will limit the time-
slot and room combinations available in the morning. Subsequent room clash checking
may force some other classes to be scheduled outside morning session. This may means
hard constraint violation. Soft constraints may therefore be preferred not to propagate.
However, if the solution space is not too constrainted, propagating soft constraints can
help to locate the best feasible solution. Therefore, whether to propagate soft constraints
is left as a run time option and let user make the choice. Alternatively, users can specify all
constraints as hard at the beginning. Then selectively relax to soft when no legal schedule
is found.
5.1.3 Pseudo code
The constraint propagation function is outlined as follows :
Procedure Propagate constraints
begin
randomly shue the input sequence of constraints;
repeat the following three times
begin
for each single valued unary constraint, do
begin
modify variables to values specied in the constraint;
end
for each remaining constraint, do
begin
if it is an encouraging constraint
modify variables so that they satisfy the constraint;
if it is an discouraging constraint
modify variables so that they violate the constraint;
end
end
end
34
Cluster Subject Title
AI CS015 Foundations of AI
CS022 Expert Systems
Advanced AI CS030 Advanced AI
CS031 Research Topics in AI
Database CS041 Object Oriented Database Systems
CS044 Information Retrieval
Graphics CS062 Human-Computer Interaction
CS064 Scientic Visualisation
CS066 Foundations of Computer Graphics
SW Engineering CS711 Specication of Software Systems
CS714 Software Project Management
CS715 Telecommunications Software Engineering
Professional Development CS080 Network Performance Engineering
CS090 Software Engineering: Risk Analysis and Management
6 Two Experiments
We have tried our algorithm on two scheduling problems using a SUN Sparc Server 10
with 1 cpu and 96m RAM. Operating system is Sun O/S 4.1.3. Both experiments used
the same set of parameters :
Population size is 100.
Each run stops after 10,000 evaluations.
When population converged, new population is created by randomly
ipping 35% of
the bits in the best chromosome found so far (refer to 2.4.6).
Choose not to propagate soft constraints.
Because we are using HUX and elistist selection, parameters such as crossover rate, mu-
tation rate and generate gap were not needed. The population size of 100 should work for
a wide range of the problems (refer to 2.4.5 and 2.4.6).
35
This course has six clusters, namely AI, Database, Graphics, SW Engineering Advanced AI
and Professional Development. Each cluster oers two to three subjects. Each subject has
one 2-hour lecture and one 2-hour tutorial (laboratory) each week. Each day is divided into
three sessions, morning, afternoon and evening. Each session has two 2-hour time-slots.
One of the schedule requirements (refer to 6.1.2) is that classes are not to be scheduled on
Fridays, therefore, there are 24 time-slots each week. The number of rooms available for
use is assumed to be 8.
6.1.1 The chromosome
The chromosome is specied as follow :
number of class = 26
number of variables = 4 (day,session,time-slot,room)
number of values that variable day can take = 4 (2 bits)
number of values that variable session can take = 3 (2 bits)
number of values that variable time-slot can take = 2 (1 bit)
number of values that variable room can take = 8 (3 bits)
Based on the above specication, our GA shell will create chromosomes of 208 bits each.
Although 2 bits are allocated to session, the GA shell will only return three values for
session (refer to 5.2).
6.1.2 Constraints
1. Schedule requirements
We have created a few hypothetical schedule requirements (constraints) for this
timetable.
(a) Schedule all classes in AI and Advanced AI cluster in the evening. Most students
taking subjects in these clusters are part-time students. They can only attend
lectures after oce hour.
(b) Do not schedule classes in the remaining clusters in the evening.
(c) Classes in the remaining clusters are preferred to be scheduled in the morning.
This is a soft constraints.
(d) Schedule tutorials 2 days after and in the same time-slot of a day as their
corresponding lectures.
(e) Schedule classes in the same cluster on the same day. This can minimize the
number of days that lecturers and students must come back.
36
2. Default constraints
(a) Only one class can be scheduled in the same room at one time.
(b) Classes in the same cluster should be in dierent time-slot of a day. They will
likely be attended by the same group of students.
Assuming dierent subjects are taught by dierent lecturers, we do not have to worry
about lecturer clash.
6.1.3 Constraint representation
We converted each schedule requirement and default constraint above to one that can be
represented by our constraints data structure.
1. Schedule requirements
(a) If session of a class in AI or Advanced AI cluster is equal to evening, reward
the chromosome.
(b) If session of a class in cluster other than AI or Advanced AI cluster equals to
evening, penalize the chromosome.
(c) If session of a class in clusters other than AI or Advanced AI equals to morning,
reward the chromosome.
(d) If
day of tutorial minus day of lecture equals to 2, and
session of tutorial minus session of lecture equals to 0, and
time-slot of tutorial minus time-slot of lecture equals to 0
reward the chromosome.
(e) Two constraints are needed for schedule requirement (e)
If day of a lecture equal to day of another lecture in same cluster, reward
the chromosome.
If day of a tutorial equal to day of another tutorial in same cluster, reward
the chromosome.
2. Default constraints
(a) If two classes are using the same room and
day of the rst class is equal to day of the second class, and
session of the rst class is equal to session of the second class, and
time-slot of the rst class is equal to time-slot of the second class
penalize the chromosome.
37
(b) If two classes belongs to the same cluster and
day of the rst class is equal to day of the second class, and
session of the rst class is equal to session of the second class, and
time-slot of the rst class is equal to time-slot of the second class,
penalize the chromosome.
6.1.4 Fitness evaluation examples
For each chromosome, our GA shell will rst try to eliminate all hard constraints by con-
straints propagation (refer to 5.1.2 for propagation sequence).
After constraints propagation, the tness evaluation function will check the chromosome
against each constraint, including schedule requirements and default constraints. If the
chromosome satises a condition of a constraint, the corresponding reward (a positive
value) or penalty (a negative value) for that constraint will be cumulated to the total t-
ness.
For example, consider the chromosome with CS062, CS064 scheduled on Monday, CS066
scheduled on Wednesday, and schedule requirement (e). There is one match (day of CS062
equals day of CS064) in this chromosome, therefore, one times the reward of this constraint
is added to the total tness.
As a second example, let us consider the chromosome with CS015, CS022, CS062, CS064
using the same room and CS015, CS022 and CS062 are all scheduled in the rst time-slot
in Monday morning, while CS064 is scheduled in the second time-slot in Tuesday after-
noon. According to default constraint (a), there are three matches, time (day, session and
time-slot) of CS015 matches that of CS022 and that of CS062, time of CS022 matches
that of CS062. Therefore three times the penalty (a negative value) for this constraint is
added to the total tness.
The nal tness of the chromosome is the square of the cumulated tness with the sign
preserved.
6.1.5 Result
The optimal solution is found in one iteration with a simple manual modication.
Table 2 is the timetable generated from rst iteration. There are ve soft constraint vio-
lations. CS064 lec, CS064 tut, CS715 lec, CS715 tut and CS090 lec are all preferred to be
scheduled in the morning. However, in order to satisfy the hard constraint that requires
lectures or tutorials in the same cluster to be scheduled in the same day, CS064 lec, CS064
tut, CS715 lec and CS715 tut must be scheduled outside the morning session. What can
38
Time- Monday Tuesday Wednesday Thursday
Session slot Class Rm Class Rm Class Rm Class Rm
Morning 0 CS062 lec 1 CS044 lec 5 CS062 tut 4 CS044 tut 1
CS080 lec 0 CS714 lec 3 CS714 tut 6
1 CS066 lec 6 CS041 lec 7 CS066 tut 3 CS041 tut 7
CS711 lec 6 CS711 tut 4
Afternoon 0 CS090 lec 0 CS715 lec 4 CS715 tut 5
1 CS064 lec 5 CS064 tut 1
Evening 0 CS030 lec 2 CS015 lec 4 CS030 tut 2 CS015 tut 6
1 CS031 lec 3 CS022 lec 0 CS031 tut 4 CS022 tut 5
40
1. Schedule requirements
(a) Fixed requirement : if day, session and time-slot of the specied class are equal
to the given values, reward the chromosome.
(b) Concurrent requirement : if day, session and time-slot of the classes are all
equal, reward the chromosome.
(c) Blocked requirement : if
day of the second class minus day of the rst class equals to 0, and
session of the second class minus session of the rst class equals to 0, and
time-slot of the second class minus time-slot of the rst class equals to 1.
reward the chromosome.
(d) Sequence requirement : if
day of the second class minus day of the rst class is equal to 0, and session
of the second class minus session of the rst class is equal to 0, and time-
slot of the second class minus time-slot of the rst class is equal to 1, or
day of the second class minus day of the rst class is equal to 0, and session
of the second class minus session of the rst class is equal to 0 and time-slot
of the second class minus time-slot of the rst class is equal to 2, or
day of the second class minus day of the rst class is equal to 0, and session
of the second class minus session of the rst class is equal to 0, and time-
slot of the second class minus time-slot of the rst class is equal to 3, or
day of the second class minus day of the rst class is equal to 0, and session
of the second class minus session of the rst class is equal to 0, and time-
slot of the second class minus time-slot of the rst class is equal to 4, or
day of the second class minus day of the rst class is equal to 0, and session
of the second class minus session of the rst class is equal to 1, or
day of the second class minus day of the rst class is equal to 1, or
day of the second class minus day of the rst class is equal to 2, or
day of the second class minus day of the rst class is equal to 3, or
day of the second class minus day of the rst class is equal to 4
reward the chromosome.
(e) Preference requirement : if day, session and time-slot of the class are equal to
one of the preferred sets of values, reward the chromosome.
2. Default constraints
(a) Room clash : if two classes are using the same room and
day of the rst class equals to day of the second class, and
41
session of the rst class equals to session of the second class, and
time-slot of the rst class equals to time-slot of the second class
penalize the chromosome.
(b) Student clash : if two classes belong to the same group of students (e.g. year 1
engineering) and
day of the rst class equals to day of the second class, and
session of the rst class equals to session of the second class, and
time-slot of the rst class equals to time-slot of the second class,
penalize the chromosome.
(c) Encoding constraint : if
session of a class equals to afternoon, and
time-slot of the class equals to fth time-slot
penalize the chromosome.
6.2.4 Constraint compilation
Prolog was used to convert or compile the timetable and constraints specied in [Abramson 88].
To simplify the programming work, schedule requests were rst converted to Prolog pred-
icates manually :
sch(sch id, group of student, subject, teacher, room, number of classes per week).
A Prolog program was developed to convert the above schedule request to a number of
class predicates, one for each class to be scheduled :
class(class id, sch id, group of student, subject, teacher, room).
Chromosome specication is then derived manually from the number of classes to be sched-
uled, number of days in a week, number of session per day and the number of time-slots
in each session.
Schedule requirements are then converted to a number of constraint predicates manually.
1. Fixed schedule requirements :
xed(sch id, day, session, time slot).
2. Concurrent schedule requirements :
same(sch id 1, sch id 2) or same(sch id 1, sch id 2, sch id 3)
depending on whether two or three classes should be run concurrently.
42
3. Blocked schedule requirements :
block(sch id, number of consecutive time slot).
4. Sequence schedule requirements :
before(sch id 1, sch id 2).
5. Preference schedule requirements :
pref(sch id, variable list, variable value list).
Separate Prolog programs have been developed to process each of the above predicates and
generate the constraints that our GA shell can recognize.
Another set of Prolog programs are developed to generate the default constraints.
1. Room clash constraint : For each room available, locate all class using it and generate
a k-nary all equal discouraging constraint on variable day, session and time-slot.
2. Student clash constraint : For each group of students, locate all classes to be attended
by this group of student and generate a k-nary all equal discouraging constraint on
variable day, session and time-slot.
3. Encoding constraint : For each class to be scheduled, generate a discouraging con-
straint for scheduling it in the illegal time-slot (i.e. the fth time-slot in the evening).
6.2.5 Fitness evaluation
The same tness evaluation algorithm as in rst experiment is applied, that is, for each
chromosome, our GA shell will rst try to eliminate all hard constraints by constraint prop-
agation. After constraints propagation, the tness evaluation function will check the chro-
mosome against each constraint, including schedule requirements and default constraints.
If the chromosome satises the condition of a constraint, the corresponding reward (a pos-
itive value) or penalty (a negative value) for that constraint will be cumulated to the total
tness.
The nal tness of the chromosome is the square of the cumulated tness with the sign
preserved.
6.2.6 Result
Optimal solution has been found in three iterations. The heuristic we used to direct search
in each iteration is :
1. Locate error classes, that is, classes which violated hard constraints. This is done by
a checking program written in C.
43
2. Locate error related classes, that is, classes which belong to the same subject as the
error classes. This is done manually.
3. Conrm the time allocation for all classes except error classes and error related
classes.
This is done with the help of a C program and those Prolog programs that generate
the constraints at the beginning of the scheduling process.
Conrmation of time-allocation can be done by adding new xed schedule require-
ments (refer to 6.2.2). Such requirements request these classes to be scheduled in the
same time-slot as they are scheduled in the previous iteration.
The rst iteration ran for 680 computer seconds. The timetable generated has three hard
constraint violations (refer to table 3 to 7). Error classes and error related classes are those
lectures and practical classes for eng111 04, eng121 04, eng151 04 and eng161 04. Time
allocation for all classes except those belonging to these four subjects are conrmed (refer
to heuristics above). The GA shell will re-schedule the classes for these four subjects in
the second iteration.
The second iteration ran for 121 computer seconds. The timetable generated has one hard
constraint violation (refer to table 8 to 12). Error classes and error related classes are
those lectures and practical classes for eng111 04. Time allocation for all classes except
those belong to this subject are conrmed. The GA shell will re-schedule the classes for
this subject in the third iteration.
The third iteration ran for another 121 computer seconds. The timetable generated has no
hard constraint violation (refer to table 13 to 17). There are, however, 11 classes violated
preference soft constraints (the example in [Abramson 88] has no hard constraint viola-
tion and has 18 classes violated soft constraints).
The total scheduling time took about 16 minutes. No performance data is provided in
[Abramson 88] we cannot compare the runtime performance at this stage.
44
time-slot Class Subject Room Error
Monday morning 1 yr1engA eng111 04 e1 Y
yr1cscA eng111 04 nil
yr1chmA eng111 04 nil
yr1engB eng161 04 e1 Y
yr1cscB eng161 04 nil
yr1chmB eng161 04 nil
2 yr1engA eng111 04 e1 Y
yr1cscA eng111 04 nil
yr1chmA eng111 04 nil
yr1engB eng151 04 e1 Y
yr1cscB eng151 04 nil
yr1chmB eng151 04 nil
3 yr1engB eng151 04 e1
yr1cscB eng151 04 nil
yr1chmB eng151 04 nil
4 yr1engA maths191 04 nil
yr1engB maths191 04 nil
yr1cscA compsci101 nil
yr1cscB compsci101 nil
yr1chmA phys181 04 nil
yr1chmB phys181 04 nil
5 yr1engB maths191 04 nil
yr1engA chem171 04 nil
yr1cscA maths191 04 nil
yr1cscB maths191 04 nil
afternoon 1 yr1engB chem171 04 nil
yr1engA phys181 04 nil
yr1chmA maths191 04 nil
yr1chmB maths191 04 nil
3 yr1engA eng121 04 e1
yr1cscA eng121 04 nil
yr1chmA eng121 04 nil
4 yr1engA eng121 04 e1
yr1cscA eng121 04 nil
yr1chmA eng121 04 nil
45
time-slot Class Subject Room Error
Tuesday morning 1 yr1engB eng141 04 e1
yr1cscB eng141 04 nil
yr1chmB eng141 04 nil
2 yr1engA maths191 04 nil
yr1engB eng141 04 e1
yr1cscB eng141 04 nil
yr1chmB eng141 04 nil
3 yr1engA chem171 04 nil
yr1cscA compsci101 nil
yr1cscB compsci101 nil
4 yr1engA chem171 04 nil
yr1cscA phys181 04 nil
yr1cscB phys181 04 nil
yr1chmA chem171 04 nil
yr1chmB chem171 04 nil
5 yr1engA chem171 04 nil
yr1cscA maths191 04 nil
yr1cscB maths191 04 nil
afternoon 1 yr1engA phys181 04 nil
yr1chmA maths191 04 nil
yr1chmB maths191 04 nil
2 yr1engA phys181 04 nil
3 yr1engA phys181 04 nil
yr1engB eng141 04prac do3
yr1cscB eng141 04prac do4
yr1chmB eng141 04prac nil
4 yr1engA phys181 04 nil
yr1engB eng141 04prac do3
yr1cscB eng141 04prac do4
yr1chmB eng141 04prac nil
46
time-slot Class Subject Room Error
Wednesday morning 1 yr1engA eng131 04 e1
yr1cscA eng131 04 nil
yr1chmA eng131 04 nil
2 yr1engA eng131 04 e1
yr1cscA eng131 04 nil
yr1chmA eng131 04 nil
4 yr1engB maths191 04 nil
yr1engA chem171 04 nil
yr1cscA phys181 04 nil
yr1cscB phys181 04 nil
yr1chmA chem171 04 nil
yr1chmB chem171 04 nil
5 yr1cscA maths191 04 nil
yr1cscB maths191 04 nil
afternoon 1 yr1engB chem171 04 nil
yr1cscB eng1 do3
yr1cscA eng1 nil
2 yr1cscB eng1 do3
yr1cscA eng1 nil
3 yr1cscB eng1 do3
yr1cscA eng1 nil
4 yr1cscB eng1 do3
yr1chmB eng1 nil
yr1cscA eng1 nil
yr1chmA eng1 nil
47
time-slot Class Subject Room Error
Thursday morning 1 yr1engB eng151 04prac do3
yr1cscB eng151 04prac do4
yr1chmB eng151 04prac nil
2 yr1engB eng151 04prac do3
yr1cscB eng151 04prac do4
yr1chmB eng151 04prac nil
3 yr1engB chem171 04 nil
yr1chmA phys181 04 nil
4 yr1engB chem171 04 nil
yr1cscA compsci101 nil
yr1cscB compsci101 nil
yr1chmA phys181 04 nil
5 yr1engB chem171 04 nil
yr1chmA phys181 04 nil
yr1chmB phys181 04 nil
afternoon 1 yr1engB phys181 04 nil
yr1chmA maths191 04 nil Y
yr1chmB maths191 04 nil
yr1engA eng121 04prac do3
yr1cscA eng121 04prac do4
yr1chmA eng121 04prac nil Y
2 yr1engB phys181 04 nil
yr1engA eng121 04prac do3
yr1cscA eng121 04prac do4
yr1chmA eng121 04prac nil
3 yr1engB phys181 04 nil
yr1engA eng111 04prac nil
yr1cscA eng111 04prac nil
yr1chmA eng111 04prac nil
4 yr1engB phys181 04 nil
yr1engA eng111 04prac nil
yr1cscA eng111 04prac nil
yr1chmA eng111 04prac nil
48
time-slot Class Subject Room Error
Friday morning 2 yr1engA maths191 04 nil
yr1engB eng161 04 e1
yr1cscB eng161 04 nil
yr1chmB eng161 04 nil
4 yr1engB maths191 04 nil
yr1cscA phys181 04 nil
yr1cscB phys181 04 nil
yr1chmA chem171 04 nil
yr1chmB chem171 04 nil
5 yr1cscA maths191 04 nil
yr1cscB maths191 04 nil
afternoon 1 yr1engB phys181 04 nil
yr1chmA maths191 04 nil
yr1chmB maths191 04 nil
2 yr1engA eng131 04prac do3
yr1cscA eng131 04prac do4
yr1chmA eng131 04prac nil
3 yr1engA eng131 04prac do3
yr1cscA eng131 04prac do4
yr1chmA eng131 04prac nil
yr1engB eng161 04prac nil
yr1cscB eng161 04prac nil
yr1chmB eng161 04prac nil
4 yr1engB eng161 04prac nil
yr1cscB eng161 04prac nil
yr1chmB eng161 04prac nil
49
time-slot Class Subject Room Error
Monday morning 1 yr1engB eng161 04 e1
yr1cscB eng161 04 nil
yr1chmB eng161 04 nil
2 yr1engB eng151 04 e1
yr1cscB eng151 04 nil
yr1chmB eng151 04 nil
3 yr1engA eng111 04 e1
yr1cscA eng111 04 nil
yr1chmA eng111 04 nil
4 yr1engA maths191 04 nil
yr1engB maths191 04 nil
yr1cscA compsci101 nil
yr1cscB compsci101 nil
yr1chmA phys181 04 nil
yr1chmB phys181 04 nil
5 yr1engB maths191 04 nil
yr1engA chem171 04 nil
yr1cscA maths191 04 nil
yr1cscB maths191 04 nil
afternoon 1 yr1engB chem171 04 nil
yr1engA phys181 04 nil
yr1chmA maths191 04 nil
yr1chmB maths191 04 nil
2 yr1engB eng151 04 e1
yr1cscB eng151 04 nil
yr1chmB eng151 04 nil
3 yr1engA eng121 04 e1
yr1cscA eng121 04 nil
yr1chmA eng121 04 nil
4 yr1engA eng121 04 e1
yr1cscA eng121 04 nil
yr1chmA eng121 04 nil
50
time-slot Class Subject Room Error
Tuesday morning 1 yr1engB eng141 04 e1
yr1cscB eng141 04 nil
yr1chmB eng141 04 nil
2 yr1engA maths191 04 nil
yr1engB eng141 04 e1
yr1cscB eng141 04 nil
yr1chmB eng141 04 nil
3 yr1engA chem171 04 nil
yr1cscA compsci101 nil
yr1cscB compsci101 nil
4 yr1engA chem171 04 nil
yr1cscA phys181 04 nil
yr1cscB phys181 04 nil
yr1chmA chem171 04 nil
yr1chmB chem171 04 nil
5 yr1engA chem171 04 nil
yr1cscA maths191 04 nil
yr1cscB maths191 04 nil
afternoon 1 yr1engA phys181 04 nil
yr1chmA maths191 04 nil
yr1chmB maths191 04 nil
2 yr1engA phys181 04 nil
3 yr1engA phys181 04 nil
yr1engB eng141 04prac do3
yr1cscB eng141 04prac do4
yr1chmB eng141 04prac nil
4 yr1engA phys181 04 nil
yr1engB eng141 04prac do3
yr1cscB eng141 04prac do4
yr1chmB eng141 04prac nil
51
time-slot Class Subject Room Error
Wednesday morning 1 yr1engA eng131 04 e1
yr1cscA eng131 04 nil
yr1chmA eng131 04 nil
2 yr1engA eng131 04 e1
yr1cscA eng131 04 nil
yr1chmA eng131 04 nil
yr1engB eng151 04prac do3
yr1cscB eng151 04prac do4
yr1chmB eng151 04prac nil
3 yr1engB eng151 04prac do3
yr1cscB eng151 04prac do4
yr1chmB eng151 04prac nil
4 yr1engB maths191 04 nil
yr1engA chem171 04 nil
yr1cscA phys181 04 nil
yr1cscB phys181 04 nil
yr1chmA chem171 04 nil
yr1chmB chem171 04 nil
5 yr1cscA maths191 04 nil
yr1cscB maths191 04 nil
afternoon 1 yr1engB chem171 04 nil
yr1cscB eng1 do3
yr1cscA eng1 nil Y
yr1engA eng111 04 e1
yr1cscA eng111 04 nil Y
yr1chmA eng111 04 nil
2 yr1cscB eng1 do3
yr1cscA eng1 nil
3 yr1cscB eng1 do3
yr1cscA eng1 nil
4 yr1cscB eng1 do3
yr1chmB eng1 nil
yr1cscA eng1 nil
yr1chmA eng1 nil
52
time-slot Class Subject Room Error
Thursday morning 1 yr1engA eng121 04prac do3
yr1cscA eng121 04prac do4
yr1chmA eng121 04prac nil
2 yr1engA eng121 04prac do3
yr1cscA eng121 04prac do4
yr1chmA eng121 04prac nil
3 yr1engB chem171 04 nil
yr1chmA phys181 04 nil
4 yr1engB chem171 04 nil
yr1cscA compsci101 nil
yr1cscB compsci101 nil
yr1chmA phys181 04 nil
5 yr1engB chem171 04 nil
yr1chmA phys181 04 nil
yr1chmB phys181 04 nil
afternoon 1 yr1engB phys181 04 nil
yr1chmA maths191 04 nil Y
yr1chmB maths191 04 nil
yr1engA eng111 04prac nil
yr1cscA eng111 04prac nil
yr1chmA eng111 04prac nil Y
2 yr1engB phys181 04 nil
yr1engA eng111 04prac nil
yr1cscA eng111 04prac nil
yr1chmA eng111 04prac nil
3 yr1engB phys181 04 nil
yr1chmA eng111 04prac nil
4 yr1engB phys181 04 nil
53
time-slot Class Subject Room Error
Friday morning 2 yr1engA maths191 04 nil
3 yr1engB eng161 04 e1
yr1cscB eng161 04 nil
yr1chmB eng161 04 nil
4 yr1engB maths191 04 nil
yr1cscA phys181 04 nil
yr1cscB phys181 04 nil
yr1chmA chem171 04 nil
yr1chmB chem171 04 nil
5 yr1cscA maths191 04 nil
yr1cscB maths191 04 nil
afternoon 1 yr1engB phys181 04 nil
yr1chmA maths191 04 nil
yr1chmB maths191 04 nil
2 yr1engA eng131 04prac do3
yr1cscA eng131 04prac do4
yr1chmA eng131 04prac nil
yr1engB eng161 04prac nil
yr1cscB eng161 04prac nil
yr1chmB eng161 04prac nil
3 yr1engA eng131 04prac do3
yr1cscA eng131 04prac do4
yr1chmA eng131 04prac nil
yr1engB eng161 04prac nil
yr1cscB eng161 04prac nil
yr1chmB eng161 04prac nil
54
time-slot Class Subject Room Error
Monday morning 1 yr1engB eng161 04 e1
yr1cscB eng161 04 nil
yr1chmB eng161 04 nil
2 yr1engB eng151 04 e1
yr1cscB eng151 04 nil
yr1chmB eng151 04 nil
3 yr1engA eng111 04 e1
yr1cscA eng111 04 nil
yr1chmA eng111 04 nil
4 yr1engA maths191 04 nil
yr1engB maths191 04 nil
yr1cscA compsci101 nil
yr1cscB compsci101 nil
yr1chmA phys181 04 nil
yr1chmB phys181 04 nil
5 yr1engB maths191 04 nil
yr1engA chem171 04 nil
yr1cscA maths191 04 nil
yr1cscB maths191 04 nil
afternoon 1 yr1engB chem171 04 nil
yr1engA phys181 04 nil
yr1chmA maths191 04 nil
yr1chmB maths191 04 nil
2 yr1engB eng151 04 e1
yr1cscB eng151 04 nil
yr1chmB eng151 04 nil
3 yr1engA eng121 04 e1
yr1cscA eng121 04 nil
yr1chmA eng121 04 nil
4 yr1engA eng121 04 e1
yr1cscA eng121 04 nil
yr1chmA eng121 04 nil
55
time-slot Class Subject Room Error
Tuesday morning 1 yr1engB eng141 04 e1
yr1cscB eng141 04 nil
yr1chmB eng141 04 nil
2 yr1engA maths191 04 nil
yr1engB eng141 04 e1
yr1cscB eng141 04 nil
yr1chmB eng141 04 nil
3 yr1engA chem171 04 nil
yr1cscA compsci101 nil
yr1cscB compsci101 nil
4 yr1engA chem171 04 nil
yr1cscA phys181 04 nil
yr1cscB phys181 04 nil
yr1chmA chem171 04 nil
yr1chmB chem171 04 nil
5 yr1engA chem171 04 nil
yr1cscA maths191 04 nil
yr1cscB maths191 04 nil
afternoon 1 yr1engA phys181 04 nil
yr1chmA maths191 04 nil
yr1chmB maths191 04 nil
2 yr1engA phys181 04 nil
3 yr1engA phys181 04 nil
yr1engB eng141 04prac do3
yr1cscB eng141 04prac do4
yr1chmB eng141 04prac nil
4 yr1engA phys181 04 nil
yr1engB eng141 04prac do3
yr1cscB eng141 04prac do4
yr1chmB eng141 04prac nil
56
time-slot Class Subject Room Error
Wednesday morning 1 yr1engA eng131 04 e1
yr1cscA eng131 04 nil
yr1chmA eng131 04 nil
2 yr1engA eng131 04 e1
yr1cscA eng131 04 nil
yr1chmA eng131 04 nil
yr1engB eng151 04prac do3
yr1cscB eng151 04prac do4
yr1chmB eng151 04prac nil
3 yr1engA eng111 04 e1
yr1cscA eng111 04 nil
yr1chmA eng111 04 nil
yr1engB eng151 04prac do3
yr1cscB eng151 04prac do4
yr1chmB eng151 04prac nil
4 yr1engB maths191 04 nil
yr1engA chem171 04 nil
yr1cscA phys181 04 nil
yr1cscB phys181 04 nil
yr1chmA chem171 04 nil
yr1chmB chem171 04 nil
5 yr1cscA maths191 04 nil
yr1cscB maths191 04 nil
afternoon 1 yr1engB chem171 04 nil
yr1cscB eng1 do3
yr1cscA eng1 nil
2 yr1cscB eng1 do3
yr1cscA eng1 nil
3 yr1cscB eng1 do3
yr1cscA eng1 nil
4 yr1cscB eng1 do3
yr1chmB eng1 nil
yr1cscA eng1 nil
yr1chmA eng1 nil
57
time-slot Class Subject Room Error
Thursday morning 1 yr1engA eng121 04prac do3
yr1cscA eng121 04prac do4
yr1chmA eng121 04prac nil
2 yr1engA eng121 04prac do3
yr1cscA eng121 04prac do4
yr1chmA eng121 04prac nil
3 yr1engB chem171 04 nil
yr1chmA phys181 04 nil
4 yr1engB chem171 04 nil
yr1cscA compsci101 nil
yr1cscB compsci101 nil
yr1chmA phys181 04 nil
5 yr1engB chem171 04 nil
yr1chmA phys181 04 nil
yr1chmB phys181 04 nil
afternoon 1 yr1engB phys181 04 nil
yr1chmA maths191 04 nil
yr1chmB maths191 04 nil
2 yr1engB phys181 04 nil
yr1engA eng111 04prac nil
yr1cscA eng111 04prac nil
yr1chmA eng111 04prac nil
3 yr1engB phys181 04 nil
yr1engA eng111 04prac nil
yr1cscA eng111 04prac nil
yr1chmA eng111 04prac nil
4 yr1engB phys181 04 nil
58
time-slot Class Subject Room Error
Friday morning 2 yr1engA maths191 04 nil
3 yr1engB eng161 04 e1
yr1cscB eng161 04 nil
yr1chmB eng161 04 nil
4 yr1engB maths191 04 nil
yr1cscA phys181 04 nil
yr1cscB phys181 04 nil
yr1chmA chem171 04 nil
yr1chmB chem171 04 nil
5 yr1cscA maths191 04 nil
yr1cscB maths191 04 nil
afternoon 1 yr1engB phys181 04 nil
yr1chmA maths191 04 nil
yr1chmB maths191 04 nil
2 yr1engA eng131 04prac do3
yr1cscA eng131 04prac do4
yr1chmA eng131 04prac nil
yr1engB eng161 04prac nil
yr1cscB eng161 04prac nil
yr1chmB eng161 04prac nil
3 yr1engA eng131 04prac do3
yr1cscA eng131 04prac do4
yr1chmA eng131 04prac nil
yr1engB eng161 04prac nil
yr1cscB eng161 04prac nil
yr1chmB eng161 04prac nil
59
7 Conclusion
7.1 Summary
In this paper, we have presented an analysis of the time timetabling problem and the con-
straint types and properties involved.
The rst goal of this research is to study those ways of adapting a GA engine to the generic
iterative timetabling environment. We have suggested a dynamic chromosome encoding,
a generic constraint representation structure and a robust GA to achieve generality. Be-
tween iterations, acceptable part of the time table generated in previous iteration can be
conrmed by specifying additional unary hard constraints.
The second goal of this research is to study ways to improve the performance of the generic
GA engine. We have suggested the single valued constraint propagation with appropriate
propagation sequence to improve eciency.
The suggested algorithms have been used to schedule two typical university timetables and
results were satisfactory. The solution found in the second experiment is comparable (a
bit better) to that in previous work which used parallel machine. However, because lack
of performance data in previous work, we cannot compare the eciency at this stage. The
constraint data structure is generic enough to fully represent all constraints specied with
the language in that problem.
60
are generic enough, the whole system will be generic enough to schedule any university
and/or high school timetables.
61
References
[Abramson 87] D. Abramson (1987). Constructing School Timetables using Simulated An-
nealing: Sequential and Parrallel Algorithms. Royal Melbourne Institute of Tech-
nology, TR 112 069 R.
[Abramson 88] D. Abramson (1988). A Language and Compiler System for Specifying
Timetable Requirements. Royal Melbourne Institute of Technology, TR 112 071 R.
[Abramson and Abela 91] D. Abramson (1991). A Parallel Genetic Algorithm for Solving
the School Timetabling Problem. Royal Melbourne Institute of Technology, TR 118
105 R.
[Antonisse 89] Jim Antonisse (1989). A New Interpretation of Schema Notation that Over-
turns the Binary Encoding Constraint. Proceedings of the Third International Con-
ference on Genetic Algorithms, Morgan Kaufmann, Publishers.
[Bagchi et al. 91] Sugato Bagchi, Serdar Uckun, Yutaka Miyabe and Kazubiko Kawamura
(1991). Exploring Problem-Specic Recombination Operators for Job Shop Schedul-
ing The Application of Genetic Algorithms to Resource Scheduling. Proceedings of
the Fourth International Conference on Genetic Algorithms, Morgan Kaufmann,
Publishers.
[Baker 85] James Edward Baker (1985). Adaptive Selection Methods for Genetic Algo-
rithms. Proceedings of the First International Conference on Genetic Algorithms
and their Applications, Morgan Kaufmann, Publishers.
[Battle and Vose 91] David L. Battle and Michael D. Vose (1991). Isomorphisms of Genetic
Algorithms. Foundations of Genetic Algorithms, G. Rawlins, ed. Morgan Kaufmann.
[Belew 89] Richard K. Belew (1989). When both individual and populations search. Pro-
ceedings of the Third International Conference on Genetic Algorithms, Morgan
Kaufmann, Publishers.
[Butler and Morley 92] Jim Butler and David Morley. Maintenance Scheduling for Elec-
trical Power Transmission Networks.
[Cleveland and Smith 89] Garry A. Cleveland and Stephen F. Smith (1989). Using Genetic
Algorithms to Schedule Flow Shop Releases. Proceedings of the Third International
Conference on Genetic Algorithms, Morgan Kaufmann, Publishers.
[Collins and Jeerson 91] Robert J. Collins and David R. Jeerson (1991). Selection in
Massively Parallel Genetic Algorithms. Proceedings of the Fourth International
Conference on Genetic Algorithms, Morgan Kaufmann, Publishers.
62
[Corne et al. 92] Dave Corne, Hsiao-Lan Fang and Chris Mellish (1992) Solving the Mod-
ular Exam: Scheduling Problem with Genetic Algorithms. Industrial and Engi-
neering Applications of Articial Intelligence and Expert Systems: Proceedings of
the Sixth International Conference, Edinburgh, 1992, P.W.H. Chung, G Lovegrove,
M. Ali (eds), Gordon and Breach Science Publishers, 1993,ISBN:2-88124-604- 4,pp
370-373.
[Davidor 91] Yuval Davidor (1991). Epistasis Variance: A Viewpoint on GA-Hardness.
Foundations of Genetic Algorithms, G. Rawlins, ed. Morgan Kaufmann.
[Davis 85] Lawrence Davis (1985). Job Shop Scheduling with Genetic Algorithms. Pro-
ceedings of the First International Conference on Genetic Algorithms and their
Applications, Morgan Kaufmann, Publishers.
[De Jong 87] Kenneth De Jong (1987). On Using Genetic Algorithms to Search Program
Spaces. Genetic Algorithms and their Applications: Proceedings of the Second In-
ternational Conference, Morgan Kaufmann, Publishers.
[Deb 90] Kalyanmoy Deb. A Note on the String Growth in Messy Genetic Algorithms.
Department of Engineering Mechanics, The University of Alabama, Tuscaloosa, AL
35487 TCGA Report No. 90006, June 1990.
[Eshelman 91] Larry J. Eshelman (1991). The CHC Adaptive Search Algorithm: How
to Have Safe Search When Engaging in Nontraditional Genetic Recombination.
Foundations of Genetic Algorithms, G. Rawlins, ed. Morgan Kaufmann.
[Eshelman and Schaer 91] Larry J. Eshelman and J. David Schaer (1991). Preventing
Premature Convergence in Genetic Algorithms by Preventing Incest Proceedings
of the Fourth International Conference on Genetic Algorithms, Morgan Kaufmann,
Publishers.
[Feldman and Golumbic 90] R. Feldman and M. C. Golumbic. Optimization Algorithms
for Student Scheduling via Constraint Satisability. The Computer Journal, Vol 33,
No. 4, 1990.
[Fox and McMahon 91] B. R. Fox and M. B. McMahon (1991). Genetic Operators for
Sequencing Problems. Foundations of Genetic Algorithms, G. Rawlins, ed. Morgan
Kaufmann.
[Gabbert et al. 91] Paula S. Gabbert, Donald E. Brown, Christopher L. Huntley, Bernard
P. Markowicz and David E. Sappington (1991). A System for Learning Routes
and Schedules with Genetic Algorithms. Proceedings of the Fourth International
Conference on Genetic Algorithms, Morgan Kaufmann, Publishers.
[Marsden et al. 91] Gary C. Marsden, Fouad Kiamilev, Sadik Esener and Sing H. Lee
(1991). Highly parallel consistent labeling algorithm suitable for optoelectronic im-
plementation. Applied Optics, 10 January 1991, Vol. 30, No. 2.
63
[Goldberg 87] David E. Goldberg (1987). Simple Genetic Algorithms and the Minimal,
Deceptive Problem. Genetic Algorithms and Simulated Annealing, L. Davis, ed.,
Morgan Kaufmann, Pubs.
[Goldberg 89a] David E. Goldberg. Genetic Algorithms in Search, Optimization and Ma-
chine Learning. Reading, MA: Addison-Wesley, 1989.
[Goldberg 89b] David E. Goldberg (1989). Sizing Populations for Serial and Parallel Ge-
netic Algorithms. Proceedings of the Third International Conference on Genetic
Algorithms, Morgan Kaufmann, Publishers.
[Goldberg and Deb 91] David E. Goldberg and Kalyanmoy Deb (1991). A Comparative
Analysis of Selection Schemes Used in Genetic Algorithms. Foundations of Genetic
Algorithms, G. Rawlins, ed. Morgan Kaufmann.
[Goldberg et al. 89] David E. Goldberg, Bradley Korb, and Kalyanmoy Deb. Messy Ge-
netic Algorithms: Motivation, Analysis and First Results. Department of Engineer-
ing Mechanics, The University of Alabama, Tuscaloosa, AL 35487 TCGA Report
No. 89003, May 1989.
[Goldberg et al. 90] David E. Goldberg, Bradley Korb, and Kalyanmoy Deb. An Investi-
gation of Messy Genetic Algorithms. Department of Engineering Mechanics, The
University of Alabama, Tuscaloosa, AL 35487 TCGA Report No. 90005, May 1990.
[Hilliard and Liepins 87] M. R. Hilliard and G. E. Liepins (1987). A Classier-Based Sys-
tem for Discovering Scheduling Heuristics. Genetic Algorithms and their Appli-
cations: Proceedings of the Second International Conference, Morgan Kaufmann,
Publishers.
[Juli 93] Kate Juli (1993). A Multi-Chromosome Genetic Algorithm for Pallet Loading.
Victoria University of Technology. P.O.Box 14428, Melbourne Mail Centre, Aus-
tralia 3000.
[Louis and Rawlins 91] Sushil J. Louis and Gregory J.E. Rawlins (1991). Designer Ge-
netic Algorithms. Proceedings of the Fourth International Conference on Genetic
Algorithms, Morgan Kaufmann, Publishers.
[Murphy 87] Charles J. V. Murphy (1987). TIMELOG - An Intelligent Spreadsheet for
Schooling Timetabling. SIGART Newsletter, July 1987, Number 101.
[Michalewicz and Janikow 91] Zbigniew Michalewicz and Cezary Z. Janikow (1991). Han-
dling Constraints in Genetic Algorithms. Proceedings of the Fourth International
Conference on Genetic Algorithms, Morgan Kaufmann, Publishers.
[Nakano 91] Ryohei Nakano (1991). Conventional Genetic Algorithm for Job Shop Prob-
lem. Proceedings of the Fourth International Conference on Genetic Algorithms,
Morgan Kaufmann, Publishers.
64
[Nuijten et al. 93] W.P.M. Nuijten, E.H.L. Aarts, D.A.A. van Erp Taalman Kip and K.M.
van Hee (1993). Job Shop Scheduling by Constraint Satisfaction. Computing Sci-
ence Note 93/39, Department of Mathematics and Computing Science, Eindhoven
University of Technology, Netherlands.
[Oliver 87] Oliver I.M., Smith D.J., and Holland J.R.C. A Study of Permutation Crossover
Operators on the Traveling Salesman Problem, in Genetic Algorithms and their
Applications. (L. Erlbaum, 1988, original proceedings 1985) 154-159.
[Pettey et al. 87] Chrisila B. Pettey, Michael R. Leuze, and John J. Grefenstette (1987) A
Parallel Genetic Algorithm Genetic Algorithms and their Applications: Proceedings
of the Second International Conference, Morgan Kaufmann, Publishers.
[Rossi 88] Francesca Rossi (1988). Constraint Satisfaction Problems in Logic Program-
ming. SIGART Newsletter, October 1988, Number 106.
[Richardson et al. 89] Jon T. Richardson, Mark R. Palmer, Gunar Liepins and Mike
Hilliard (1989). Some Guidelines for Genetic Algorithms with Penalty Functions.
Proceedings of the Third International Conference on Genetic Algorithms, Morgan
Kaufmann, Publishers.
[Schraudolph and Grefenstette 92] Nicol N. Schraudolph and John J. Grefenstette. A
User's Guide to GAucsd 1.4. Technical Report CS92-249, CSE Department, UC
San Diego, La Jolla, CA 92093-0114, July 1992.
[Schaer and Morishima 87] J. David Schaer and Amy Morishima (1987). Bin Packing
With Adaptive Search. Genetic Algorithms and their Applications: Proceedings of
the Second International Conference, Morgan Kaufmann, Publishers.
[Srinivasan and Sterling 92] Venkatesh Srinivasan and Leon Sterling. Design and Imple-
mentation of Transportation Schedulers.
[Smith 85] Derek Smith (1985). Bin Packing With Adaptive Search. Proceedings of the
First International Conference on Genetic Algorithms and their Applications, Mor-
gan Kaufmann, Publishers.
[Spears and De Jong 91a] William M. Spears and Kenneth A. De Jong (1991). An Anal-
ysis of Multi-Point Crossover. Foundations of Genetic Algorithms, G. Rawlins, ed.
Morgan Kaufmann.
[Spears and De Jong 91b] William M. Spears and Kenneth A. De Jong (1991). On the
Virtues of Parameterized Uniform Crossover. Proceedings of the Fourth Interna-
tional Conference on Genetic Algorithms, Morgan Kaufmann, Publishers.
[Starkweather et al. 91] T. Starkweather, S. McDaniel, K. Mathias, D. Whitley and C.
Whitley (1991). A Comparison of Genetic Sequencing Operators. Proceedings of
65
the Fourth International Conference on Genetic Algorithms, Morgan Kaufmann,
Publishers.
[Syswerda 89] Gilbert Syswerda (1989). Uniform Crossover in Genetic Algorithms. Pro-
ceedings of the Third International Conference on Genetic Algorithms, Morgan
Kaufmann, Publishers.
[Syswerda and Palmucci 91] Gilbert Syswerda and Je Palmucci (1991). The Application
of Genetic Algorithms to Resource Scheduling. Proceedings of the Fourth Interna-
tional Conference on Genetic Algorithms, Morgan Kaufmann, Publishers.
[Vose and Liepins 91] Michael D. Vose and Gunar E. Liepins (1991). Schema Disruption.
Proceedings of the Fourth International Conference on Genetic Algorithms, Morgan
Kaufmann, Publishers.
[White and Wong 88] George M. White and Simon K. S. Wong. Interactive Timetabling
in Universities. Computer Education, Vol. 12, No. 4, pp 521-529, 1988.
[Whitley 91] L. Darrell Whitley (1991). Fundamental Principles of Deception. Foundations
of Genetic Algorithms, G. Rawlins, ed. Morgan Kaufmann.
[Whitley et al. 89] Darrell Whitley, Timothy Starkweather and D'Ann Fuquay (1989).
Scheduling Problems and Traveling Salesmen: The Genetic Edge Recombination
Operator. Proceedings of the Third International Conference on Genetic Algo-
rithms, Morgan Kaufmann, Publishers.
66