Professional Documents
Culture Documents
02
Semester 2 - 2008/2009
1
Genetic Algorithms
By
Advanced Algorithms
Overview
March 18 - 2009
Semester 2 - 2008/2009
2
Semester 2 - 2008/2009
3
Introduction To Genetic
Algorithms (GAs)
March 18 - 2009
Semester 2 - 2008/2009
9
Genetic Algorithms
Implementation
March 18 - 2009
Main GA algorithm
March 18 - 2009
Begin
Initialize
population
Evaluate
Solutions
T =0
Optimum N
Solution?
Selection
Y
T=T+1 Crossover
Stop
Mutation
March 18 - 2009
Nature Computer
Semester 2 - 2008/2009
14
Encoding
Semester 2 - 2008/2009
15
Fitness Function
Semester 2 - 2008/2009
16
Recombination
Semester 2 - 2008/2009
17
Strings that are fitter are assigned a larger slot and hence have
a better chance of appearing in the new population.
March 18 - 2009
3 01000 64 5.5
Crossover
Semester 2 - 2008/2009
22
• Two strings are picked from the mating pool at random to cross
over.
Crossover Methods
Semester 2 - 2008/2009
23
Mutation
Semester 2 - 2008/2009
28
Example Of Mutation
Semester 2 - 2008/2009
29
Advantages Of GAs
Semester 2 - 2008/2009
30
Semester 2 - 2008/2009
34
The Problem
Semester 2 - 2008/2009
35
Encoding
Semester 2 - 2008/2009
36
• We represent every city with an integer .
Amman 1
Irbid 2
Al-Mafraq 3
Al-Salt 4
Aqabah 5
Al-Karak 6
March 18 - 2009
Encoding (contd.)
Semester 2 - 2008/2009
37
Selection Operator
Semester 2 - 2008/2009
41
Tournament Selection.
Two other solutions are picked again and another slot in the
mating pool is filled up with the better solution.
March 18 - 2009
4 1 3 2 5 6 4 1 3 1 5 6
4 3 2 1 5 6 4 3 2 2 5 6
March 18 - 2009
Order 1 crossover
Semester 2 - 2008/2009
43
Mutation Operator
Semester 2 - 2008/2009
45
• The mutation operator induces a change in the solution, so as
to maintain diversity in the population and prevent Premature
Convergence.
• In our project, we mutate the string by randomly selecting any
two cities and interchanging their positions in the solution, thus
giving rise to a new tour.
4 1 3 2 5 6
4 5 3 2 1 6
March 18 - 2009
P1 2 1 |3 4 5|6
P3 1 4 |3 2 6|5
S1 2 6 |3 4 5|1 5 1 4 3 2 6 (Order 1)
S2 4 5 |3 2 6|1 6 2 1 3 4 5 (Order 1)
March 18 - 2009
P1 2 1 |3 4 5|6
P3 1 4 |3 2 6|5
S1 2 6 |3 4 5|1 1 2 6 (Order 1)
S2 4 5 |3 2 6|1 1 4 5 (Order 1)
March 18 - 2009
Semester 2 - 2008/2009
50
8-queens Problem
March 18 - 2009
8-queens
Semester 2 - 2008/2009
51
• How to represent the 8-queens problem in GA?
• Remember an individual is a potential solution.
• In the 8-queens problem, it will be a state with 8-queens on the board.
• One way is to specify the position of the 8 queens, each in a column of 8
squares.
• Four random numbers are then drawn for the next generation.
Suppose we have the following random numbers:
0.4012
0.1486
0.5973
0.8129
• The following individuals will be chosen:
0.4012 v2 (32752411) v1'
0.1486 v1 (24748552) v2'
0.5973 v2 (32752411) v3'
0.8129 v3 (24415124) v4'
March 18 - 2009
Semester 2 - 2008/2009
61
v2 '
v1'
v1'' v2''
March 18 - 2009
8-queens: A Summary
Semester 2 - 2008/2009
65
March 18 - 2009
Semester 2 - 2008/2009
66
Summary
March 18 - 2009
Summary
Semester 2 - 2008/2009
67
References
Semester 2 - 2008/2009
68
References (contd.)
Semester 2 - 2008/2009
69
WEBSITES
6.www.iitk.ac.in/kangal
7.www.math.princeton.edu
8.www.genetic-programming.com
9.www.garage.cse.msu.edu
10.www.aic.nre.navy.mie/galist
March 18 - 2009
Semester 2 - 2008/2009
70
Questions ?