genetic algorithm
DESCRIPTION
this presentation is on genetic algorithm that covers some biological background then it covers algorithm. this also explains travel salesman problem.TRANSCRIPT
Presented by:Gaurav Khandelwal08BCE131
Genetic Algorithm
• General introduction to Genetic Algorithms (GA’s)
• Biological background
• Cell
• Chromosomes
• Origin of species
• Natural selection
• Genetic Algorithm
• Search space
• Basic algorithm
• Coding
• Examples
Overview
• Genetic algorithms (GA’s) are technique to solve problems which need optimization
• GA’s are a subclass of Evolutionary Computing
• GA’s are based on Darwin’s theory of evolution
• History of GA’s• Evolutionary computing evolved in the 1960’s.
• GA’s were created by John Holland in the mid-70’s.
General Introduction to GA’s
• Every animal cell is a complex of many small “factories” working together
• The center of this all is the cell nucleus
• The nucleus contains the genetic information
Biological Background(Cell)
• Genetic information is stored in the chromosomes
• Each chromosome is build of DNA
• Chromosomes in humans form pairs
• There are 23 pairs
• The chromosome is divided in parts: genes
• Genes code for properties
• The posibilities of the genes for one property is called: allele
• Every gene has an unique position on the chromosome: locus
Biological Background(Chromosomes)
• The entire combination of genes is called genotype
• A genotype develops to a phenotype
• Alleles can be either dominant or recessive
• Dominant alleles will always express from the genotype to the fenotype
• Recessive alleles can survive in the population for many generations, without being expressed.
Biological Background(Genetics)
• Reproduction of genetical information
• Mitosis
• Meiosis
• Mitosis is copying the same genetic information to new offspring: there is no exchange of information
• Meiosis is the basis of the sexual reproduction
• During reproduction “errors ” occur
• Due to these “errors” genetic variation exists
• Most important “errors” are:Recombination(cross-over)
mutation
Biological Background(Reproduction)
• 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
Biological background(Natural-selection)
Genetics + Algorithm = Genetic Algorithm
Genetic Algorithm is robust and probabilistic search algorithm based on the mechanics of natural selection and genetics
Genetic Algorithm follows the principle of “Survival of the Fittest” laid down by Charles Darwin
Random search method
Genetic Algorithms
• Most often one is looking for the best solution in a specific subset of solutions
• This subset is called the search space (or state space)
• Every point in the search space is a possible solution
• Therefore every point has a fitness value, depending on the problem definition
• GA’s are used to search the search space for the bestsolution, e.g. a minimum
Genetic Algorithm-Search space
• Starting with a subset of n randomly chosen solutions from the search space (i.e. chromosomes). This is the population
• This population is used to produce a next generation of individuals by reproduction
• Individuals with a higher fitness have more chance to reproduce (i.e. natural selection)
Genetic algorithm-Basic algorithm
START : Create random population of n chromosomes
1 FITNESS : Evaluate fitness f(x) of each chromosome in the population
2 NEW POPULATION
0 SELECTION : Based on f(x)
1 RECOMBINATION : Cross-over chromosomes
2 MUTATION : Mutate chromosomes
3 ACCEPTATION : Reject or accept new one
3 REPLACE : Replace old with new population: the new
generation
4 TEST : Test problem criterium
5 LOOP : Continue step 1 – 4 until criterium is satisfied
Genetic Algorithm-Basis algorithm
• Outline of basis algorithm
• 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
Genetic Algorithm-Coding
0
1
0
1
1
Recombination (cross-over) can when using bitstrings schematically be represented:
Using a specific cross-over point
Genetic Algorithm-Coding
1
0
0
1
1
0
1
0
1
0
1
1
1
0
X
1
0
0
1
1
1
0
0
1
0
1
1
0
1
• Mutation prevents the algorithm to be trapped in a local minimum
• In the bitstring approach mutation is simpy the flipping of one of the bits
Genetic Algorithm-Coding
0
1
0
1
0
1
0
0
0
1
0
1
• 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
Genetic Algorithm-Coding
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 longIdeal gene:
Example
0 0 1 1
1 0 0 00 1 0 0
0 1 0 1 0 0 1 0
A B
C D
Now fitness:
We apply crossover and mutation for optimum sol.
Example
Name Fitness
A 1
B 1
C 2
D 3
Crossover:
Example
Name Received gene
Genome Fitness
A’ A(0,1)+D(1,0)
A’(0,1,1,0) 2
B’ B(1,0)+D(1,0)
B’(1,0,1,0) 2
C’ D(0,0)+C(0,1)
C’(0,0,0,1) 3
D’ D D’(0,0,1,0) 3
Mutation:
Example
Name Gene Genome Fitness
A’ A’(0,1,1,0) A’’(0,0,1,0) 3
B’ B’(1,0,1,0) B’’(1,0,1,1) 3
C’ C’(0,0,0,1) C’’(0,0,1,1) 4
D’ D’(0,0,1,0) D’’(0,0,1,0) 3
Find a tour of a given set of cities so that • each city is visited only once• the total distance traveled is minimized
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)
Representation
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)
This operator is called the partial crossover.
Example(Travel salesman problem)
Crossover
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)
Example(Travel salesman problem)
Mutation
0
20
40
60
80
100
120
0 10 20 30 40 50 60 70 80 90 100
y
x
TSP Example: 30 cities
TSP Example: 30 cities Solution (Distance = 941)
0
20
40
60
80
100
120
0 10 20 30 40 50 60 70 80 90 100
y
x
TSP30 (Performance = 941)
0
20
40
60
80
100
120
0 10 20 30 40 50 60 70 80 90 100
y
x
TSP30 (Performance = 652)
TSP Example: 30 citiesSolution (Distance = 652)
0
20
40
60
80
100
120
0 10 20 30 40 50 60 70 80 90 100
y
x
TSP30 Solution (Performance = 420)
TSP Example: 30 citiesBest solution(Distance = 420)
Concept is easy to understand
Supports multi-objective optimization
Good for “noisy” environments
Answer gets better with time
Inherently parallel; easily distributed
Advantages of Genetic algorithms
Genetic algorithm applications in controls which are
performed in real time are limited because of random
solutions and convergence.
Certain optimisation problems (they are called variant
problems) cannot be solved by means of genetic algorithms. This occurs due to poorly known fitness functions
Disadvantage of Genetic algorithm
Management ApplicationsSchedulingControl VLSI DesignIdentification & Pattern recognition
Application of GA
Thank you