You are on page 1of 71

A Genetic Algorithm (GA) Shell for Iterative

Timetabling
by
Yam Ling CHAN
Master of Applied Science in Information Technology
email yam@numbat.cs.rmit.oz.au

A minor thesis submitted in partial ful lment


of the requirements for the degree of
Master of Applied Science in Information Technology

Department of Computer Science


RMIT
April 22, 1994

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,

Yam Ling CHAN


April 22, 1994

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 classi cation : : : : : : : : : : : : : : : : : : : : : : : : 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 speci ed 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 speci ed 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 di erent 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) con rm 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 con rmed 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
speci cation 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, speci cation and search.
The speci cation process speci es 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 di erent 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 classi cation 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 de ne which combinations of domain values are allowed and
which are not. Soft constraints de ne 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 satis ed simultaneously and the variable values are the most preferred
values as speci ed 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 de ned 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 de ned 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 modi es 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 modi ed 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 satis es all simple hard constraints (refer
to 2.3 for de nition 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
de nition of constraint order) equal to or higher than three is again a NP-complete
problem. A modi ed 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 di erent re nery 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 speci c 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
speci c knowledge is expected from the user. This approach di ers 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.

2.2.4 Genetic Algorithms


The GA approach keeps a population of potential solutions then uses genetic operators
such as selection, crossover and mutation to operate on individual solution or pair of solu-
tions to explore and compare di erent potential solutions. The result is a new population
7
of solutions with improved tness (i.e. fewer constraint violations).
The GA approach is classi ed as heuristic repair approach in CSP. As discuss later in 2.4.1
the implicit parallelism of GA enables it to search a large number of timetable constructs,
i.e. di erent (class, time-slot, teacher, room) combinations, at the same time and thus
can provide solutions in polynomial time frame. However, GA is non-deterministic, there
is no guarantee on the performance of each run. We will discuss GA in more detail in 2.4.
[Abramson and Abela 91] have implemented a timetabling system using a GA that can be
run on a parallel machine. The parallel algorithm has further improved the GA perfor-
mance. One thing to be said about this implementation is that it assumed those (class,
teacher, room) triples were allocated before the search started. The algorithm will only
try to match a time slot to each (class, teacher, room) triple so that no, or the least
constraints are violated. This may be the case in high school timetabling. However in the
actual university timetabling problem, we usually can only x (class, teacher) manually
prior to starting the scheduling process. Matching rooms to the (class, teacher) tuples
will be another NP-complete problem.
[Corne et al. 92] used a GA to schedule the examination timetable. Hard constraints are
used to avoid time clashes. Soft constraints are used to reduce presure on students (e.g.
schedule only one examination for each student in one day). Results are compared to those
prepared by human experts, i.e. course organisers, they all out perform the time tables
prepared by human experts.
2.2.5 Simulated Annealing
The simulated annealing (SA) approach simulates the cooling of a collection of vibrating
atoms. It start by randomly initializing a solution which will subsequently be modi ed ran-
domly through a number of iterations. At each iteration, some variables will be changed
randomly, if the change lead to an decrease or an acceptable increase in the cost function
of the solution, the change is accepted. By varying the acceptable increase of cost func-
tion in each iteration, we can control the lowest function cost reached and the number of
iterations to reach that function cost.
The SA approach is also classi ed as heuristic repair approach in CSP. One of the ad-
vantages of simulated annealing over some non exhaustive state space search techniques
like hill climbing is that it is less likely to be caught in local minima. Accepting possible
increase in function cost in each iteration helps the tentative solution to jump out of local
minima. Like GAs, SA is also a non-deterministic algorithm. It cannot guarantee the true
minimum cost is found.
[Abramson 87] have implemented a timetabling system using a SA that can be run on a
parallel machine. The parallel algorithm has further improved the SA performance. The

8
remark on this implemented algorithm is same as that on [Abramson and Abela 91] above.

2.3 Constraint Analysis


2.3.1 Constraint classi cation
Various studies in di erent problem domains have explored various characteristics of con-
straints. These characteristics have helped in formulating the constraints representation
structure and in improving process eciency. They are summarized below :
 Order of constraints. This is the number of nodes or variables the constraint is
binding. Constraints on a single node are called unary constraints or sometime
called domain constraints. These restrict the values that a variable can takes. Those
on two nodes are called binary constraints and restrict the pair of values that two
particular variables can take. In general, a constraint is called a k-nary constraint if
it binds k nodes together [Marsden et al. 91], [Feldman and Golumbic 90].
 Comparison operator used in constraints. It can be equal in a linear equality con-
straint or it can be less than or greater than in a linear inequality constraint
[Michalewicz and Janikow 91].
 E ect on satisfaction. It can either be encouraging or discouraging. A solution that
satis es an encouraging constraint is better than one that violates it. A solution that
violates a discouraging constraint is better than one that satis es it. In some cases,
it is easier to state the complement of a condition rather than the condition itself
[Rossi 88].
 Priority of constraints. There are two main types of priority, hard (strong) and
soft (weak). Hard or strong constraints are those that a legal solution must sat-
isfy. Soft or weak constraints are those that a legal solution may violate. Soft or
weak constraints are mainly used to order or di erentiate potential legal solutions
[Feldman and Golumbic 90].
2.3.2 Constraint representation
Just like knowledge representation, we can represent constraints as pure data (e.g. list all
the tuple values that satisfy or violate the constraints). This representation is simple but
is not ecient in the use of resources [Marsden et al. 91].
Alternatively, we can represent constraints as logic, a piece of code that checks whether a
given tuple satis es or violates the constraints. This representation can be tailored to the
problem to achieve higher eciency in execution. However it is vulnerable to changes and
each change may involve heavy programming work [Feldman and Golumbic 90].

9
Finally, we can represent constraints as something between pure data and pure logic. The
choice of representation is application dependent and will signi cantly a ect the processing
eciency.
2.3.3 Macroscopic constraint structure
A single schedule requirement can be satis ed 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 satis ed 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 simpli ed to the evaluation of each individual conjunction. To-
tal constraint violation of a timetable will be the sum of violations for each individual
conjunction.

2.4 Genetic Algorithms


2.4.1 General introduction
Genetic algorithms (GAs), rst speci ed by John Holland in the early seventies, are be-
coming important tools in machine learning and function optimization.
The metaphor underlying GAs is natural selection. To solve a learning task, a design task,
or an optimization task, a genetic algorithm maintains a population of organisms (bit
strings) each of which represents a possible solution. In every generation, a new popu-
lation of organisms is created using bits and pieces of the ttest of the old generation.
Bene cial changes to parents are therefore combined in their o springs. These operations
eciently exploit historical information to speculate on new search points with expected
improved performance.

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- speci c 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 o springs.
Mutate inverts single bits of individuals based on a user de ned 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 di er 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 de nition) 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 de ne 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 speci city, 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 speci c or non-
wild card symbols in a chromosome. It is equal to the number of symbols, both
speci c 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 classi er 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 bene t 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 e ective. When the solution space is
highly constrained, we will need domain speci c 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 speci c operators. Along
this line, [Bagchi et al. 91] used a similar scheme with the additional problem
14
speci c 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.

(c) Structured encoding


In both direct and indirect encoding each chromosome encodes only a single
characteristic of a solution e.g. task or job order. For some problems, the t-
ness of an optimal solution may be related to a higher level structure of the
single characteristic. For example, the performance of a truck loading schedule
is a ected by the order of cartons to be loaded onto the pallets, the number
and types of pallets allowed on the truck and the arrangement of pallets on the
truck [Juli 93].
A third scheme is to use separate chromosomes to encode di erent levels of
structure. [Juli 93] used three chromosomes, one to encode the ordering of
cartons to be packed onto a pallet, one to encode the number and types of
pallets to be loaded onto the truck and one to encode the arrangement of these
pallets on the truck.
3. Comparing encodings
Just like any other design work, designing the encoding is something of an art. There
exist no one encoding algorithm that work best for all types of 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 di erent encodings will all lead to sim-
ilar near optimal solutions, some encodings are more ecient than others.

In the GAs domain, there are two main sources of ineciency :


(a) Solution space is highly constrainted, i.e. a large portion of the solution space
represents illegal solutions. GA will spend a lot of time in evaluating illegal
15
chromosomes which will not contribute to the nal outcome. Furthermore,
illegal chromosomes will also reduce the e ective population size. As a result, a
larger population and thus larger memory is required.
(b) Solutions involve long schemata which will easily be disrupted by the classi-
cal genetic operators, the 1-point or 2-point crossover operators [Goldberg 89a].
Once corrupted, they can only be recovered by random mutations which are long
and unpromising processes, or by recombining sub-schemata of shorter lengths.
Reconstruction from sub-schemata will fail if the problem involves certain de-
gree of deception (refer to 2.4.7).
Alternatively, we can use a larger population to reduce the chance of long
schemata disruption. All these measures will consume extra memory and pro-
cessing time.
With the above considerations, we can derive some general guidelines to the design
of an encoding :
 choose encodings that cover only the legal solution space
 choose encodings that encode high- tness schemata with short de ning lengths
 choose encodings that produce short chromosomes
 choose encodings that involve the least deceptiveness
It will require knowledge of the solution space to make any of the above decisions.
This knowledge, however, may not always be available in a practical applications.
Two domain knowledge independent ways were suggested to help us to compare and
choose among di erent encodings. The rst way is the epistasis measure which esti-
mates the non-linearity of an encoding. The second is Walsh function analysis which
measures the degree of deceptiveness in an encoding.

Epistasis is a measure of the degree that genes, in a chromosome, depend on each


other for expression. In the domain of constraint analysis, it means a measure of
the orders of a given set of constraints. In schema theory, it means a measure of the
orders of those expressive schemata (those contribute to the chromosome tness) in
the optimal solution.
From the above de nition, we can infer that the lower the epistasis achieved by an
encoding, the higher will be its eciency. Therefore epistasis measure is a good in-
dicator to distinguish good encodings from bad.

[Davidor 91] proposed and de ned 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 con dence 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.

2.4.4 Fitness evaluation


A tness evaluation function is usually a linear combination of a cost function and a penalty
function. A cost function returns the performance of a solution in the problem domain. A
penalty function returns whether a solution is legal, or if illegal, how far away it is from
legal. A cost function and a penalty function together provide a means to rank di erent
solutions.
Cost functions are problem speci c, there is not much to talk about them. Penalty func-
tions can be avoided by problem speci c encodings, operators and/or decoders that produce
no illegal solutions. If we cannot get rid of illegal solutions with these means, we are forced
to use penalty functions. The penalty function approach is in fact a generic approach to
handle solution spaces with illegal points. It requires no or little problem speci c knowl-
edge.
With a penalty function approach, we are faced with the problem of penalty weightings.
With harsh penalty, GA will avoid the forbidden spaces by quickly discarding illegal chro-
mosomes. However, illegal chromosomes may contain good schemata. The population will
lose these good schemata by throwing the illegal chromosomes away.
With lenient penalty, presure to look for a legal solution is small and the search will be in-
ecient. A good penalty function should therefore keep a fair balance between preserving
information and the pressure for feasibility.
[Richardson et al. 89] suggested some guidelines to the design of penalty functions :
 penalties which are functions of the distance from feasibility perform better than
those which are merely functions of the number of violated constraints.
 good penalty functions can be constructed from two quantities, the maximum com-
pletion cost, and the expected completion cost.
 the penalty should be close to the expected completion cost but should not fre-
quently fall below it. The more accurate the penalty, the better will be the solutions
found. When penalty often underestimates the completion cost, search may not nd
a solution.

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 e ective in recombining genetic materials to exploit the new solution
space. At the same time, they are disruptive to schemata of long de ning 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

Each position is chosen independently, disruption is therefore independent of the schema


length. Comparing to 2X, UX has a higher disruption probability for short schemata and
a lower disruption probability for long schemata. Given a xed length chromosome, there
are many more long than short schemata. [Syswerda 89], [Spears and De Jong 91a] and
[Spears and De Jong 91b] therefore conclude that UX is more e ective than 2X.
As a variant of the uniform crossover, half uniform crossover (HUX) crosses over exactly
half the non-matching alleles. HUX guarantees that the children are always the maximum
Hamming distance from their two parents [Eshelman 91].
HUX maximizes the chance of two good schemata, one from each parent, being combined
in a child since half the material from each parent is chosen. Furthermore, all schemata of

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 de ned by a binary mask.
However in masked crossover, one mask is de ned for each parent and is part of the par-
ent chromosome. High performance schema of the chromosome are identi ed 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 identi ed 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 modi cation 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

After crossover (assuming both children are fitter than the


best parent):

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 identi ed by the masks. When the prob-
lems involve high epistasis, the masked crossover is preferred.
19
[Scha er and Morishima 87] discussed a similar crossover strategy called the punctuated
crossover (PX). Its major di erence from MX is that the mask de nes 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
Di erent GAs need di erent parameter settings, e.g. population size, generation gap,
crossover rate, and mutation rate. Choice of parameters will a ect 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 de nes the relationships between di erent 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 di erent 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 [Scha er 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 di erent 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 de ning
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 de ning 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 e ect of using such operators
is equivalent to packing schemata by discarding all the don't care symbols between the left
most and right most speci c 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 speci c 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. Di erent 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],
[Scha er 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 con rmed 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 e ect 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 con rm 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 satis ed) 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.

4.1 Chromosome structure and dynamic encoding


Our GA shell is developed from the GA package GAucsd [Schraudolph and Grefenstette 92]
which supports xed length chromosomes. Our study will therefore focus on the xed
length, direct binary encoding (refer to 2.4.3).
A solution to a timetabling problem consists of a number of tuples, one for each class. Each
tuple consists of several values which are the instantiation of variables for that class (refer
to 2.2). If we order the tuples according to the variable class, each class can be identi ed
by its position in the solution and the class variable can be dropped. Representing the
solution in this way can reduce one variable and shorten the chromosome length. The
algorithm is expected to perform better (refer to encoding guidelines in 2.4.3).
For example, if there are 4 classes, and 2 constraint variables time-slot and room, the
chromosome will be:
t1 t2 t3 t4 r1 r2 r3 r4
where ti and ri are the time-slot and room for class i respectively.
With this structure, a chromosome can be speci ed by the following parameters :
 number of classes
 number of variables other than class
 number of values each variable can take
Suppose there are 30 time-slots a week and there are 16 rooms for use, the above chromo-
some can be speci ed as :
 number of classes = 4
 number of variables other class = 2 (time-slot and room)

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 de ne 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 de ne the chromosome dynamically for di erent timetabling problems.

4.2 Constraint representation and generic tness evaluation


In general, the same program can work on di erent sets of data if they all have the same
data structure. We have already xed the chromosome structure, what left to be xed for
a generic tness evaluation function is the constraint data structure.
4.2.1 General principle
We have two objectives in designing the constraint representation. First, it should be
generic. The same representation should be applicable to any university and/or high
school. Second, it should be ecient in processing.
In general, we can represent any information or knowledge by a structure which is within
the spectrum that varies from pure data to pure logic (refer to 2.3.2). For constraints,
pure data representation lists all variable values that violate or satisfy the constraints.
Pure logic representation speci es the logic that can check for constraint violation or sat-
isfaction. A pure data approach is simple to specify and process, but takes up much space
and processing time. Pure logic approach is an compact representation and can be tailored
to the application to achieve higher execution eciency. However, it is problem speci c
and not generic.
As a compromise, we can use a representation somewhere between both extremes, i.e. use
a general data structure that can represent a group of constraints and a xed routine that
work on this data structure. This mixed data and logic representation can maximally sat-
isfy both the generality and eciency requirements.

4.2.2 Constraint data structures


Some measures have been taken to simplify and reduce the number of data structures
required:

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.

2. Unify reward and penalty, soft and hard constraints.


We used a single eld to represent reward and penalty. Positive values represent
rewards and negative values represent penalties. We have also made use of the same
reward/penalty eld to distinguish soft and hard constraints. Rewards/penalties for
soft constraints are values from -10 to 10 depending on their importance and whether
they are encouraging or discouraging. Rewards/penalties for hard constraints are
values larger than 10 and/or small than -10. The actual value is not important, the
evaluation function will treat them as 10 or -10 which are the maximum value allowed
for a constraint.
With the above measures, we can represent the timetabling constraints we encountered so
far by the following few structures :
 Unary constraints that bind a variable to one or more possible values. Unary con-
straints can specify pre-assignments and/or preferences. For example, if lecturer Fred
is only available on Monday and Wednesday, the related day variable is constrained
to take the value Monday or Wednesday.
 Binary constraints that specify the di erence between two variables. Binary con-
straints can specify sequence of two classes. For example, to allow time for students
to review lecture materials and prepare questions for the tutorial, we would like to
schedule tutorials two days after the corresponding lectures.
 K-nary all equal constraints that specify a number of variables must take the same
values. K-nary all equal constraints can specify concurrency of a number of classes
and time con icts to avoid. For example, if we want to schedule all year 3 lectures for
courses belonging to the same cluster in the same day, the value of the day variable
for these lectures should all be equal. How many lectures are bound together will
depend on how many lectures are there in the cluster.
 k-nary count (not implemented in this study) that specify the number of variables
that can take a certain value. K-nary count constraints can specify the maximum
28
classes to be scheduled for a lecturers or a group of student within one day or one
week. For example, if we do not want to schedule more than two lectures given by
the same lecturer on the same day, the number of lectures given by the same lecturer
on the same day should be equal to zero, one or two.
These four structures can directly represent most common constraints. But we still have
to slightly modify some constraints before they can be represented by the above structures.
For example, if we want 3 classes for the same subject to be evenly spread over the week
days, we should use two binary constraints, saying class2 should be one day after class1
and class3 should be one day after class2. In this study, we will stick with these four
structures. In future, new structures can be added when needs arise.
We can design four data structures, one to represent each of the above types of constraints.
Alternatively, we can design a general data structure that can represent all of the four types
of constraints. We have taken the single data structure approach. Hopefully this can sim-
plify the job of the constraint compiler.

4.2.3 Generic tness evaluation


We can get rid of illegal solutions from the solution space by problem speci c encodings,
operators, decoders and/or by use of penalty function (refer to 2.4.4). As we want the
tness evaluation function to be generic, we chose the penalty function approach.
In the penalty function approach, tness evaluation function is a linear combination of a
cost function and a penalty function. A cost function measures the performance of a legal
solution. In timetabling problems, it estimates the degree of soft constraint violation. A
penalty function indicates whether a solution is legal, or if illegal, measures how far away
it is from legal. In timetabling problems, a penalty function measures the degree of hard
constraint violation.
In 2.4.4 we concluded that a measure of the distance from feasibility is a good indica-
tor for comparing and weighting illegal solutions. In our constraint structure, each con-
straint may has more than one equality to be satis ed. For example, in the constraint
v1 = v2 = v3 = v4, there are six equalities, namely v1 = v2; v1 = v3; v1 = v4; v2 = v3; v2 = v4
and v3 = v4 to be satis ed. The number of satis ed or violated equalities will be a good
measure of distance from feasibility.
Measuring distance from feasibility is simple for unary or binary constraints, because they
consist of only one equality checking. For example, there is only one equality to be satis ed
in v2 ? v1 = 2 and only one equality to be avoided in v1 not = v2 (i.e. avoid v1 = v2 ). Any
unary or binary constraint violation will correspond to one unit distance from feasibility.

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 satis ed, 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 di erentiate chromosomes with little tness di erence, we applied a
square function on the overall reward or penalty. We kept the sign of the overall reward
or penalty unchange to di erentiate 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 satis ed, 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

4.3 Generic GA environment


As discussed in 2.4.5, 2.4.6 and 2.4.7, CHC ([Eshelman 91]) can provide the non-de ning
length biased operator HUX and a much reduced set of robust run parameters. We adopted
CHC as the GA engine.
The following modi cations have been made on Genesis to make it behave as CHC :
1. Replaced the 2-point crossover by the non-de ning length biased operator HUX.
2. Introduced the prevent incest mating mechanism to prevent or delay premature
convergence.
3. Replaced Roulett-wheel selection of individuals for mating by random pair up to
prevent or delay premature convergence.
4. Replaced generational replacement, in generation of new population, by survival
the fittest to obtain the growth in above average individuals.
30
5. Introduced selective population regeneration when population converge to achieve
population diversity instead of using mutation.

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.

5.1.1 Single valued constraint propagation


In CSP given the value of one variable, CSP will propagate, according to the constraints,
the set of possible values for other variables. The search will continue on these set of
possible values.
In GA, we have a population of individuals to keep di erent possible values, hence it is
not necessary to propagate all the possible values in a single chromosome. Propagating a
single value that makes the chromosome satisfy the related constraint is good enough. For
example, if a unary constraint says that legal values for variable v1 are 1, 2 and 3 and v1
in the chromosome takes an illegal value 9, we can randomly modify v1 to either 1, 2 or 3,
and the constraint will be satis ed. It takes only a few chromosomes to cover all the three
possible values for v1
As discussed in 2.3.3, constraints to a timetabling problem are a conjunction of a number
of schedule requirements. Ideally, each constraint propagation should propagate a value
which satis es all the conjunctions. Practically, it is a NP-complete problem (refer to
2.2.2). To simplify the propagation algorithm, we choose to propagate one schedule re-
quirement at a time. This simple algorithm has the drawback that a value propagated for
a previous schedule requirement may be varied in subsequent propagation and result in
violating the previous schedule requirement.
To solve this problem, we will repeat the propagation process three times, hoping that all,
or at least most, constraints can be satis ed after 3 cycles of propagation.

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

First cycle of propagation may look like this :


k1 : v1 = 1
k2 : v2 = 3
k3 : v3 = v1 + 2 = 3
k4 : v1 = v2 = 3

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 satis ed. If there are still some constraints left unsatis ed, we can
continue with the third cycle. If there are still some constraints left unsatis ed 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 modi cation 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.

5.1.2 Propagation sequence


As can be seen from the example above, the sequence of propagating the constraints can
a ect the resulting variable values. It worth some consideration.

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 speci ed 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

5.2 Handle illegal variable values


In a xed length chromosome, we use bit strings to represent variables. Very often, possible
values represented by a bit string may not exactly match the number of values a variable
33
can take. For example, if we use 3 bits to represent the variable day-of-week, Monday to
Friday can be represented by the value 0-4, value 5-7 generated in the crossover or mutation
process are illegal.
One way to get out of this problem is to use a higher cardinality encoding. Higher car-
dinality encoding requires a larger population to obtain the appropriate allele coverage.
The optimal population size will depend on the cardinality (refer to 2.4.3). In our generic
environment we need a single robust population size, so we do not consider this method.
Alternatively, we can linearly map the 8 possible values from 3 bits to 0-4. This will give
some values a higher chance of survival and we do not want this kind of bias.
A third method is to handle the illegal variable values as a kind of implicit constraints.
They are implicit to the encoding without users specifying them explicitly. In the above
example, the implicit constraint will say valid value for variable day-of-week is 0-4. If the
value generated from GA is 5-7, constraint propagation process will modify the variable
value randomly to 0-4. We have adopted this more robust approach and used constraint
propagation to amend the solutions generated by GA and guarantee legal variable values.
The legal value propagation function is outlined as follows :
Procedure Propagate legal values
begin
for each variable in the chromosome, do
begin
if variable value is illegal
randomly set variable to one of the legal values
end
end

5.3 Improved Fitness Evaluation Function


The improved tness evaluation function on each chromosome is outlined as follow :
Procedure Fitness evaluation
begin
propagate legal values (refer to 5.2);
propagate constraints (refer to 5.1.3);
evaluate (refer to 4.2.3);
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 Scienti c Visualisation
CS066 Foundations of Computer Graphics
SW Engineering CS711 Speci cation of Software Systems
CS714 Software Project Management
CS715 Telecommunications Software Engineering
Professional Development CS080 Network Performance Engineering
CS090 Software Engineering: Risk Analysis and Management

Table 1: Master by Coursework semester one, course details.

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).

6.1 Master by coursework timetable


The rst one is the RMIT, Computer Science, Master by Coursework lectures and tutorials
timetable for the rst semester in 1993 (refer to table 1 for course details).

35
This course has six clusters, namely AI, Database, Graphics, SW Engineering Advanced AI
and Professional Development. Each cluster o ers 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 speci ed 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 speci cation, 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 di erent time-slot of a day. They will
likely be attended by the same group of students.
Assuming di erent subjects are taught by di erent 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 satis es 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 modi cation.
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

Table 2: Master by Coursework, 1993 semester one timetable.


be improved is CS090 lec. We can simple re-schedule CS090 lec manually into second
time-slot in Monday morning to avoid this violation.
This schedule took 6.77 computer seconds.

6.2 University faculty timetable


The second experiment we tried is the university faculty timetable speci ed in [Abramson 88].
This timetable has 113 lectures and 36 practical classes. That is, there are 149 classes
to be scheduled. Each class (a lecture or a practical class) last for one hour. There are
two sessions, morning and afternoon, each day. The morning session has ve time-slots
and the afternoon session has 4 time-slots. With 5 days a week, there are 45 time-slots
to schedule classes each week. Rooms have been pre-assigned to classes before scheduling
begins. Lecturers have not been speci ed, therefore we do not have to consider lecturers
clash.
6.2.1 The chromosome
The chromosome is speci ed as follow :
 number of classes = 149
 number of variables = 3 (day, session and time-slot)
 number of values that variable day can take = 5 (3 bits)
 number of values that variable session can take = 2 (1 bits)
 number of values that variable time-slot can take = 5 (3 bit)
39
Based on the above speci cation, our GA shell will create chromosomes of 1043 bits each.
Although 3 bits are allocated to day and time-slot, the GA shell will only return ve values
for day and time-slot.
6.2.2 Constraints
1. Schedule requirements
Detail schedule requirements (constraints) can be found in [Abramson 88]. We only
summarise them by categories :
(a) Fixed requirement : schedule a class at a xed time-slot of the week (some
classes are xed by other faculties).
(b) Concurrent requirement : schedule two or more classes at the same time (some
classes should be taught together).
(c) Blocked requirement : schedule two or more classes in consecutive time-slots.
The two time-slots immediately before and after lunch do not count as consec-
utive. For the same reason, the last time-slot of a day and the rst time-slot in
the following day also do not count as consecutive.
(d) Sequence requirement : schedule one class before another (practical classes
should be scheduled after lectures).
(e) Preference requirement : schedule a class at one of several preferred time-slots
if possible (soft constraints).
2. Default constraints
(a) Room clash : only one class can be scheduled in the same room at one time.
(b) Student clash : di erent classes for the same group of students cannot be sched-
uled at the same time.
(c) Encoding constraint : classes are not allowed to be scheduled in the fth time-
slot in the afternoon. Our chromosome encoding allowed ve time-slots in both
the morning and afternoon session while there are only four time-slots in the
afternoon.
6.2.3 Constraint representation
We converted each schedule requirement and default constraint above to one that can be
represented by our constraint data structure. We can see here that our data structure is
generic enough to represent all constraints speci ed by the constraint speci cation language
in [Abramson 88].

40
1. Schedule requirements
(a) Fixed requirement : if day, session and time-slot of the speci ed 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 speci ed 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 speci cation 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 satis es 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. Con rm 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.
Con rmation 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 con rmed (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 con rmed. 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

Table 3: University faculty timetable, rst iteration

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

Table 4: University faculty timetable, rst iteration

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

Table 5: University faculty timetable, rst iteration

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

Table 6: University faculty timetable, rst iteration

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

Table 7: University faculty timetable, rst iteration

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

Table 8: University faculty timetable, second iteration

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

Table 9: University faculty timetable, second iteration

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

Table 10: University faculty timetable, second iteration

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

Table 11: University faculty timetable, second iteration

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

Table 12: University faculty timetable, second iteration

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

Table 13: University faculty timetable, third iteration

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

Table 14: University faculty timetable, third iteration

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

Table 15: University faculty timetable, third iteration

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

Table 16: University faculty timetable, third iteration

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

Table 17: University faculty timetable, third iteration

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
con rmed 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 speci ed with
the language in that problem.

7.2 Further work


To make the system practical, there are still a few more things to do. First, further im-
prove its eciency. The iteration heuristic is a promising area. We have used a problem
independent heuristic in the second experiment. With problem independent heuristics,
we can further automate the whole timetabling process, including inter iteration review
and constraint modi cations. However, it may not be ecient for all types of timetabling
problem. Besides iteration heuristic, non-order biased operators, non-linear penalty func-
tions other than the square function we are using and parallel algorithm can also be tried.
Second, users are not expected to deal with the somewhat complex internal constraint
structure. We should design or search for an appropriate constraint speci cation language.
Preferably, it is similar to a natural language. Better still would be a graphical language
that allows users to construct the constraints just by point and click. Third, a compiler is
required to bridge the speci cation language and the internal constraints structure (i.e. to
convert the constraint speci ed to the internal structure). Lastly, a timetabling database
with course, teacher, time-slot, room and may be student information is needed for the
constraint compilation. To make the database generic, a deductive database which can
provide a exible view of the data will be a good candidate. If the compiler and database

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-Speci c 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 Je erson 91] Robert J. Collins and David R. Je erson (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 Arti cial 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 Scha er 91] Larry J. Eshelman and J. David Scha er (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 Satis ability. 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 Classi er-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.
[Scha er and Morishima 87] J. David Scha er 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

You might also like