Page 1

www.csl.issres.net

Vol. 1 (1) – June 2009

Incorporating Of Constraint-Based Reasoning Into

Particle Swarm Optimization For University

Timetabling Problem

Ho Sheau Fen @ Irene1, Safaai Deris1 and Siti Zaiton Mohd Hashim1

1 Faculty of Computer Science and Information System, D07 Building, Level 4, Software

Engineering Department, Universiti Teknologi Malaysia, 81310, Johor, Malaysia

Abstract

Timetabling problems are often difficult and time-consuming task. It involves a set of

timeslots, classrooms, subjects, students and lecturers. The complexity problem is the

constraints that exist within the resources. Thus, a technique that can handle constraints is

needed to optimize the problem. Various approaches have been reported in the literature on

solving university timetabling problem. This paper focuses on developing a hybrid

algorithm consisting of a particle swarm optimization and constraint-based reasoning

in solving university timetabling problem in generating a feasible and near-optimal

solution. The proposed algorithm is tested using real data from the Faculty of Computer

Science and Information System, Universiti Teknologi Malaysia. The result is compared

against standard particle swarm optimization and hybrid particle swarm optimization-local

search. It shows that the proposed method has outperformed others.

Keywords: Timetabling; Particle swarm optimization; constraint-based reasoning;

University timetabling.

Introduction 1.

In a university, every semester each department of the university has to produce a new

timetable for subjects to be taught. The timetabling problem consists of allocating these subjects

with specific number of lecturers and classrooms in certain timeslots, in a week.

Recently, a lot of attention has been paid in automating the construction of timetable planning

using meta-heuristic approaches. The meta-heuristic approaches that have been tried, including

graph coloring [2, 6], simulated annealing [1], tabu search [3], genetic algorithms [18] and

constraint-based reasoning [20]. Most of these approaches generate feasible but not optimal

solutions.

c Corresponding Author: Ho Sheau Fen @ Irene

Email: ireneluv@hotmail.com Telephone: +6019-8331338

© 2009-2012 All rights reserved. ISSR Journals

Fax: +6089-673979

Page 2

Ho Sheau Fen @ Irene,

Safaai Deris &

Siti Zaiton Mohd Hashim

Some studies shows that by incorporating constraint-based reasoning a near-optimal solution

can be obtained. Author [14] incorporates of local search into CBR in generating university

timetable shows promising results. Authors [9, 17, 21] proposed a hybrid genetic algorithms (GA)-

constraints-based reasoning (CBR) in solving university timetable problem that generated feasible

and near-optimal solution. The drawback of this hybrid GA-CBR approach is it consumes more

computational time to generate a timetable [13]. Particle swarm optimization (PSO), a relatively

new stochastic optimization method shares a lot of GA similarities [8]. According to some solution

generated using PSO for university timetable; it is inadequate to control the constraints violation [4,

5, 10, 11]. Since hybrid GA-CBR successfully provides feasible and near-optimal solution, the

curiosity of hybrid PSO-CBR for the university timetable is investigated. This paper dealt with

solving university timetable for Faculty of Computer Science and Information System, Universiti

Teknologi Malaysia, Malaysia. The objective of the paper is to find a feasible yet a near-optimal

timetable that satisfies all constraints simultaneously. The paper is organized as follows. Section 2

describes the university course timetabling characteristics and desire constraints. Section 3

describes the hybrid proposed algorithm into solving UCTP. Section 4 reports and discusses the

experimental and results. Finally conclusion and future work are given in Section 5.

2.

University course timetabling

The university course timetabling problem (UCTP) consists of scheduling a set of

subjects within a given number of rooms and timeslots. UCTP models must accommodate the

characteristics and regulations of specific education systems. Therefore, the problem under

consideration will vary from university to the other.

2.1. Characteristics of the university timetable problem

The data used in this investigation is obtained from the Faculty of Computer Science

and Information System, University of Technology Malaysia in Malaysia for semester

I 2008/2009. There are up to 16 different groups of students ranging from year 1 to year 3.

The groups are categorized by their major (i.e. bioinformatics, software engineering, etc).

The timetable consists of 43 consecutive timeslots and 11 timeslots per day (five days a

week). Each timeslot consists of a 50 minutes lecture, with 10 minutes break between

subjects starting at 8:00 AM till 7:00 PM for 5 days. Another 12 extra timeslots are reserved

for non-academic activities and lunch hours.

A timetabling is characterized by events, such as lessons, lecturers, student groups

and rooms. Each event has its own unique ID given. Each room and timeslot has its own

preference depends on the subject‘s facilities and student‘s capacity. Figure 1 illustrated an

example of university weekly timetable.

Computer Science Letters

Vol. 1(1) 2009

2

Page 3

Ho Sheau Fen @ Irene,

Safaai Deris &

Siti Zaiton Mohd Hashim

Computer Science Letters

Vol. 1(1) 2009

3

Figure 1. An example of university weekly timetable

2.2. Modelling university course timetabling problem as constraint-satisfaction problem

The constraint-satisfaction problems (CSPs) are decision problems defined as

set of objects whose state must satisfy a number of constraints [19]. CSP has been classified

into two main groups:

• Complete method aims at exploring the whole search tree in order to find all

the solutions or to detect none valid CSP. Backtracking search is one of the

techniques under this group.

• Incomplete method mainly relies in the use of heuristics to provide a more

efficient exploration of interesting areas of the search space in order to find

some solutions. Local search (LS) technique is categorized under this group.

In order to solve the university timetabling problem using CBR, the problem has to

be modelled as a CSP. The CSP consists of a set of variables X = {x1,…,xn} which has an

associated domain Di of possible values. There is also a set of constraints restricting the

values that the variables can simultaneously take. A feasible solution is an instantiation of

all the variables that satisfies all the given constraints. Optimal solution can be found by

instantiating all the variables that satisfy all the constraints and optimize the given fitness

function.

2.3. University course timetable constraints

In order to generate a feasible and near-optimal timetable, constraints play an

important role. It can be classified into hard and soft constraints. Hard constraints must be

satisfied completely, while soft constraints have less priority to be satisfied. Violation of the

soft constraints will not cause the timetable to lose its feasibility.

Hard Constraints that have to be met:

Lecturer time-clash constraint: A lecturer should not be assigned to teach

more than one subject in the same timeslot.

Page 4

Ho Sheau Fen @ Irene,

Safaai Deris &

Siti Zaiton Mohd Hashim

Computer Science Letters

Vol. 1(1) 2009

4

• Equation (1) represents the inequality constraints for lecturer time-

clash constraint.

T(Si) ≠ T(Sj) if L(Si) = L(Sj) (1)

where T(Si) and T(Sj) are timeslots for subjects Si and Sj respectively.

L(Si) and L(Sj) are the lecturers of subjects Si and Sj respectively, i,j =

1,2,…,n.

Student group time-clash constraint: A student group should not be assigned

to attend more than one subject in the same timeslot.

• Equation (2) represents the inequality constraints for student group

time-clash constraints.

T(Si) ≠ T(Sj) if G(Si) = G(Sj) (2)

where G(Si) and G(Sj) are the student groups of subjects Si and

Sj respectively, i,j = 1,2,…,n.

Classroom time-clash constraint: one room should not be assigned to more

than one subject for the same timeslot.

• Equation (3) represents the inequality constraints for classroom time-

clash constraints.

T(Si) ≠ T(Sj) if R(Si) = R(Sj) (3)

where R(Si) and R(Sj) are the classrooms of subjects Si and Sj

respectively, i,j = 1,2,…,n.

Classroom capacity constraint: the number of students of a lesson assigned

to a room should be less than or equal to the capacity of the classroom.

• Equation (4) represents the inequality constraints for classroom

capacity constraints.

N(Si) ≤ Z(R(Si)) (4)

where N(Si) is the number of students of subjects Si and Z(R)

is the capacity of the classroom R, i,j = 1,2,…,n.

Classroom and timeslot-domain constraint: classrooms or timeslots assigned

to subjects must be within the range of domain.

Timeslot constraint: certain timeslots are reserved for non-academic activities

such as co-curriculum and lunch hours; therefore, they are not available for

any lectures.

Page 5

Ho Sheau Fen @ Irene,

Safaai Deris &

Siti Zaiton Mohd Hashim

Computer Science Letters

Soft Constraints that have to be met:

The scheduled timeslot of the subject should fall within the preference sets as

much as possible.

The scheduled classroom of the subject should fall within the preference sets

as much as possible.

Vol. 1(1) 2009

5

3.

Hybrid particle swarm optimization-constraint-based reasoning: proposed algorithm

3.1. Particle swarm optimization (PSO)

The particle swarm optimization (PSO) algorithm was firstly inspired by Kennedy

and Eberhart [7]. It is stochastic population-based evolutionary algorithms that use to find

the optimum solution over the search space in a variety points and converge the swarm at

the most promising area. Number of this variety points (called particle) is a constant in their

population size and each of the particle is a candidate solution. Each particle has a velocity

that allows it to “swarm” around over the search space for an optimum solution.

Assuming that the search space is D-dimensional denote by Xi = (xi1, xi2, …, xiD) the

ith particle of the swarm and by Pi = (pi1, pi2, …, piD) the best position from its memory

ability in the search space. Let g be the index of the best particle in the swam and Vi = (vi1,

vi2, …, viD) the velocity position of the ith particle.

The swarm is manipulated according to the following equations

vid = x * (w * vid + c1 * r1 * (pid – xid) + c2 * r2 * (pgd – xid))

xid = xid + vid

where d = 1,2,…,D; i = 1,2,…,N and N is the size of the population; w is the

inertia weight; c1 and c2 are two positive acceleration constants; r1 and r2 are two random

values ranging from [0,1] and χ is a constriction factor used to control magnitude of the

velocity. [22] has pointed out that the purpose of constriction factor is to insure the

convergence of the PSO. Equation (7) shows the find out of constriction factor.

(5)

(6)

χ = 2 / |2 – φ – ???? 4?| (7)

where, φ = c1 + c2, φ > 4. Typically, φ is set to 4.1 and χ is thus become 0.7298.

Equation (5) is used to calculate ith particle‘s new velocity and equation (6) will

update the position of the particle. The performance of each particle is measured using a

fitness function (equation (8)). Figure 2 shows the standard PSO algorithm for UCTP.