You are on page 1of 3

Optimize Timetabling Problem Using Improved

Genetic Algorithm


Wang Xiao Yun Wang Feng Kun, Wang XiangYun


College of Management College of Computer Science and Technology
HangZhou DianZi University HangZhou DianZi University
Hangzhou, China HangZhou, China

Abstract—The arrange timetable algorithms in common need to The paper consulted paper[7], and bring the elitist strategy
further improve. Aiming at the problem, classes divide into with dissimilarity chromosome into the timetable algorithm.
groups and elitist strategy with dissimilarity chromosome The paper improved the genetic algorithm using heuristic
methods based on genetic algorithms (GA) was proposed. initialization, dynamic variation's select rate and the max
Compared with standard genetic algorithms by simulation, its generation of fitness reduces continuously. It is satisfactory
efficiency was demonstrated. The experimental results show that that it converges quickly to the effective solution in the
it illustrates a good prospect of application and extension. enlarged solution space.
Key words- genetic algorithm; timetable problem; bipartite
graph; adaptive; II. IMPROVEMENT OF GENETIC ALGORITHM

A. Divide into groups


I. INTRODUCTION
Divide teachers and classes into several independent
Timetable problem is a combining programming problem groups to reducing the scale of the problem.
with multiple targets, limited resource and fuzzy constraints. It
has been proved that it belongs to NP completely problems in Define A simple graph GP=˄VˈE˅is called bipartite
math. In education administration of primary school, high graph if its vertex set V can be partitioned into two disjoint
school and universities, the making of timetable is an sets V1 and V2 such that every edge in the graph connects a
extremely complex problem which is usually done by hand. It vertex in V1 and a vertex in V2 (so that no edge in G connects
not only cost much energy, does not use the education resource either two vertices in V1 or two vertices in V2).
sufficiently, but also has a very low efficient. Therefore, it is a
problem need to be solved immediately and hard to be solved. All teachers consist of a set G, and all classes consist of a
Because of the complexity of timetable system, the set C. For a teacher g  G and a class c  C , if g is related to c ,
merchandised timetable software is not perfect up till now. there is a connected component from g to c, or else no
Especially the slow converging speed, limited searching connected component. There is obviously relation C  G M
solution space will cause the undesirable results. and C  G U . U: The universal set of teachers set and classes
Using the genetic algorithm into the timetable system has set). So, this structure is bipartite graph (Figure 2).
been talked by lots of papers. Because the search space of
timetable is very large and has many limiting conditions, it will Teachers set
not produce desirable effects by directly using the genetic
algorithm for timetable. According to the traits of timetable, Classes setrelation of teachers and classes
many papers had modified the standard genetic algorithm. Figure 1. bipartite graph’s

Paper[3] proposes to tackle timetable with many steps. It The bipartite graph structure that can be expressed as the
divides the maximum search space into several parts, and matrix: ªa a ... a º n: the number of teachers, m: the
11 12 1n
optimizes every one of them using the genetic algorithm. «a a 22 ... a 2 n »»
A « 21
However, the partial sub-optimal solution may not be the « ... ... ... ... »
« »
global sub-optimal solution. ¬a m1 am2 ... a mn ¼
number of classes. If teacher ti(1<=i<=n) teach class
Paper[4] proposes to change the chromosomes and give up cj(1<=j<=n), then aij=1, else aij=0. The relation of teachers and
the spaces relative to unchangeable courses or classrooms to classes are strict defined by the matrix A.
reduce the search space and improving the searching efficient.
However, it is not so easy to remove these ineffective spaces. AT is the transpose of A, let B (bij )mum A x AT , By the
It needs deep analysis of the very problem and can’t be used n
universally. rules of matrix multiplication: b
ij ¦a
k 1
ik a jk , if define add and
üüüüüüüüüüüüüüüüüü
978-1-4244-3531-9/08/$25.00©2008 IEEE multiply operation of the matrix element are logic “or” and


“and” compute, then if and only if aik=ajk=1, then bij=1. If in space of n dimension, coding every components in different
aik=ajk=1, that mean there are edges (ci,tk) and (cj,tk) in the length. If the every component is m-band code, that is
bipartite graph, known as the teacher gk teach class ci and cj, xi ( xi1 , xi 2 ,..., xili ) , yi ( yi1 , yi 2 ,..., yili ) assume the
there is a relation between ci and cj. Therefore the value of the
matrix B element indicate whether relation between classes, dissimilar chromosome of these two chromosomes
this kind relation cause by the same teacher which is a direct H (M1, M 2 )
link, known as first-level relation. The class ci and cj may have is: P n
, H ( M 1 , M 2 ) is the Hamming
not a common teacher, but there are the first-level relation (m  1)¦ li
between the class Ck, which is also affect each other in the i 1
arranging timetable, so we called second-level relation. There distance between M1
is similar three-level relation, four-level relation and so on, up
n li
to m-level relation.
The powers of matrix B is B : e
and M 2 , H ( M 1 , M 2 ) ¦¦ | x
i 1 j 1
ij  yij | . Evidently,

When e=1, in accordance with the above analysis that the 0 d P d1


matrix B indicate the first-level relation of the classes.
When P 0 , two chromosomes are completely different,
When e=2, matrix B2 indicate the second-level relation of
the classes. that is each bit of the chromosome is different. When P 1 ,
two chromosomes are the same .
In a similar way, when e=m, matrix Bm indicate the m-
level relation of the classes. As for the chromosome has large dissimilar chromosome
and not too small fitness, we use the weighting
B1  B 2  ...  B m : ª b11 b12 ... b1m º
Define matrix P «b ,
« 21 b22 ... b2 m »» Pi fitnessi
P
« ... ... ... ... » Di (k1 n
 k2 n
) , k1 , k2 t 0
«
¬bm1 bm 2
if the matrix element bij=1 that means there is relation between
... bmm ¼
»
¦Pj
j 1
¦j 1
fitness j
class Ci and class Cj, else class Ci and class Cj independent of
each other(0<=i,j<=m-1). We use chromosome with biggest Di to replace the less
inferior chromosome in the next generation.
The matrix P contain all the relations of classes. We
remove the repeat lines, and all the rest of the line should be Genetic algorithm of elitist strategy with dissimilarity
the differences. The classes are divided into several groups C1, chromosome:
C2,…, Ck (1<=k<=m) by each line of matrix P non-zero Step1 initialize the population, remark it as old-population
elements for a group.
Step2 calculate the fitness of chromosome in present
B. Using elitist strategy with dissimilarity chromosome population old-population, and find out the elitist chromosome.
In using of probability select measure, chromosome with Step3 do genetic operation to old-population, and get a new
high fitness has higher probability to evolve to the next population, remark it as new-population.
generation. However, the probability of being eliminated still Step4 find out the most inferior chromosome and less
exists. We can use elitist strategy with dissimilarity inferior chromosome in new-population.
chromosome to keep down the elitist chromosome to the next
generation. Step5 replace the most inferior chromosome in new-
population with elitist chromosome in old-population and new-
If we only use elitist strategy, the population will full of a population.
certain elitist chromosome and come into stagnant state after
experiencing several evolution generations without producing Step6 choose a chromosome in old-population which has a
better chromosome. relatively large dissimilar chromosome with the elitist
chromosome in new-population and has not too small fitness
We use a new elitist strategy, that is, under the preservation through calculating. Then exchange it with the less inferior
of the elitist chromosome, we select a chromosome in the prior chromosome in new-population.
generation to replacing the less inferior chromosome. This
chromosome has restively large dissimilarity chromosome Step7 if times of cycle more than the biggest generations,
with elitist chromosome, and has a relatively high fitness. Thus output the stat result, terminate the algorithm, or replace old-
we not only use of the global convergence of elitist strategy, population with new-population. Back to step2
but keep the variance of population through appending new
different chromosomes, and the convergence has been III. TESTS
improved.
We choose a timetable problem of a middle school with 37
Define dissimilar chromosome as assume any two classes, 14 lessons, 109 teachers and 1295 timeslot to test.
chromosomes M 1 ( x1 , x2 ,..., xn ) , M 2 ( y1 , y2 ,..., yn ) Assume the biggest number of evolution generations is 1000,
cross probability is 0.5, and variation probability is 0.5.


TABLE I. COMPARED WITH RUN TIME [3] Burke E K,Newall JP, “Multistage evolutionary algorithm for the
timetable problem,” IEEE Transactions on Evolutionary Computation,
Generation Standard GA Improved GA March 1999, pp.63-74.
100 292s 130s
200 590s 270s [4] Paechter B,Cumming A,Luchian H,Petriuc M, “Two solutions to the
400 1074s 532s general timetable problem using evolutionary methods,” IEEE World
800 2197s 1050s Congress on Computational Intelligence, January 1994,pp.300-305.
1000 2883s 1267s [5] Milena Karova, “Solving Timetabling Problems Using Genetic
From the table 1 we can know the improved GA algorithm Algorithms,” IEEE 27thinternational Spring Seminar on Electronics
Technology, January 2004. pp.96-98.
greatly reducing the running time. This is mainly because
[6] Thanh, Nguyen Duc, “Solving timetabling problem using genetic and
divide classes into groups to reduce the search space, and the heuristic algorithms,” Eighth ACIS International Conference on
application suit the multi-thread technology. Software Engineering, Artificial Intelligence, Networking, and
Parallel/Distributed Computing, March 2007. pp.472-477.
[7] BI WeiHong, REN HongMin and WU QingBiao,” A new elitist strategy
in genetic algorithms,” Journal of Zhejiang University(Science Edition),
January 2006. pp.32-35.
[8] Zhou HongWei; Yuan JinHui and Zhang LaiShun,” Improved Politics
of Genetic Algorithms for Premature,” Computer Engineering, October
2007. pp.201-203.

Figure 2. Compared with fitness

From the figure 4 we can see that, the standard genetic


algorithm largely improves the fitness in prior about 200
generations, but not so good in the next 800 generations. This
is the characteristic of genetic algorithm: converge to less
optimum solution quickly. During the middle and later, in the
unimproved genetic algorithm, the best fitness of chromosome
did not improve any more, and the population was full of
chromosomes with high fitness. The search space was limited.
Using the improved genetic algorithm, with the increase of
evolution generations, select rate of chromosomes with low
fitness has been improved through using dynamic variation's
select rate and through using elitist strategy with dissimilarity
chromosome; we not only preserve the elitist chromosome but
also increase the variation of population. These modifications
enlarge the search space effectively. From picture 4, the
improved genetic algorithms can still slowly improved fitness
from 200th to 800th. After continuously run 20 times, the
resulting fitness is improved by at least 15% from improved
genetic algorithm compared with the standard genetic
algorithm.

IV. CONCLUSIONS
This paper synthetically considered weakness of genetic
algorithm and the characteristic of timetable problem when
optimize timetable problem, and proposed some methods to
improve the standard genetic algorithm. Those improvements
enhanced the search ability of the genetic algorithm and have a
good prospect of application and extension.
[1] Hitoshi Kanoh,Yuusuke Sakamoto, “Interactive Timetabling System
Using Knowledge-Based Genetic Algorithms,” IEEE International
Confernce on Systems,Man and Cybernetics,June 2004:5852-5857.
[2] Ren QingSheng and Ye ZhongXing, ” Analysis of Genetic
Operators㧘” May 2000, pp.113-114..



You might also like