You are on page 1of 9

Applied Mathematics and Computation 175 (2006) 814–822

www.elsevier.com/locate/amc

A computational approach
to enhancing course timetabling
with integer programming
S.A. MirHassani
Faculty of Mathematics, Shahrood University of Technology, Shahrood 36155-316, Iran

Abstract

We show in this paper that the integer programming approach is well suited for solv-
ing the timetabling problem: the definition of the integer programming model is simple;
its implementation is immediate by using, a mathematical programming language and
an integer programming solver. The power of the integer programming approach allows
us to extend the model in different interesting directions. A novel 0–1 integer program-
ming formulation of the university timetabling problem is presented. The model pro-
vides constraints for a number of operational rules and requirements found in most
academic institutions.
 2005 Elsevier Inc. All rights reserved.

Keywords: Timetabling; Assignment; Integer programming

1. Introduction

The primary purpose of our work is to solve a real timetabling problem


at Shahrood University of Technology (Iran). Here, the timetable for large

E-mail address: a_mirhassani@hotmail.com

0096-3003/$ - see front matter  2005 Elsevier Inc. All rights reserved.
doi:10.1016/j.amc.2005.07.039
S.A. MirHassani / Appl. Math. Comput. 175 (2006) 814–822 815

lecture classes is constructed by a central scheduling office in order to balance


the requirements of many departments offering large classes. Integer pro-
gramming is a classical tool in practical operations research and can be
applied to many problems. The technique is well known and reliable but it
must be handled carefully, since some integer programming formulations
might require a large amount of computer time. Given a problem with a
few dozen variables, one cannot be confident whether the integer program-
ming will work until it has been tried on realistic instances. If it does not
work, then an alternative mathematical formulation of the same problem
might prove better.
The timetabling problem consists of scheduling a set of meetings, between
lecturers, and students over a set of time periods, which requires some re-
sources and has to satisfy some additional constraints. It is strongly dependent
upon the number of students, teachers, classrooms and periods or sessions. An
optimal schedule would be one where no teacher, student or classroom is used
more than once at any given period. Timetabling problems occur in course
scheduling and finals scheduling at educational institutions. The assignment
of courses to faculty members and then the assignment of these courses to time
periods is an important administrative task that must be performed in aca-
demic departments each semester or term. In such an academic environment,
there are some organizations, as well as individual goals that influence the
assignment problem. The goal of administrators is driven by the changes in
student demand for courses, and hence, the willingness of the involved admin-
istrators to provide such necessary courses. In addition, offering these courses
has to meet the facultyÕs teaching loads. Of course, still there exist some other
factors affecting the assignment problem such as the number of time slots
available for scheduling, the number of full-time and part-time members,
and the number of the classrooms. General policies such as the number of
evening classes also play an important role in this problem. Preparing a time-
table is a tedious and time-consuming task, which entails the activity of a con-
siderable group of people in the registration office for several days. It includes
a large variety of problems at different levels in the education system from
school to university. Also, the school timetabling varies from one country to
another since the school regulations and the education systems are quite
different.
The timetabling problem is not a new one and a number of researchers have
introduced models and algorithms for formulising and solving this problem. It
has been frequently studied due to its wide range of applications. However,
such problems are often solved manually because of lack of appropriate com-
puter tools. Most of the work has been done for school timetabling problems
and relatively few studies have so far dealt with college or university timet-
abling problems. Also, there has been some accent on the examination timeta-
bles. For example, Alvarez-Valdes et al. [1] describe an algorithm for solving
816 S.A. MirHassani / Appl. Math. Comput. 175 (2006) 814–822

Spanish school timetabling problems whose goal is to find a feasible solution


and possibly a compact solution for classes and teachers. Similar studies have
been done for schools in Europeans countries, Japan, and Australia. It is well
known that all the timetabling problems are NP complete [7], even in their sim-
plest form and hence finding an optimum solution or proving optimality of a
feasible solution seems impossible when the problem size gets large. Techniques
such as the Simulated annealing [2,3], Tabu search [4], Hungarian method [5]
and other Heuristic algorithms have been used to arrive at a good solution
to the problem in a reasonable span of time. For instance, Tripathy [6] used
the Lagrangean relaxation to solve a timetabling problem as a large-scale 0–
1 IP problem. Silver [9] collects and provides a number of heuristic methods
to those analysts and managers who are not yet aware of the specific heuristic
approaches. Papoutsis et al. [10] has presented a column generation (CG)
approach as a solution to the timetabling problems of Greek high schools.
Daskalaki et al. [8] solved an integer programming formulation in a case study
at the University for the timetabling of the Engineering Department. Mirrazavi
et al. [11] proposed a combined approach of optimization and heuristic method
to overcome these difficulties.
The present study deals with college/university situations one of the charac-
teristics of which is their large size.

2. Problem description

The problem considered here deals with the scheduling of about 200 subjects
over two terms (one year) in the faculty of science. BSc students study 8 terms
before graduation. For example, a student is now at term 4 if he/she started
his/her academic education about two years ago. According to the depart-
mentÕs regulation, a set of certain lectures has to be scheduled in specific terms.
This requirement places students in particular groups, based on the year they
started their studies, which must be considered in any feasible timetable, for
example, basic maths is offered for students at term one and the advanced
one for those at term two and so on. Other subjects will be considered in the
term timetable if the number of students who enrolled is more than a minimum
value. (The minimum value is defined by the departments and can be different
from one subject to another.) For instance, if the grade of a certain student in a
given course during one term in a year is poor enough then he/she has to repeat
the course in the coming terms. Such students cannot graduate on time. Stu-
dents from the 4 different departments of mathematics, physics, chemistry
and geology have to attend some general courses during each term. Thus when
these subjects are scheduled in a term; all the other subjects which are also to be
studied by the students cannot be scheduled at the same time. The most impor-
tant elements of our timetable problem are:
S.A. MirHassani / Appl. Math. Comput. 175 (2006) 814–822 817

• General subjects should be available for all faculty students.


• The timetable has to deal with about 200 subjects in each term.
• Each week is of the 38 time slots (7 days per week and 6 sessions per day
except for Friday that has 2 sessions).
• No student is expected to attend more than one subject a session.
• No lecturer is expected to attend more than one subject a session.
• No overload for any of the teaching members is accepted.
• A student in term k (k = 1, . . . , 8) must be able to take all the subjects spec-
ified for this term (departmentÕs regulation) and some other optional
subjects.
• Some subjects need more than one session per week, which must be consid-
ered (weekly structure).
• Two sessions of one subject cannot be set on one day or two consecutive
days (departmentsÕ regulation).
• More than three sessions in each day for a student is not accepted (depart-
ments regulation).
• Any subject pre-assigned to a session will be fixed before the scheduling
start.
• The evening students who register for evening courses are not able to attend
morning sessions. Thus, the subjects related to this group of students must
be set to afternoon sessions.

In addition to organizational requirements, there exist individual lecturerÕs


requests that influence the problem. For example, there are some preferences
with regard to certain sessions on a day or certain days per week. Some lectur-
ers prefer to teach in the morning while others prefer to work in the afternoon
or evening. Some members like to have one or two days off before the weekend
while others prefer to be free after the weekend. Also, there is a group of lec-
turers who are not faculty members but co-operate with different departments.

3. The model

The mathematical model must represent the correct status of the courses,
lecturers, and classrooms as well as the faculty requirements. A linear model
can be expressed using Boolean variables. First of all, let us define the decision
variables. Let xlcdh (l = 1, . . . , L, c = 1, . . . , C, d = 1, . . . , D, and h = 1, . . . , H) be
a binary variable that is 1 if lecturer l teaches course c on day d at time h; other-
wise 0. It is clear that all combinations of l, c, d and h are not meaningful and
are restricted appropriately. The priority to use different time slots is pre-
defined by parameter ph P 0 with the higher penalty values representing the
lower preferences. The failure to satisfy constraint type (2) or (3) is measured
by the non-negative variable udht, vcd (t = 1, . . . , T, c = 1, . . . , C, d = 1, . . . , D,
818 S.A. MirHassani / Appl. Math. Comput. 175 (2006) 814–822

and h = 1, . . . , H) and is penalized via fixed parameters q and r each, respec-


tively. The objective function sets to minimize the infeasibility of the soft con-
straint and also penalize the redundant and non-preferred times. The model is
specifically as follows:
X X X X
min z ¼ xlcdh þ ph xlcdh þ qudht þ rvcd ;
lcdh lcdh dht cd

subject to
X
xlcdh ¼ CS c 8c; ð1Þ
ldh

where the number of sessions necessary for course c is presented by CSc. This is
a hard constraint that must be satisfied properly
X
xlcdh  udht 6 1 8d; h; t. ð2Þ
lc

Since all courses that linked to a semester or term may be chosen by the
students simultaneously so it is necessary to schedule in different day and
time slot. The violation of this regulation will be considered by udht, in
constraint (2)
X X
xlcdh þ xlc;dþ1h  vcd 6 1 8c; d. ð3Þ
lh lh

Also, it is recommended to have one day off between two sessions of each


course. This regulation is imposed through constraint (3) and obeys as well
as possible. The violation of this regulation will be measured by vcd.
X
xlcdh 6 1 8l; d; h. ð4Þ
c

This constraint guarantees that no more than one course be assigned to a lec-
turer in each session.
X
xlcdh 6 RoomsðrtÞ 8h; d; rt; ð5Þ
lc;CRT ðcÞ¼RoomTypeðrtÞ

where the number of rooms of type rt is presented by Rooms(rt). These con-


straints set the classroom limitations
xlcdh 2 f0; 1g; udht P 0; vcd P 0 8l; c; d; h; t. ð6Þ
Practically, all combinations of indices are not meaningful and will be con-
trolled appropriately according to the information supplied by the faculty.
We will show in the following paragraph that it is very easy to formulate this
model using AIMMS. AIMMS is a modeling system that allows us to set up
complicated linear programming models, involving thousands of variables
S.A. MirHassani / Appl. Math. Comput. 175 (2006) 814–822 819

and constraints, in a clear, concise, and efficient way. The variables of the con-
sidered linear programs may be continuous or integer. Its solver computes an
optimal solution to the (integer) linear programs. In order to solve the above
problem, we have formulated it with AIMMS using the following identifiers.
This task is very easy because the obtained program is similar to the usual
mathematical programming formulations. First of all, we need to define sets
and indices.

Sets and indices


Identifier Indices Description
Courses c All available courses
Lecturers l All available lecturers
Days d All working days
Sessions h All the authorized time slots on each day
Terms t All defined semesters or terms
Classrooms rt All classroom types

Data: The following data is presented to the model through a set of param-
eters necessary to avoid having redundant variables or constraints, for exam-
ple, the days a lecturer is working or the courses taught or the number of
sessions to be considered for each course and so on. Some of the tables are
reported here.

Parameters
Identifier Indices Description
CS c Course session requirements
CT c Term no. in which course c will be submitted
CRT c Course room type
LF l, c, d, h 1 if lecturer l is prepared to teach course c on day d
at time h; otherwise 0
Rooms r Number of type r rooms

Also, the following variables and constraints are used.

Variables
Identifier Index domain Description
X (l, c, d, h)jLF(l, c, d, h) 1 if lecturer l teaches course c on day
d at time h; otherwise 0
U (d, h, t) The infeasibility of soft constraint (2)
V (c, d) The infeasibility of soft constraint (3)
820 S.A. MirHassani / Appl. Math. Comput. 175 (2006) 814–822

All of the variables are non-negative.

Constraints
Identifier Index domain Definition
Const1 (c) Sum((l, d, h), X(l, c, d, h)) = CS(c)
Const2 (d, h, t) Sum((l, c)jCT(c) = t, X(l, c, d, h))  U(d, h, t) < = 1
Const3 (c, d) Sum((l, h), X(l, c, d, h)) + Sum((l, h), X(l, c, d + 1, h))
 V(c, d) < = 1
Const4 (l, d, h) Sum((c), X(l, c, d, h)) < = 1
Const5 (d, h, r) Sum((l, c)jCRT(c) = RoomType(r), X(l, c, d, h)) <
= Rooms(r)

4. Experimental Results

The experiment was performed on a real course-timetabling problem. The


problem specification is shown in the following table.

Problem specification
Parameter name Number Description
Lecturer 25 Full time and part time
Courses 75 Including pre-assigned
Terms 8 As shown in the next table
Days 7 Friday afternoon excluded
Classroom types 3 Labs included
Time slots 6 Except Friday that is 2
Variables 1226 1082 binary
Constraints 944 Excluding simple upper bounds
Non-zeros 3355 Density 0.29%

The objective of these problems is to create a conflict-free timetable. The


output should contain no conflicts, thus there should be a one to one corre-
spondence in a curriculum (group, subject, venue, lecturer). The assignment
of lectures to venues that are unacceptable should be avoided and the alloca-
tion of lectures to groups or lecturers when they are unavailable should also
be avoided. The problem was thus formulated in AIMMS using solver XA.
It runs on a Pentium 4 computer with 1.84 GHz speed and 256 MB of
RAM. The optimal solution was founded after opening 277 nodes taking less
than 10 s.
S.A. MirHassani / Appl. Math. Comput. 175 (2006) 814–822 821

Groups of subjects in specific terms


Terms Course 1 Course 2 Course 3 ...
1 General Foundation of Maths General English ...
Maths I
2 General Computer Pro. I General Persian ...
Maths II
3 General Computer Pro. II Differential Equation ...
Maths III
4 Algebra I Mathematical Analysis I Numerical Methods I ...
5 Linear Mathematical Analysis II Numerical Methods II ...
Algebra
6 Algebra II Mathematical Analysis II Operational Research I . . .
7 Time series Graph theory Operational Research II . . .
8 Geometry Random Process Complex Analysis ...

5. Conclusion

The method for timetabling described in the present paper is superior to the
method currently used by Shahrood University of Technology and performs
well in comparison to other well-known methods that have been applied.
The main point is considering room allocations and students requirements
implicitly in order to avoid model size growth. A possible issue that was not
clearly reflected in the experiments is the relationship between the amount of
time the search is allowed and how much the search process is limited. It seems
logical that if the search process is given more time, the limitation on the search
space can be relaxed (applicable to large problems). Lastly, it is important to
mention the role of the values chosen for cost coefficients. According to our
experience, changing the penalty functions it is possible to change the compu-
tation time by a large factor, meaning that the optimization process may be
guided faster to the optimal solution.

References

[1] R. Alvarez-Valdes, G. Martin, J.M. Tamarit, Constructing good solution for the Spanish
school timetabling problem, Journal of Operation Research Society 47 (1996) 1203–1215.
[2] P. Dige, C. Lund, H. Raun, Timetabling by simulated annealing applied simulated annealing,
Lecture Notes in Economics and Mathematical Science 396 (1993) 151–174.
[3] D. Abramson, Constructing school timetables using simulated annealing sequential and
parallel algorithms, Management Science 37 (1991) 98–113.
[4] A. Hertz, Tabu search for large timetabling problem, European Journal of Operational
Research 54 (1991) 39–47.
822 S.A. MirHassani / Appl. Math. Comput. 175 (2006) 814–822

[5] J. Lions, Matrix reduction using the Hungarian method for the generation of school timetable,
Communications of the ACM 9 (1966) 349–354.
[6] A. Tripathy, School timetabling a case in large binary integer linear programming,
Management Science 30 (12) (1984).
[7] T.B. Cooper, J.H. Kingston, The complexity of timetable construction problems, in:
Proceedings of the First International Conference on the Practice and Theory of Automated
Timetabling, 1995.
[8] S. Daskalaki, T. Birbas, E. Housos, An integer programming formulation for a case study in
university timetabling, European Journal of Operational Research 153 (2004) 117–135.
[9] E.A. Silver, An overview of heuristic solution methods, Journal of the Operational Research
Society 55 (2004) 936–956.
[10] K. Papoutsis, C.V. Alouxis, E. Housos, A column generation approach for the timetabling
problem of Greek high schools, Journal of the Operational Research Society 54 (2003) 230–
238.
[11] S.K. Mirrazavi, S.J. Mardle, M. Tamiz, A two-phase multiple objective approach to university
timetabling utilising optimisation and evolutionary solution methodologies, Journal of the
Operational Research Society 54 (2003) 1155–1166.

You might also like