0% found this document useful (0 votes)
8 views6 pages

Aycan CourseSch

This paper examines using simulated annealing to solve the course scheduling problem for a computer engineering department. It defines the constraints of the scheduling problem and compares different neighborhood search algorithms as part of the simulated annealing approach. The combination of simple search, swapping, and simple search-swapping algorithms produced the most satisfactory results.

Uploaded by

bashar.tahayna
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views6 pages

Aycan CourseSch

This paper examines using simulated annealing to solve the course scheduling problem for a computer engineering department. It defines the constraints of the scheduling problem and compares different neighborhood search algorithms as part of the simulated annealing approach. The combination of simple search, swapping, and simple search-swapping algorithms produced the most satisfactory results.

Uploaded by

bashar.tahayna
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

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

net/publication/224398617

Solving the Course Scheduling Problem Using Simulated Annealing

Conference Paper · April 2009


DOI: 10.1109/IADCC.2009.4809055 · Source: IEEE Xplore

CITATIONS READS

57 2,148

2 authors:

Esra Aycan Tolga Ayav


Izmir Katip Celebi University Izmir Institute of Technology
16 PUBLICATIONS 81 CITATIONS 38 PUBLICATIONS 304 CITATIONS

SEE PROFILE SEE PROFILE

All content following this page was uploaded by Tolga Ayav on 19 October 2015.

The user has requested enhancement of the downloaded file.


Solving the Course Scheduling Problem Using
Simulated Annealing
E. Aycan and T. Ayav
Department of Computer Engineering
İzmir Institute of Technology
Email: {esraaycan, tolgaayav}@iyte.edu.tr

Abstract— This paper tackles the NP-complete problem of programming for finding an initial solution and try various
academic class scheduling (or timetabling). The aim is to find a neighborhood search algorithms. The comparison results are
feasible timetable for the department of computer engineering demonstrated in section IV and related work is given in section
in İzmir Institute of Technology. The approach focuses on
simulated annealing. We compare the performance of various V. Finally, we conclude the paper in section VI.
neighborhood searching algorithms based on so-called simple
search, swapping, simple search-swapping and their combinations, II. C OURSE S CHEDULING P ROBLEM
taking into account the execution times and the final costs. The
most satisfactory timetable is achieved with the combination of In the Department of Computer Engineering of İzmir Insti-
all these three algorithms. The results highlight the efficacy of tute of Technology, course scheduling has been performed by
the proposed scheme. the senior staff members manually so far. However, solving
the course scheduling problem by hand usually might fail to
Keywords - course scheduling, simulated annealing, neigh- satisfy all the constraints. According to the definition of course
borhood searching scheduling, in order to obtain an appropriate solution, all hard
constraints have to be satisfied, while trying to fulfill as many
I. I NTRODUCTION soft constraints as possible. As a case study, 2007 − 2008
Fall Semester is handled. This problem consists of 5 classes
The University Course Timetabling Problem (UCTP) is a (including postgraduate classes) with 5 classrooms and a
common problem that almost every university has to solve. shared laboratory. In this case, any constraint related with
The basic definition states that UCTP is a task of assigning the classrooms is ignored such as capacity of the rooms or room
events of a university (lectures, activities, etc) to the various availability, since each class has its own classroom in computer
resources such as lecturers, classrooms and time slots. This engineering department. Totally there are 20 lectures given by
is done by minimizing the violations of a predefined set of 8 instructors in this case study. Lecture durations can change
constraints. In other words, no teacher, no class or no room between 3 and 5, but the lectures that take 5 time slots are
should appear more than once in any period of time. divided as 3 slots for theoretical and 2 slots for laboratory
There are also other timetabling problems described in the lectures. Hence, the laboratory lessons are considered as a
literature such as examination timetabling, school timetabling, separate lesson of which duration is 2 time slots and they are
employee timetabling, etc.. All these problems share similar assigned to the laboratory. There can be maximum 8 time slots
characteristics and they are similarly difficult to solve. The for one day in the university, i.e., there are 40 time slots per
general university course timetabling problem is known to be week. By considering all these conditions, the hard constraints
NP-complete, as many of the subproblems are associated with can be constructed as follows:
additional constraints.
C1 : Each instructor can take only one class at a time.
The intention of this paper is to study course timetabling
C2 : Clashes must not occur between the lectures for
with special emphasis on department-based timetabling as a
students of one class.
classical application area where various types of preferences
C3 : If any instructor has some requests that have to be
need to be satisfied to obtain a feasible solution. Thus, it is
satisfied, their demands must be fulfilled.
focused on the solution techniques for course timetabling of
C4 : If any class has to take lectures from other de-
İzmir Institute of Technology Computer Engineering Depart-
partments, the time slots that are given from those
ment.
departments must be allowed to those lectures.
In the following section, the course scheduling problem in
C5 : All lectures must start and finish in the same day.
the university is presented. This is done in two steps: We first
describe the problem, then give some formal definitions. In The soft constraints taken into account are:
section III, Simulated Annealing (SA) method is presented. C6 : The number of alternatives that students can attend
Our approach is mainly based on SA, yet the performance of should be maximized.
SA highly rely on the initial solution, neighborhood search and C7 : The student conflicts between lectures should be
cooling process, as described in section III. We use constraint minimized.
C8 : Friday should be free for all classes. Furthermore, the number of violated soft constraints are tried
C9 : Preferences of instructors should be fulfilled. to be minimized.

The model of the case study problem is modeled according III. S IMULATED A NNEALING M ETHOD
to the definition of constraint satisfaction problem. A con- The application of Simulated Annealing (SA) to the
straint satisfaction problem is a triple (Z, D, C) where Z is a timetabling problem is relatively straight forward. The par-
finite set of variables {x1 , x2 , · · · , xn }, D is a function which ticles are replaced by elements. The system energy can be
maps every variable in Z to a set of objects of arbitrary type, defined by the timetable cost for timetable modeling. An initial
i.e., D : Z → finite set of objects (of any type). Dxi , the allocation is made in which elements are placed in a randomly
domain of xi , is taken as the set of objects mapped from xi chosen period. The initial cost and an initial temperature
by D. These objects are called possible values of xi and the are computed. To determine the quality of the solution, the
set Dxi . C is a finite (possibly empty) set of constraints on an cost has a critical role in the algorithm just as the system
arbitrary subset of variables in Z. In other words, C is a set of energy role in the quality of a particle being annealed. The
sets of compound labels. Because course scheduling problem temperature is used to control the probability of an increase
is a real life problem which has plenty of constraints, it is in cost and can be likened by the temperature of a physical
categorized under the optimization problem. Hence the triple particle [3].
definition of the constraint satisfaction problem (denoted by The change in cost is the difference of two costs; one of
P) becomes quadruple (Z, D, C, F ) where F is the objective them is the first cost that is before the perturbation and the
function that indicates the quality of the solution. Formally, second one is the cost after the randomly chosen element is
we denote with cs(P) the solution of P by any constraint changed of an activity. The element is moved if the change in
satisfaction method [1]. Similarly, we use sa(P) to denote the cost is accepted, either because it lowers the system cost, or
solution of P by simulated annealing. the increase is allowed at the current temperature. According
Starting from a good point for searching a feasible solution to the timetabling problem model, the cost of removing an
is a very critical step in simulated annealing. We use constraint element usually consists of a class cost, an instructor cost and
satisfaction methods for an initial timetable satisfying all the a room cost.
hard constraints and some of the soft constraints. Subsequently SA is an iterative method and a typical SA algorithm accepts
for fine tuning, we use simulated annealing in order to opti- a new solution if its cost is lower than the cost of the current
mize a given objective function, F . This optimization allows solution in each iteration. Even if the cost of the new solution
us to take into account the soft constraints more effectively. is greater, there is a probability of this solution to be accepted.
With this acceptance criterion it is then possible to climb out
The model consists of a set of resources and a set of activ-
of a local minima. The SA algorithm we use, denoted with
ities. The time slots can be assigned a constraint, either hard
sa(P), can be seen in Fig. 1 [4].
or soft; a hard constraint indicates that the slot is forbidden
for any activity, a soft constraint indicates that the slot is not Find a random initial solution s := s0 using cs(P)
preferred. These constraints are called as time preferences. Select an initial temperature t := t0 > 0
Time preferences can be assigned to each activity and each Select a temperature reduction function α
resource, which indicate forbidden and non preferable time repeat
repeat
slots [2]. The lectures are called activities in the timetabling
s := N eighborhoodSearching(s)
model. Every activity is defined by its duration (expressed as δ := F (s ) − F (s)
a number of time slots), by time preferences, and by a set of if((δ ≤ 0) or (exp(−δ/t) < rand[0, 1]))
resources. Activities require these set of resources. Resources s := s
also can be described by time preferences. Only one activity endif
can use a resource at any time. Each resource can represent until iteration count = nrep
t := CoolingSchedule(t)
a teacher, a class, a classroom, or another special resource. until stopping condition is true
The solution of the problem defined by the above model is a
Fig. 1. Pseudo-code of the SA algorithm
timetable where every scheduled activity has its assigned start
time and a set of reserved resources needed for its execution.
This timetable must satisfy all the hard constraints. According One should note that several aspects of the SA algorithm are
to this structure; problem oriented. In the design of a good annealing algorithm,
deciding about proper neighborhood structure, cost function
1) Every scheduled activity has all the required resources and cooling schedule are of paramount importance. We only
reserved. focus on neighborhood searching in this context.
2) Two scheduled activities cannot use the same resource
at the same time. A. Neighborhood Searching
3) No activity is scheduled into a time slot where the In order to implement the SA algorithm a neighborhood
activity or some of its reserved resources has a hard structure must be defined. This is the key component of any
constraint in the time preferences. simulated annealing method. In this study, three algorithms
are handled in different combinations. In each iteration of the 1) If the activity slots are hard slots that violate the hard
algorithm, neighborhood searching is performed once to find constraints of that activity;
out the next possible solution set. More explicitly, we utilize n

the following algorithms: FC1 = w1 Ti , (1)
1) Simple Searching Neighborhood (SSN ): The first one i=1

of the neighbor algorithm is simple searching neighbor- where n is the number of activities, w1 is the weight
hood. It randomly chooses one activity and one slot. The and Ti is the number of time slots which are forbidden
chosen slot is assigned as the start time of the selected to the activities.
activity (see Fig. 2). Please note that Slot(ac) depicts 2) If the same instructor is assigned to two activities at the
the starting slot of activity ac. same time;
2) Swapping Neighborhoods (SW N ): The second algo- n−1
 n

rithm selects randomly two activities and swaps their FC2 = w2 Iij , (2)
start times (see Fig. 3). i=1 j=i+1
3) Simple Searching and Swapping Neighborhoods
where n is the number of activities, w2 is the weight,
(S 3 W N ): This neighborhood searching algorithm
Iij is the number of instructors who give two lectures,
chooses randomly two activities and two slots. These
i and j, at the same time.
two slots are assigned as the start times of the randomly
3) If the same class is assigned to two activities at the same
selected activities (see in Fig. 4).
time;
n−1
  n
SSN() FC3 = w3 Cij , (3)
{ ac := select random activity(); i=1 j=i+1
sl := select random time slot();
Slot(ac) := sl; where n is the number of activities, w3 is the weight,
} Cij is the number of classes which are given to two
Fig. 2. Pseudo-code of the SSN algorithm used in neighborhood searching. lectures, i and j, at the same time.
4) If the activity slots are separated into two days. (Each
activity must start and finish in the same day).
n

SWN() FC4 = w4 Xi , (4)
{ ac1 := select random activity1();
i=1
ac2 := select random activity2();
sl := Slot(ac1); where n is the number of activities, Xi is the number
Slot(ac1) := Slot(ac2); of time slots which are given to lectures i, it is a
Slot(ac2) := sl; boolean variable which becomes true when the course
}
is separated into two days and w4 is the weight.
Fig. 3. Pseudo-code of the SWN algorithm used in neighborhood searching. The conditions that the timetable has penalties for soft
constraints are:
5) If the activity slots are soft slots that violates the soft
S3 WN()
constraints of which activity;
{ ac1 := select random activity1(); n

ac2 := select random activity2(); FC5 = w5 Yi , (5)
sl1 := select random time slot1(); i=1
sl2 := select random time slot2();
Slot(ac1) := sl1; where n is the number of activities, Yi is the number of
Slot(ac2) := sl2; time slots which depends on preferences of instructors
} and w5 is the weight. It can be inferred soft slots either.
Fig. 4. Pseudo-code of the S3 WN algorithm used in neighborhood searching. 6) If there is any student conflict between the previously
failed lectures that a student has to take, and the regular
lectures that are yet to be taken.
n−1
 n

B. Cost Calculation FC6 = w6 Sij , (6)
i=1 j=i+1
For the case of course scheduling, the cost calculation tries
to show the influences of both the hard constraints and soft where n is the number of activities, Sij is the number
constraints. Penalty scores of both the hard constraints and soft of students who take two lectures of different classes, i
constraints are presented below. Each constraint is defined by and j, at the same time. If a student follows an irregular
a penalty score function. The conditions that the timetable has program, the lecture conflicts are minimized by this
penalties for hard constraints are: constraint. It is taken as a soft constraint, otherwise
TABLE I
course scheduling problems would be very strict and
T HE EFFECT OF Nmove ON C OSTS AND E XECUTION TIMES .
had no solution.
To determine the student conflicts, all the information about Nmove 10 50 100 500 1000 3000
the students and lectures are collected from the university’s Execution
database system so that any irregular situation can be identi- time (sec) 0.8 3 6 29 60 154
Cost 2018800 4100 3500 3300 3400 3300
fied. For instance, if a third year standing student has some
unsatisfied courses from the second year, which conflict with
the third year courses, these conflicts should be avoided.
different neighborhood searching algorithms are demonstrated.
For hard constraints, the given penalties (wi ) must be very
First, Table II compare three different algorithms presented
high, e.g., approximately ∞. For soft constraints, penalties can
in the previous sections, namely SSN , SW N and S 3 W N .
be chosen smaller, taking into account the priorities of the
According to the table, SSN provides the best result. Since
constraints. Therefore, the cost function F can be calculated
SA is a heuristic method, several experiments should be
as the sum of those hard and soft constraints, i.e.,
done and the technique that returns the best result in an
F = FC 1 + F C 2 + F C 3 + F C 4 + F C 5 + F C 6 . (7) appropriate time should be chosen. Table III and IV show
an hybrid approach. The former one considers three pairs
C. Cooling Schedule
in combination, i.e., SSN − SW N , SW N − S 3 W N and
We use geometric cooling schedule as the cooling function. SSN −S 3 W N . The latter shows the case that three algorithms
In every nrep iterations, the next temperature is found by are used all together. This consists of two cases, A and B.
t := αt (8) In case A, all algorithms are executed sequentially in each
iteration. In case B, they are executed in turn basis, which
where α is the reduction parameter for geometric cooling and turns the best result among all these trials. Finally, in Fig. IV,
calculated as,
TABLE II
α = 1 − (ln(t) − ln(tf ))/Nmove (9) C OSTS AND EXECUTION TIMES WITH THREE NEIGHBORHOOD SEARCH
where t is the current temperature, tf is the final temperature ALGORITHMS .

and Nmove is a fixed value that affects the duration of the SSN SWN S3 WN
temperature decrease. The parameter of nrep is chosen as Cost CPU(sec) Cost CPU(sec) Cost CPU(sec)
3, which returns the best solution cost within an acceptable 3900 29 9300 40 4300 34
execution time. To determine nrep , several different values
such as 1, 2, 3, 5, 6 and 10 are experimented. A rough initial
temperature t0 is assigned 10000. This temperature is hot TABLE III
enough to allow moves to almost every neighborhood state, C OSTS AND EXECUTION TIMES WITH THE COMBINATIONS OF SN , SW N
and the SA algorithm iteratively updates the temperature using AND S3W N .
the functional dependence between the starting acceptance SSN and SWN SSN and S3 WN SWN and S3 WN
probability χ0 (60% to 70%) and the starting temperature t0 . Cost CPU(sec) Cost CPU(sec) Cost CPU(sec)
This functional dependence is as follows: 3900 28 4900 27 3700 31

χ0 = χ(δ1 , δn , δn+1 , · · · , δm , t0 )
 n
TABLE IV
= 1/m exp(−δi /t0 ) + (m − n)/n (10) C OSTS AND E XECUTION TIMES WHEN SSN, SWN AND S3 WN ARE USED
i=1
ALL TOGETHER .
where δi = F (si ) − F (s0 ), s0 is the initial solution, si
is a neighbor solution of s0 , F is the cost function, m is Case A (sequentially) Case B (in turn)
Cost CPU(sec) Cost CPU(sec)
the size of neighbor solution space. Initial temperature t0 is 4100 87 3600 28
derived from the starting acceptance probability χ0 using the
algorithm presented in [4]. For instance, in our settings, t0 is
the cost change during the annealing (in case B) is illustrated.
calculated as 5000. This algorithm has to be run only once
In the first phase, the initial cost obtained by cs(P) is 17600.
before executing the SA algorithm.
After the annealing, the cost achieves its final value of 3600.
IV. E XPERIMENTAL R ESULTS
V. R ELATED W ORK
In the experiments, we mainly focus on the comparisons
of the neighborhood search algorithms. First, one can see Timetabling problem has been worked on over the years,
the effect of Nmove on the total execution time of the SA so that many different solutions have been proposed. Precise
algorithm and the final cost in Table I. In the rest of the and heuristic solution approaches for the school and university
tables, we use Nmove = 500 since it gives the most satisfactory timetabling problem have been studied since the 1960s [5], [6],
results in terms of the final cost and execution time. Three [7], [3], [8], [9], [10], [11], [12], [13], [2].
in the implementation of the SA algorithm. The stage of the
hybrid approach may be integrated more fully, to yield a more
powerful and robust algorithm.
Another method for obtaining more quality results can be
performing reheating techniques in simulated annealing. By
reheating, one can get rid of hinging on local minima.
TABLE V
C OMPARISON OF THE TWO TIMETABLES PREPARED MANUALLY AND BY
S IMULATED A NNEALING .

Manually by the Staff With Simulated Annealing


5011800 3600
Fig. 5. Change of cost during the annealing process

If the history of the solution approaches are looked into, one


can notice that various solving methods have been proposed R EFERENCES
for this problem. Operations Research literature has been [1] E. Tsang, Foundations of constraint satisfaction. London and San
extensively studied in building university timetables over the Diego: Academic Press, 1993.
last 30 years. There are new solution techniques which have [2] T. Muller, “Constraint-based timetabling,” Ph.D. dissertation, Charles
University, 2005.
been evolving alongside the developments in mathematics and [3] D. Abramson, “Constructing school timetables using simulated anneal-
computer sciences. The methods for solutions vary from graph ing,” Management Science, vol. 37, no. 1, pp. 98–113, 1991.
coloring to complex meta-heuristic algorithms, including Lin- [4] T. Duong, “Combining constraint programming and simulated annealing
on university exam timetabling,” Research Informatics Vietnam and
ear Programming formulations fitted to the specific problem Francophone, pp. 205–210, 2004.
at hand. Hertz [14] has applied Tabu Search techniques, [5] M. Almond, “An algorithm for constructing university timetables,”
Abramson [3] use simulated annealing and several authors like Computer Journal, vol. 8, pp. 331–340, 1996.
[6] A. Tripathy, “School timetabling, a case in large binary integer linear
Burke et al. [8], Ross et al. [15] and Paechter et al. [16] have programming,” Management Science, vol. 30, pp. 1473–1489, 1984.
developed procedures based on variants of genetic algorithms. [7] D. Werra, “An introduction to timetabling,” European Journal of Oper-
A different approach is Constraint Logic Programming, as ation Research, vol. 19, pp. 151–162, 1985.
[8] D. E. Edmund Burke and R. Weare, “A genetic algorithm based
Brailsford [12]. university timetabling system,” East-West International Conference on
In recent years, hybrid methods become more popular and Computer Technologies in Education, vol. 1, pp. 35–40, 1994.
they are found more worthy to study on. The aim of the hybrid [9] V. A. H Gunadhi and W. Yeong, “Automated timetabling using an object
oriented scheduler,” Expert Systems with Applications, vol. 10, no. 2, pp.
approach is to take the best ideas from one approach and 243–256, 1996.
incorporate them with other good ideas from other approaches. [10] N. J. Christelle Guret and C. Prins, “Building university timetables using
In spite of the shortcomings of the comparisons, the hybrid constraint logic programming,” In Practice and Theory of Automated
Timetabling, pp. 130–145, 1996.
approaches still prove as promising algorithms. Hybridization [11] A. Schaerf, “A survey of automated timetabling,” Articifial Intelligence
has been proven to be very effective in the course timetabling Review, vol. 13, no. 2, pp. 87–127, 1999.
literature [17], [18], [19]. [12] C. N. P. S C Brailsford and B. M. Smith, “Constraint satisfaction prob-
lems: Algorithms and applications,” European Journal of Operational
Research, no. 119, pp. 557–581, 1999.
VI. C ONCLUSION [13] S. Abdennadher and M. Marte, “University course timetabling using
This paper presents simulated annealing mechanism for constraint handling rules,” Journal of Applied Artificial Intelligence,
vol. 14, no. 4, pp. 311–326, 2000.
the course scheduling problem of the university’s computer [14] A. Hertz, “Finding a feasible course schedule using tabu search,”
engineering department. The approach is successfully realized Discrete Appl. Math., vol. 35, no. 3, pp. 255–270, 1992.
by customizing the method for the application’s specific needs. [15] D. Corne and P. Ross, Practice and Theory of Automated Timetabling,
J. H. Kingston, Ed. Springer-Verlag, 1996, vol. 1153.
The manually obtained timetable in the 2007-2008 fall term [16] M. G. N. Ben Paechter, Andrew Cumming and H. Luchian, Practice
has a higher cost than the one obtained by SA method and Theory of Automated Timetabling. Springer Berlin / Heidelberg,
(see Table V). The method satisfies the hard constraints in 1996, vol. 1153.
[17] S. Abdullah and A. R. Hamdan, “A hybrid approach for university course
the problem and finds out a feasible solution by means of timetabling,” International Journal of Computer Science and Network
exploiting a number of soft constraints. By utilizing three Security,, vol. 8, no. 8, 2008.
different neighborhood searching algorithms together with [18] J. Thompson and K. Dowsland, “A robust simulated annealing based
examination timetabling system,” Computers and Operations Research,
their combinations, the best result is achieved. vol. 25, pp. 637–648, 1998.
For less solution time, the balance between solution quality [19] P. Kostuch, “The university course timetabling problem with a three-
and search time can be achieved through the predefined-time phase approach.” International Conference on the Practice and Theory
of Automated Timetabling (PATAT V), pp. 109–125, 2005.
simulated annealing technique used in this SA algorithm. For
a future work, the results of the experiments demonstrated in
the previous section can be improved by some modifications

View publication stats

You might also like