Documente Academic
Documente Profesional
Documente Cultură
Presented by:
Gaurav Khandelwal
08BCE131
Overview
• General introduction to Genetic Algorithms (GA’s)
• Biological background
• Cell
• Chromosomes
• Origin of species
• Natural selection
• Genetic Algorithm
• Search space
• Basic algorithm
• Coding
• Examples
General Introduction to GA’s
mutation
Biological background(Natural-selection)
• The origin of species: “Preservation of favourable
variations and rejection of unfavourable variations.”
• There are more individuals born than can survive, so
there is a continuous struggle for life.
• Individuals with an advantage have a greater chance for
survive: survival of the fittest.
• Important aspects in natural selection are:
• adaptation to the environment
• isolation of populations in different groups which cannot
mutually mate
•
Genetic Algorithms
Genetics + Algorithm = Genetic Algorithm
•
2 NEW POPULATION
generation
4 TEST : Test problem criterium
5 LOOP : Continue step 1 – 4 until criterium is satisfied
Genetic Algorithm-Coding
• Chromosomes are encoded by bitstrings
• Every bitstring therefore is a solution but not necisseraly
the best solution
• The way bitstrings can code differs from problem to
problem
0
1
0
1
1
Genetic Algorithm-Coding
Recombination (cross-over) can when using bitstrings
schematically be represented:
1 0
1 0
0 1 0 1
0 0 0 0
1 1 1 1
X 1
1 1 1
0 1 1 0
1 0 0 1
0 0
1 0
0 0
1 1
0 0
1 1
Genetic Algorithm-Coding
• Both recombination and mutation depend a lot on the
exact definition of the problem and the choice of
representing the chromosomes (e.g. no bitstrings)
• Different encodings can be used:
• Binary encoding
• Permutation encoding
• Value encoding
• Tree encoding
• Focus in this presentation stays with binary encoding
Example
We require small finger and long feet.
Gene are encoded as first two gene represent finger
characteristic and other two represent feet characteristic.
We have population size four.
Here 0 represent small and 1 represent long
Ideal gene:
•
0 0 1 1
0 1 0 0 1 0 0 0
A B
0 1 0 1 0 0 1 0
C D
Example
Now fitness:
Name Fitness
A 1
B 1
C 2
D 3
We apply crossover and mutation for optimum
sol.
•
Example
Crossover:
•
Representation
Representation is an ordered list of city numbers known as an
order-based GA.
• 1) London 3) Dunedin 5) Beijing 7) Tokyo
• 2) Venice 4) Singapore 6) Phoenix 8) Victoria
• CityList1 (3 5 7 2 1 6 4 8)
• CityList2 (2 5 7 6 8 1 3 4)
•
Example(Travel salesman problem)
•
•
Crossover
•Crossover combines inversion and recombination:
• Parent1 (1 2 3 4 5 6 7 8 9)
• Parent2 (9 3 7 8 2 6 5 1 4)
•
• Child (9 3 2 4 5 6 7 1 8)
•
•
Example(Travel salesman problem)
Mutation
Mutation involves reordering of the list:
•
* *
• Before: (9 3 2 4 5 6 7 1 8)
•
• After: (9 3 2 7 5 6 4 1 8)
TSP Example: 30 cities
120
100
80
y 60
40
20
0
0 10 20 30 40 50 60 70 80 90 100
x
TSP Example: 30 cities
Solution (Distance = 941)
120
100
80
y
60
40
20
0
0 10 20 30 40 50 60 70 80 90 100
x
TSP Example: 30 cities
Solution (Distance = 652)
TSP30 (Performance = 652)
120
100
80
y 60
40
20
0
0 10 20 30 40 50 60 70 80 90 100
x
TSP Example: 30 cities
Best solution(Distance = 420)
120
100
80
y 60
40
20
0
0 10 20 30 40 50 60 70 80 90 100
x
Advantages of Genetic algorithms
Concept is easy to understand
•