0% found this document useful (0 votes)
75 views

Project Seminar Presentation

This document describes using genetic algorithms and RNA search methods to solve a school timetabling problem. It defines the problem as scheduling classes, teachers, subjects and periods across multiple days to satisfy hard constraints like avoiding conflicts. It presents the chromosome representation as a 3D matrix and describes genetic operators like crossover and mutation. It also summarizes the RNA search method, tournament selection and the GAT4C genetic algorithm library used to find good timetable solutions.

Uploaded by

Gokulnath Pillai
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
75 views

Project Seminar Presentation

This document describes using genetic algorithms and RNA search methods to solve a school timetabling problem. It defines the problem as scheduling classes, teachers, subjects and periods across multiple days to satisfy hard constraints like avoiding conflicts. It presents the chromosome representation as a 3D matrix and describes genetic operators like crossover and mutation. It also summarizes the RNA search method, tournament selection and the GAT4C genetic algorithm library used to find good timetable solutions.

Uploaded by

Gokulnath Pillai
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 48

Presented by,

Vijay B. Gujar.
(MT2008205)

Under the Guidance of,


Prof. S. R.
Sutar.

DEPARTMENT OF COMPUTER ENGINEERING


DR. BABASAHEB AMBEDKAR TECHNOLOGICAL UNIVERSITY
LONERE – 402103, TAL. MANGAON, DIST. RAIGAD (M.S.)
INDIA.
2011.
CONTENTS

 Introduction to Scheduling
 School Timetabling Problem
 RNA and GAT4C
 GA Library
 Conclusion
Introduction to Scheduling Problems
 Scheduling Is Difficult Problem

04/17/11
- Due to size and complexity of the search space

- Due to the precedence and resource constraints

- Some problems are not easy to define practically

- Due to existence of many constraints

3
Problem Definition
 Objective:
The objective of timetable construction program is
to construct a weekly timetable for an elementary
school.

 Description:
Problem formulation is as follows:
A weekly timetable consists of M working days. Every day
there are N timeslots. Therefore, there are M x N timeslots
4
available weekly.
Problem Definition
contd..

• During a timeslot in a school, multiple lectures can take

04/17/11
place.

• Each lecture has an associated teacher that gives


the lecture, a subject that is taught, and period
number
and day.

5
Chromosome Representation

 Timetable problem is teacher-oriented

04/17/11
representation;

 Timetable is represented as three


dimensional matrix containing in each cell (i,
j, k), the class given by the ith day at the jth
period and kth class, this representation
avoids implicitly the case of teacher giving
more than one class at a same time.

6
Constraints for Timetable Scheduling Problem
Hard Constraints:

04/17/11
 Overlaps:
Avoid the possibility of a class been taught by more than
one teacher in the same period.
 Simultaneity:
Two classes are defined as simultaneous classes if they are
taught by different teachers at the same time.

 .

 .
7
HARD CONSTRAINTS
CONTD..

04/17/11
 Consecutiveness:
This constraint checks whether a distribution of hours

for a pair teacher-class is followed. For example,

some practical lessons should be taught in two

consecutive periods of time.

8
Soft Constraints
• Overuse:

04/17/11
It refers to the number of periods per day in which a teacher gives its
lessons, over its specified maximum of periods per day.

• Underuse:

When teachers have preferences on their minimum number of periods


per day, it indicates the number of periods under such minimum.

• Holes:

We consider the number of empty periods between two consecutive


periods where a teacher assigned a class.
9
Input
In order to solve problem, following input information must be provided

- Number of working days per week ,

- Number of timeslots per day ,

- Number of Classes ,

Input For Constraints

1) Unavailability

- Teachers number ,

- Lecture number.

- Day
10
- Class

Input Data
contd..

04/17/11
 Input For Constraints

2) Consecutiveness

- Teacher id
- Day
- Class

11
Genetic Algorithm
 Direct manipulation of coding

04/17/11
 Search from a population, not a single
point

 Search via sampling, a blind search

 Searchusing stochastic operators,


not deterministic rules
12
Procedure of GA

04/17/11
13

Genetic Operators

04/17/11
 Crossover operators (Block wise)

 Mutation operators (1:1 Bitwise)

 Selection operators (Tournament)

14
RNA Search Method
 Random Nonascendent enters in a loop that navigates the part of

04/17/11
search space, stepping interactively from one solution to one of its
neighbors, called move.

 The selection of move to be performed at each step of search


depends on the cost function.

 RNA accepts the random neighbor only if it is better or equal to the


current.

15
RNA Search Method
Contd..

 RNA stop criterion is also based on fixed number

04/17/11
of iterations without improving the value of the
cost function.

 RNA also allows for sideways moves, RNA has


feature of being able to follow descending paths
that pass through plateaux.

 Search lands in plateau, it is able to move inside


plateau itself, and might get down from it through
a solution different from the one from which it is
reached the plateau.
16
RNA Search Method
Contd..
 RNA starts to work on the random timetable

04/17/11
until it makes no improvements for given
number of iterations.

 Advantages of RNA

 1) RNA represents fast method to generate a


reasonably good initial solution.

 2) RNA uses double moves that might find


improvements, That is , it “shakes up” the
solution so that it try to modify the solution. 17
RNA Search Method
Contd..

 Following the RNA local search technique, we have

04/17/11
developed an algorithm.

 Starting from an initial solution, iteratively move


from a solution to another doing double- moves.
These are repeated until they make no
improvements during a given number of iterations.
 It keeps track of current best solution (sb) at each
stage, and by applying those moves generates a
new solution si, trying to improve the value of
Fc (si) ≤ Fc (sb), si becomes the new best solution.

18
Tournament Selection
 Tournament selection runs a tournament among

04/17/11
a few individuals chosen at random from the
population and selects the winner (the one with
the best fitness). Selection pressure can be
easily adjusted by changing the tournament
size. If the tournament size is larger, weak
individuals have a smaller chance to be
selected.

 Truncation selection is also a deterministic


procedure that ranks all individuals according to
their fitness and selects the best as parents.
19
Tournament Selection and
GAT4C
 Starting with population randomly generated,

04/17/11
two pairs of individuals are selected and then the
best candidate of each one is chosen, according
to its fitness value.

 In this way, the parents of next generation are


obtained.

 New children result from applying the defined


crossover operator and they will mutate at given
probability before being inserted into the
population. 20
Tournament Selection and GAT4C
contd…

04/17/11
 The process is then repeated, updating the best
solution found among the individuals up to now,
and it stops when a certain number of cycles is
completed.

 Some individuals can be selected as parents


more than once.

21
Four Children Tournament
(GAT4C)

04/17/11
 The main difference with the previous algorithm
is that once two individuals are chosen to form a
pair other are discarded, so they will be never
be chosen again.

 Hence size of population must be multiple of


four and also four children must be created in
each
22
iteration.
Application of RNA & GAT4C

 RNA – Gives Performance

04/17/11
1) Crossover and flip mutations –
No. of Children generated fast and large
2) Get Neighbors best pair
3) Random Selection

 Tournament Selection (GAT4C)


– Gives Best Child and Accuracy

23
Optimizing Timetable Schedules by a
Hybrid Genetic Algorithms

04/17/11

Problem Definition and Constraints
 Mutation (Flip Mutation)

 Fitness Function (Objective Function)

24
The School Timetable Scheduling Problem
by Hybrid Genetic Algorithm Contd….

04/17/11
 Genetic operators

 The filtering algorithm (RNA)

 Objective function (Check soft and Hard Constraints)

25
Hybrid Algorithm
 RNA and GAT4C

04/17/11
 In this approach, Tournament is alternated
with RNA until a certain number of iterations is
reached.
 First, Tournament phase is performed. It is
followed by RNA phase which starts taking the
best individual found among all generations as
the initial solution. 26
Hybrid Algorithm
contd…

04/17/11
 After finishing the RNA stage, new population of n
individuals must be created as the input to new
genetic phase.

 To do this, during the RNA phase a list with the n best


timetables is kept.

27
Hybrid Algorithm
contd…

04/17/11
 Therefore we guarantee that the best candidate
known up to now are always included at the
beginning of every tournament phase, and
consequently the best genetic material.

 Use of four children, tournament phase instead


of two.

28
GA Library
 There are three things you must do to solve a

04/17/11
problem using a genetic algorithm:

1. Define a representation
2. Define the genetic operators
3. Define the objective function

 The second is a 'steady-state genetic algorithm'


that uses overlapping populations. In this
variation, you can specify how much of the
population should be replaced in each
generation. 29
GASteadyStateGA
 It uses overlapping populations with a user-

04/17/11
specifiable amount of overlap. The algorithm
creates a population of individuals by cloning
the genome or population that you pass when
you create it. Each generation the algorithm
creates a

temporary population of individuals, adds


these to the previous population, then
removes the worst individuals in order to
30
return the population to its original size.
The Genome Operators

 Each genome has three primary operators:

04/17/11
initialization, mutation, and crossover.

 The initialization operator determines how the


genome is initialized. It is called when you
initialize a population or the genetic algorithm.
This operator does not actually create new
genomes, rather it 'stuffs‘ the genomes with the
primordial genetic material from which all
31
solutions will evolve.
The Genome Operators
contd…
 The mutation operator defines the procedure for
mutating each genome.

04/17/11
 Mutation means different things for different data
types.

 Mutation should be able to introduce new genetic


material as well as modify existing material.

 The crossover operator defines the procedure for


generating a child from two parent genomes. Like
the mutation operator, crossover is specific to the
data type. Unlike mutation, however, crossover 32
involves multiple genomes.
Objective Function

 The objective function is used to evaluate the

04/17/11
genome. The comparator (often referred to as a
'distance function') is used to determine how
different one genome is from another. Every
genetic algorithm requires that an objective
function is defined - this is how the genetic
algorithm determines which individuals are
better than others. Some genetic algorithms
require a comparator. 33
Objective Functions and Fitness Scaling

 Genetic algorithms are often more attractive

04/17/11
than gradient search methods because they do
not require complicated differential equations
or a smooth search space. The genetic
algorithm needs only a single measure of how
good a single individual is compared to the
other individuals. The objective function
provides this measure; given a single solution
to a problem, how good is it?

 The genetic algorithm uses the fitness scores,


not the objective scores, to do selection.
34
Objective Functions and Fitness Scaling
contd..

 When you write an objective function, you

04/17/11
must first cast the generic genome into the
type of genome that your objective function
is expecting. From that point on you can
work with the specific genome type. Each
objective function returns a single value that
represents the objective score of the genome
that was passed to the objective function
35
Member function descriptions
 ga.nGenerations(gen); // no. of generations

04/17/11
 ga.pMutation(0.001); // probability of mutation
 ga.pCrossover(0.9); // probability of crossover
 ga.scoreFilename("bog.dat"); // name of file for scores

 ga.scoreFrequency(10); // keep the scores of every 10th


generation

 ga.flushFrequency(50); // specify how often to write the score to


disk

 ga.selectScores(GAStatistics::AllScores);
 ga.evolve(); // Initialization

36
Member function descriptions
 evolve-Initialize the genetic algorithm then
evolve it until the termination criteria have been

04/17/11
satisfied. This function first calls initialize then
calls the step member function until the done
member function returns gaTrue. It calls the
flushScores member as needed when the
evolution is complete. You may pass a seed to
evolve if you want to specify your own random
seed.

 flushFrequency-Use this member function to


specify how often the scores should be flushed to
disk. A value of 0 means do not write to disk. A
value of 100 means to flush the scores every 100 37
generations.
Member function descriptions
 flushScores-Force the genetic algorithm to

04/17/11
flush its generational data to disk. If you
have specified a flushFrequency of 0 or
specified a coreFilename of nil then calling
this function has no effect.

 generation-Returns the current generation.

 initialize-Initialize the genetic algorithm. If


you specify a seed, this function calls
GARandomSeed with that value.

38
Member function descriptions
 pCrossover-Set/Get the crossover

04/17/11
probability.

 pMutation-Set/Get the mutation probability.

 Population-Set/Get the population. Returns


a reference to the current population.

 populationSize-Set/Get the population size.


This can be changed during the course of an
evolution.
39
Member function descriptions

 pReplacement- Specify a percentage of the

04/17/11
population to replace each generation.

 scoreFilename - Specify the name of the


file to which the scores should be recorded.

 scoreFrequency -Specify how often the


generational scores should be recorded. You
can record mean, max, min, stddev, and
diversity for every n generations

40
Member function descriptions

04/17/11
 You can select the amount of overlap between
generations by specifying the pReplacement
parameter.

 This is the percentage of the population that


should be replaced each generation. Newly
generated offspring are added to the
population, then the worst individuals are
41
destroyed
GA3DBinaryStringGenome

 The binary string genome is derived from the

04/17/11
GABinaryString and GAGenome classes. It is a
threedimensional block of 1s and 0s whose
width, height, and depth can be fixed or
variable. The genes in this genomes are bits.
The alleles for each bit are 0 and 1.

 default genetic operators for this class


 Initialization : GA3DBinaryStringGenome::UniformInitializer
 Comparison : GA3DBinaryStringGenome::BitComparator
 Mutation : GA3DBinaryStringGenome::FlipMutator
 Crossover : GA3DBinaryStringGenome::OnePointCrossover

42
Termination Function
 ga.nGenerations() :

04/17/11
 The termination function determines when the
genetic algorithm should stop evolving. It takes
a genetic algorithm as its argument and
returns gaTrue if the genetic algorithm should
stop or gaFalse if the algorithm should continue.

 Compares the current generation to the desired


number of generations. If the current generation
is less than the desired number of generations, it
returns gaFalse to signify that the GA is not yet
complete.
43
CONCLUSION
 We have developed solution for the secondary school

04/17/11
timetabling problem.

 They are based on RNA and GA based algorithm. We


created hybrid version.

 In large scenario elitist hybrid solution (GAT & RNA) is


the best.

44
REFERENCES
[1] A. Abramson,. “Constructing school timetables using simulated

04/17/11
annealing:sequential and parallel algorithms”, Management Science , 1991,37,
98-113.
[2] Alberto Colorni, Marco Dorigo, ”Metaheuristics For Highschool Timetabling”, To
Appear In Computational Optimization And Applications Journal, 1997.
[3] A. Bertoni, M.dorigo, “Implicit parallelism in genetic algorithms”, to appear in
Artificial Intelligence, 1993.
[4] L Booker, D.E.Goldberg ,J.H.Holland, “Classifier systems and genetic algorithms.
Artificial Intelligence”, 40, 235-282.
[5] Nedim Šrndic , Emir Pandžo , Mirza Derviševic, Samim Konjicija, “The Application
of a Parallel genetic Algorithm to Timetabling of Elementary School Classes A
Coarse Grained Approach”.
[6] M.W. Carter, “A survey of practical applications of examination timetabling
algorithms”, Operations Research ,1986.,34, 193-202.
[7]N. Chalhal and DE Werra, “An interactive system for constructing timetables on a
PC”, European Journal of Operational Research ,1989,40.
[8.] A. Colorni, M. Dorgio and V. Maniezzo,. “A Genetic algorithm to solve timetable
problem” ,1992, 60, 5-31, (in Italian).
45
REFERENCES CONTD…
[9.] J. Csima and C.C. Gotlieb, Tests on a computer method for construction of school
timetables, Communications of the ACM 7, 1961.,160-163.

[10] L. Davis and F. Ritter, “Schedule optimization with probabilistic search”,


Proceedings of the Third IEEE Conference on Artificial Intelligence Applications,
1987.

[11] Tarek A. El-Mihoub, Adrian A. Hopgood, Lars Nolle, Alan Battersby, “Hybrid
Genetic Algorithms: A Review”, Engineering Letters, 13:2, EL_13_2_11,
Advance online publication, 4 August 2006.
FUTURE WORK

 Focus in the generation of better initial solutions.

 Greedy procedures can be used to create initial


timetables to avoid infeasibility.

 More intelligent moves may skip bad quality


timetables during the search process.

You might also like