1. Trang chủ
  2. » Luận Văn - Báo Cáo

khóa luận tốt nghiệp tiếng anh :TIMETABLINGPROBLEM

49 664 0

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

THÔNG TIN TÀI LIỆU

Thông tin cơ bản

Định dạng
Số trang 49
Dung lượng 350,03 KB

Nội dung

• A set of additional period e.g., exam A after exam B and room exam A mustuse room R hard constraints.• Soft constraints which contribute to a penalty if they are violated includingdeta

Trang 1

VIETNAM NATIONAL UNIVERSITYUNIVERSITY OF SCIENCE

FACULTY OF MATHEMATICS , MECHANICS AND INFORMATICS

Nguyen Anh Hoang

TIMETABLING PROBLEM

Undergraduate ThesisAdvanced Undergraduate Program in Mathematics

Hanoi - 2012

Trang 2

VIETNAM NATIONAL UNIVERSITYUNIVERSITY OF SCIENCE

FACULTY OF MATHEMATICS , MECHANICS AND INFORMATICS

Nguyen Anh Hoang

TIMETABLING PROBLEM

Undergraduate ThesisAdvanced Undergraduate Program in Mathematics

Thesis advisor: Dr Hoang Nam Dung

Hanoi - 2012

Trang 3

Chapter 1 The Timetabling Problem 1

1.1 Definitions 1

1.2 Applications 2

1.2.1 Examination Timetabling 2

1.2.2 Post Enrollment based Course Timetabling 4

1.2.3 Curriculum based Course Timetabling 6

Chapter 2 Some General Algorithms 8

2.1 Genetic Algorithms 8

2.1.1 Introduction and Some Fundamentals 8

2.1.2 Main Ideas of Genetic Algorithm 9

2.2 Memetic Algorithms 14

2.2.1 Solution Representation 14

2.2.2 Generating the First Population 15

2.2.3 The Evolutionary Operators 16

Chapter 3 Specific Method for the International Timetabling Competition 19 3.1 Algorithm 19

3.1.1 Construction Phase 19

3.1.2 Hill Climbing Phase 20

3.1.3 Great Deluge Phase 21

3.1.4 Simulated Annealling Phase 22

3.2 Applying to Competition Problems 22

3.2.1 Applying to Examination Timetabling 23

3.2.2 Applying to Post Enrollment based Course Timetabling 24

3.2.3 Applying to Curriculum based Course Timetabling 25

Trang 4

Chapter 4 Applying to the University Timetabling Problem 27

4.1 Definition of the Problem 27

4.2 Algorithm 28

4.2.1 Deal with Hard Constraints 28

4.2.2 Deal with Soft Constraints 31

4.3 Results 32

4.3.1 Improve the Original Timetable 33

4.3.2 Apply the Algorithm to Create a Brand New Timetable 33

4.3.3 Comparing Solution between Original Timetable and New Timetable 41

Trang 5

I am grateful to all those who spent their time and support for this report.Foremost among this group is my advisor and instructor- Dr Hoang Nam Dung.Thank you for your dedication, patience, enthusiasim and encouragement to thisreport Sincere thanks to spent hours to meet me and encourage me to continue thisproject and broad my knowledge

Second, sincere thanks to all professors and lecturers of Faculty of matics, Mechanics and Informatics for their help throughout my university’s life atHanoi University of Science

Mathe-Finally, I would like to thank my family and friends who always support andgive me advice during my career at school

Trang 6

Nowadays, the timetabling problems are widely common in the real world.They can be seen and considered in every university in any country They often con-tain some constraints that needed to be satisfied, with the purpose to set an efficienttimetable Many algorithms are now gradually being constructed and developed,since finding the absolutely optimal solution is almost impossible However, peo-ple’s attempts for seeking the best method to solve the timetabling problems arevery important and meaning to the world

This thesis is organised as follows:

Chapter 1 presents definitions of the timetabling problem and its tions It can be constructed weekly timetable for a university

applica-Chapter 2 will give you some algorithms that can be used to solve this kind

of problems Up to now, people have found many ways to deal with schedulingproblem, and some of those are quite effective

Chapter 3 is devoted for the specific methods that the winners of the tional Timetabling Competition 2007 used to solve the problems

Interna-At last, Chapter 4 will illustrates an application at Hanoi University of ence timetabling problem and some of writter’s ideas to tackle this problem

Trang 7

in-In automated timetabling, the constraints for both types of timetabling lems generally tend to be separated into two groups: the hard constraints and thesoft constraints Hard constraints have a higher priority than soft, and usually bemandatory in their satisfaction Indeed, timetable will usually only be consideredfeasible if and only if all of the hard constraints of the problem have been satisfied.Soft constraints, meanwhile, are those that we want to obey if possible, and moreoften than not they will describe what it is for a timetable to be good with regards

prob-to the timetabling policies of the universities concerned, as well as the experiences

of the people who will have to use it [3]

Trang 8

The second International Timetabling competions consisted of three lems, each representing a different problem in educational timetabling, namely, ex-amination timetabling, post enrollment based course timetabling, and curriculumbased course timetabling This section provides a brief descriptscription of theseproblems.

The examination timetabling problem model presented in this problem is anextension of the model commonly worked on The fundamental problem involvestimetabling exams into a set of periods within a defined examination session whilesatisfying a number of hard constraint Like other areas of timetabling, a feasiblesolution is one in which all the hard constraints are satisfied The quality of thesolution is measured in terms of soft constraints satisfaction

The problem consists of the following:

• A list of periods covering a specified length of time The number and length

of periods are provided

• A set of exams that are to be scheduled into these periods

• For each exam, a set of enrolled students is provided Each student is enrolledinto a number of exams

• A set of rooms with individual capacities

1This section is cited from T.Muller (2007) [5], page 2.

Trang 9

• A set of additional period (e.g., exam A after exam B) and room (exam A mustuse room R) hard constraints.

• Soft constraints which contribute to a penalty if they are violated (includingdetails on weightings of these constraints)

A feasible timetable is one in which all examinations have a period and aroom assigned and the following hard constraints are satisfied:

• No student sits for more than one examination at a time

• The capacity of individual rooms is not exceeded at any time during the amination session Note that, unlike course timetabling, exams are explicitlyallowed to share rooms

ex-• Period lengths are not violated

• Additional hard constraints must be satisfied

The problem includes the following soft constraints:

• Two exams in a row: The number of occurrances when students have to sit for

two exams in a row on the same day

• Two exams in a day: The number of occurrances when students have to sit for

two exams on the same day

• Period spread: The number of occurances when students have to sit for more

than one exam during a time interval specified by the institution This is oftenused in an attempt to be as fair as possible to all students taking exams

• Mixed durations: The number of occurrances of exams timetabled into rooms

along with an exam with a different duration

• Larger exams constraints: The number of large exams appearing in the latter

portion of the timetable Definition of large and latter portion is a part of the

descriptscription of a particular instance

• Room penalty: The number of times a room is used which has an associated

penalty This is multiplied by the actual penalty as different rooms may havethe different associated weightings

Trang 10

• Period penalty: The number of times a period is used which has an associated

penalty This is multiplied by the actual penalty as different periods may havethe different associated weightings

The timetabling problem in this problem is intended to simulate the realworld situation when students are given a choice of lectures that they wish to at-tend, and the timetable then constructed according to these choices

The problem consists of the following:

• A set of events that are scheduled into 45 timeslots (5 days and 9 hours each)

• A set of rooms, each of which has a specific capacity, in which the events takeplace

• A set of features that are satisfied by rooms and which are required by events

• A set of students who attend various different combinations of events

• A set of available timeslots for each of the events

• A set of precedence requirements that state that certain events should occurbefore certain others

The aim is to try and insert each of the given events into timetable (that is,assign each event to one of the rooms and one of the 45 timeslot) while obeyingfollowing hard constraints:

• No students should be required to attend more than one event at the sametime

• In each case, the room should be big enough for all of the attending studentsand should satisfy all of the features required by the event

• Only one event is put into each room in any timeslot

2This section is cited from T.Muller (2007) [5], page 3-4.

Trang 11

• Events should only be assigned to timeslots that are pre-defined as available for

In addition, to the five hard constraints given above, the following soft constraintsare included in the problem:

• Last timeslot of the day: Students should not be scheduled to attend an event

in the last timeslot of a day

• More than two in a row: Students should not have to attend three or more

events in consecutive timeslots occuring in the same day

• One class on a day: Students should not be required to attend only one event

in a particular day

Note that these three soft constraints are the same as those used in the firstproblem The overall penalty is the sum of occurrances of a student in the soft con-straints that are violated

In this problem, it is allowable to produce an incomplete solution (someevents may be left unassigned), however, all hard constraints on the assigned events

must be satisfied Unplaced events are used to calculate a Distance to Feasibility

measure This is calculated by identifying the number of students that are required

to attend each of the unplaced events and then simply adding these values together

Trang 12

1.2.3 Curriculum based Course Timetabling3

The curriculum based timetabling problem consists of the weekly scheduling

of lectures for several university courses within a given number of rooms and timeperiods Conflicts between courses are determined according to the curricula pub-lished by the University and not on the basis of enrollment data

The problem consists of the following entities:

• Days, Timeslots and Periods: A number of teaching days in the week are

given (typically 5 or 6) Each day is splited into a fixed number of timeslots,which is equal for all days A period is a pair composed of a day and a timeslot.The total number of scheduling periods is the product of the number of daystimes the number of daily timeslots

• Courses and Teachers: Each course consists of a fixed number of lectures to be

scheduled in distinct periods, is attended by a given number of students, and

is taught by a teacher For each course there is a minimum number of daysover which the lectures of the course should be spread, moreover, there aresome periods during which the course cannot be scheduled

• Rooms: Each room has a capacity, expressed as the number of available seats.

All rooms are equally suitable for all courses (if large enough)

• Curricula: A curriculum is a group of courses such that any pair of courses in

the group has students in common Conflicts between courses, and other softconstraints, are based on curricula

The solution of the problem is an assignment of a period (day and timeslot)and a room to all lectures of each course The following hard constraints must besatisfied:

• All lectures of a course must be scheduled, and they must be assigned to tinct periods

dis-• Two lectures cannot take place in the same room in the same period

3This section is cited from T.Muller (2007) [5], page 4-5.

Trang 13

• Lectures of courses in the same curriculum, or taught by the same teacher,must be scheduled in different periods.

• If the teacher of the course is not available to teach that course in a given riod, then no lectures of the course can be scheduled in that period

pe-The problem includes the following soft constraints:

• Room capacity: For each lecture, the number of students that attend the course

must be less than or equal to the seats in all the rooms that host its lectures.Each student above the capacity counts as 1 point of penalty

• Minimum working days: The lectures of each course must be spread into the

given minimum number of days Each day below the minimum counts as 5points of penalty

• Curriculum compactness: Lectures belonging to a curriculum should be

ad-jacent to each other (i.e in consecutive periods) For a given curriculum weaccount for a violation everytime there is one lecture that is not adjacent to anyother lecture within the same day Each isolated lecture in a curriculum counts

as 2 points of penalty

• Room stability: All lectures of a course should be given in the same room.

Each distinct room used for the lectures of a course, beside the first, counts as

1 point of penalty

Trang 14

C HAPTER 2

Some General Algorithms

Nowadays, there are many algorithms produced to tackle the time lems Here we will introduce to you some of the algorithms which can be con-sidered as ’quite good’ for the experiments and results that they can provided forthe timetabling problems

prob-2.1 Genetic Algorithms1

2.1.1 Introduction and Some Fundamentals

Genetic algorithms are a general purpose optimization tool based on win’s theory of evolution They have the capability to produce solutions even whenthe dimensions of the problem increase and for this reason they have been success-fully applied to a wide variety of problems

Dar-Genetic algorithms operate on a population of solutions represented by somecoding A population consists of a number of genes, each of them is a unit of infor-mation New solutions are produced by combining genes from various populationmembers (we call it ’crossover’) to create offspring or by altering existing popula-tion members (we call it ’mutation’) On the other hand, we also define 2 types ofmutition, that is light mutation (or small alteration) and heavy mutation (or largescale alteration) Then a simulation of ’natural selection’ take place by first calculat-ing the quality of each solution and choosing the fittest one to survive to the nextgeneration Beside that, there are some important concepts that we should care suchas: chromosome (solution), gene (part of solution), allele (value of genes)

1See M.A.Aydin (2008) [2] for more precisely details.

Trang 15

Now we are going to have a quick view about some important concepts ingenetic algorithm That is chromosome and fitness function.

func-2.1.2 Main Ideas of Genetic Algorithm

In genetic algorithm, the main ideas consist of 3 steps The first step is ating a set of solutions (a population) randomly The next step is selecting chromo-somes from the initial population for the next generation This selection is based onsome criterias and there are some different methods to cope with it Finally, the laststep is recombining the selected chromosomes from step 2 to create the new popu-lation

Trang 16

cre-Now we focusing on the second step, that is the step of selecting somes from the initial population Here fitness function is used to decice whichparents will be chosen by evaluating the quality of solutions represented by thosechromosomes in the population Those with higher fitness value will have a greaterchance of being chosen than those with lower fitness value There are many differ-ent methods of selection in genetic algorithm One of them is a standard methodwhich called Roulette Wheel In this kind of method, each chromosome will be de-scribed as a slice in a circular wheel, and the chromosome with higher fitness valuewill have larger slice in the wheel For example, if there are N chromosomes in thepopulation, the wheel will rotate N times Each time the wheel rotate, it will stop atany chromosome, and that chromosome will be chosen as parents to the next gener-ation So the selection is end up with N selected chromosomes, keeping the number

chromo-of chromosomes in the population It is clear that the chromosome with higher ness value will have more chance of being chosen than the one with lower fitnessvalue, since it has a larger slice in the wheel Note that a chromosome can be cho-sen more than once Another method is called ’Tournamen Selection’ In this kind

fit-of method, two chromosomes will be chosen randomly from the population, andthe one with higher fitness value will be selected as the parent After that, the twochromosomes will be returned to the initial population, and they can be selectedagain

After finishing the second step, the last step ’recombination’ will take place.From the second step we can see that the selected chromosomes are the ones withhigh quality (since they have high fitness value), so it is reasonable to believe thatthe next generation will be better than the previous one Now the question is: how

to recombination these chromosomes? In genetic algorithm, there are two main combination operators, which called ’crossover’ and ’mutation’ (as shown in 2.1.1)

re-Crossover

In the crossover operation, the material of selected chromosomes will be mixed tocreate offspring If chromosomes are represented in bitstring, it will be done as fol-lows A crossover probability will be defined first Then a random number will bechosen in the interval [0;1] If the crossover probability is greater than the randomnumber, the crossover operation will be applied If not, the crossover operation willnot be applied, and the child chromosomes are the copies of their parents Note thatthe crossover probability plays an important role here

Trang 17

There are many method used in designing crossover operator in literature.Although they can be changed by problem type, the most common used in crossoveroperators are as follows:

two-point crossover are the simplest and widely used crossover method These methodscan be described as follows For instance, in one-point method, a number less thanthe length of chromosome will be selected randomly as the crossover point Thenthe genetic material before the crossover point will remain unchanged, while the ge-netic material after the crossover point is exchanged between the parents The idea

of one-point crossover can be generalized to N-point crossover by using N crossoverpoint rather than just one For instance, in two-point crossover, 2 numbers less thanthe length of chromosome will be selected randomly and represent crossover points.Then the genetic material between these two points will be swapped, while othersremain unchanged An example of two-point crossover method is given in Figure2.1

Figure 2.1: Two-point crossover

to give a chance for an allele to be exchanged with the gene of the other parent This

Trang 18

probability usually takes the value of 0.5.

are randomly selected and two crossover points are generated randomly Alleleswithin the two crossover points of a parent are exchanged with the alleles corre-sponding to those mapped by the other parent Figure 2.2 illustrates an example

of partially matched crossover According to the example, firstly the genes betweentwo crossover points are swapped between two parents Then the first gene value inParent 1 within the two crossover points, 7, maps to 9 in Parent 2 Therefore, genes

7 and 9 are swapped in Parent 1 Similarly, 8 and 2, also 4 and 1 are exchanged

to create the offspring Offspring 1 Corresponding changes are done in Parent 2 tocreate the offspring Offspring 2 [2]

Figure 2.2: Partially matched crossover

Mutation

In genetic algorithms, most chromosomes in the population seem like each otherafter a number of generations What it means is that, no crucial changes in the pop-ulation, therefore in the search space do not occur To overcome this problem andadd diversity to the population mutation operator is used Mutation operator hasthe effect of creating a new chromosome which cannot be created by the originalcrossover operator [2]

Trang 19

After the crossover is appied and offsprings are formed, they have a chance

of being mutated Mutation operators change one or more gene values in a singlechromosome For the chromosomes represented in binary string, the mutation op-erator works as follows: A number in the interval [0;1] is generated randomly andcompared to a predetermined mutation rate Mutation rates used in literature areusually very small (e.g 0.001) If the random number is greater than the mutationrate, mutation is not applied If not, then the gene value is changed artificially from

0 to 1 and 1 to 0 (see Figure 2.3)

Figure 2.3: Mutation operator

Replacement

After new offsprings are created by crossover operation and mutation ation, forming up the successor generation is the next step Note that the parentswere selected according to their fitness value, so we have reasons to expect that thenew offsprings will increase the fitness value of the population generation Throughreplacement, genetic algorithms decice whether offsprings will survive or not Some

oper-of the most common replacements are described below

Trang 20

Complete ReplacementAll the members of the previous generation will be deletedand replaced by the same number of new chromosomes that have just been created.

all Then n new chromosomes will replace them The choice of n and which bers to be deleted is an important point here

be deleted but only one or two of the new chromosomes that have the highest fitnessvalue will be chosen for the next generation

2.2 Memetic Algorithms 2

The concept of a memetic algorithm was first introduced by Moscato andNorman to describe evolutionary algorithms in which local search is used to a largeextent This idea has further been formalised by Radcliffe and Surrey and a compar-ison between memetic and genetic algorithms made A meme can be thought as aunit of information that reproduces itself as people exchange ideas A meme differsfrom a gene in that as it is passed between individuals, each individual adapts thememe as it sees best whereas genes are passed unaltered [1]

2.2.1 Solution Representation

Each solution in the population is represented as a number of memes Eachmeme contains information on what exams are scheduled in which rooms for a par-ticular period A further meme is used to hold exams which could not be scheduled

in the prescribed period Figure 2.4 shows an example of an encoded solution, where

e iis exam number i

2See E.K.Burke, J.P.Newall and R.F.Weare [1]for more precisely details.

Trang 21

Figure 2.4: The problem encoding

2.2.2 Generating the First Population

The initial population will be created by a weighted roulette wheel which

used to decide which period will be assigned for an selected event e based on the

scheduled events This idea consists of 3 following steps:

• Step 1: Choosing randomly an event e from those events which are unassigned.

• Step 2: Decide which period will be assigned for that selected event by thefollowing fitness function (note that the chosen period must be legal for theselected event)

numCommon+Size+1

penalty+1 (1)

where numCommon is the number of neighbor that e has in common with the exams already scheduled in that period, Size is the number of exams that al- ready scheduled in the period and penalty is the cost of placing e in that pe-

riod This function shows that the fitness value of a period is proportional to

the number of neighbor that event e has in common with the events that have

been scheduled in this period Moreover, this function tries to find the periodwhich increases penalty the least by biasing the roulette wheel

Trang 22

• Step3: Construct and execute a roulette wheel based on the values calculate to

choose a period in which to place e.

By this way, a higher quality population will be produced rather than a normalrandom population Beside that, the diversity of population is still kept, as expect

as in Genetic Algorithm

2.2.3 The Evolutionary Operators

There has been some debates as to whether should be the main operator in

a Genetic Algorithm It has been also suggested that local search has a part to play,

this approach being known as memetics A directed mutation approach has also been

found to achieve good results [1]

The algorithms presented here has been found to work well using a combination

of light and heavy random mutation, follow directly by the Hill Climbing method.Figure 2.5 shows how this combination works

resched-ule into some other periods (hard constraints should be satisfied, obviously), then it

is followed by Hill Climbing algorithm, which is described below

so-lution quickly In this operator, a period or a whole periods will be destroyed Theperiods which is considered as ’good’ will be kept, and the events in the remainingperiods will be rescheduled Now the question is, how can we measure the quality

of a period In this situation, the following steps is performed to cope with it

• Consider each period i at a time, assume that all the events scheduled to period

j (with j is not equal to i) are fixed Calculate the penalty caused by eventswhich are assigned to period i

• If this penalty is lower than the average penalty then the probability of being

destroyed of that period is measured as follows

P(disrupt) = penalty+0.2

2.average (2)

Trang 23

Figure 2.5: The evolutionary operator

• If this penalty is greater than the average penalty, then there are 2 cases Case

1, if the last period was not destroyed then destroy the next period instead ofthe current considered period Case 2, if the last period was destroyed, thendestroy the current considered period

After the destroyed periods are deciced, each exam in these periods will

be considered to move to the first other legal period Followed by Hill Climbingmethod, one can hope that improvements will be made This method uses a tech-nique of calculating the penalty caused by scheduling a particular event to a partic-ular method, given the other events are fixed This has advantage when trying toreschedule individual event, the improvement can be found in a fraction of time that

it would take to perform a full evaluation The idea of this method can be described

as follows

• Choose a period i in turn For each event e in this period, schedule it to each

period in the timetable If no hard violation is made, then calculate the penaltycaused by this arrangement

• Choose the period which increase the total penalty the least

• Try to schedule the unscheduled events

Trang 24

In order to ascertain the value of a solution the evaluation function is appied

to it to calculate its fitness, and therefore its ability to survive in the total

popula-tion For the trials shown below the objective was to schedule all events in the givennumber of periods such that if a student has two exams on the same day then thereshould at least be a full period between them This evaluation function can be ex-pressed as:

10numEvents 200numUnscheduled+∑numPeriods i=0 −1NumCon f licts(Period i , Period i+1)

where numEvents is the number of events in the timetable, numUnscheduled is the number of events not scheduled in a period yet, and NumConflict is a function re-

turning the number of conflicts, weighted by student numbers, between two periods

on the same day [1]

After applying those operators above, the size of population is ing To pass this situation, only some events will be chosen to the next generation.This can be done by using the classic roulette wheel selection, in which each event

overwhelm-is performed as a slice proportional to its fitness value Thoverwhelm-is wheel will rotate thesame number of times as the total number of events in the new population

Beside that, there are some good algorithms should be considered in theproblem such as: tabu search, group-based operators, conflict-based statistics, etc.But these methods are still hard to be used to find an optimal solution quickly andefficiently

Ngày đăng: 08/11/2014, 11:22

TỪ KHÓA LIÊN QUAN

TÀI LIỆU CÙNG NGƯỜI DÙNG

TÀI LIỆU LIÊN QUAN

w