Introduction To Genetic Algorithms
Introduction To Genetic Algorithms
Algorithms (GAs)
Mithun.k
2
Unveiling the History of
Genetic Algorithm
4
History continue…
1)Genetic Algorithm
Representation - fixed-length bit string
0111011011011
the string is “evaluated as a collection of structural features
of a solution that have little or no interactions”.
||
“Gene represents an entity that is structurally independent
of other genes”.
6
History continue…
Reproduction :
* Cross over
* Mutation
* Inversion
7
History continue…
2)Genetic Programming
Representation - variable-sized tree of functions and values
entire tree corresponds to a single function that may be
evaluated.
Reproduction :
* Cross over
* Mutation
* Inversion
8
History continue…
3)Evolutionary Strategies
Representation - fixed-length real-valued vector.
Reproduction
o Gaussian Mutation
o Intermediate Recombination
9
History continue…
4)Evolutionary Programming
Representing individuals’ phenotypically.
Applied in finite state machines capable of responding to
environmental stimuli and developing operators for
effecting structural and behavioral change over time.
any type of computing tool could be evolved in some way
using the GA principles
Reproduction – Mutation
No exchange of materials between individuals in population
Why Genetic Algorithm…?
Conventional methods selecting only one individual at a
time which make them to be in a danger of trapped in a
local minima or maxima.
10
What Are Genetic Algorithms (GAs)?
11
Darwin’s Principle Of Natural Selection
IF there are organisms that reproduce, and
IF offspring's inherit traits from their progenitors, and
IF there is variability of traits, and
IF the environment cannot support all members of a growing
population,
THEN those members of the population with less-adaptive
traits will die out & those members
with more-adaptive traits will survive.
The result is the evolution of species.
12
An Example of Natural Selection
Giraffes have long necks.
Giraffes with slightly longer necks could feed on leaves of higher branches
when all lower ones had been eaten off.
13
An Example of Natural Selection continue…
14
Evolution Through Natural Selection
Millions Of Years
Evolved Species
(Favorable Characteristic Now A Trait Of Species)
15
Nature to Computer Mapping
Nature Computer
16
Flowchart of Genetic Algorithm
17
Flowchart Explanation
Step 1: Create a Random Initial Population
An initial population is created from a random selection of solutions
These solutions have been seen as represented by chromosomes as in
living organisms
A chromosome is a packet of genetic information organized in a
standard way that defines completely and individual (solution).
The genetic structure (way in which that information is packed and
defined) enables the solutions to be manipulated.
The genetic operands (way in which that information can be
manipulated) enables the solutions to reproduces and evolve
18
Flowchart Explanation continue…
19
Flowchart Explanation continue…
20
Flowchart Explanation continue…
If the population in the last generation contains a solution that produces an
output that is close enough or equal to the desired answer then the problem
has been solved.
This is the ideal termination criterion of the evolution
If this is not the case, then the new generation will go through the same
process as their parents did, and the evolution will continue
A termination criterion that always must be included is Time-Out
Since one drawback of Evolutionary Programming is that is very difficult
(impossible most of the time) to know if the ideal termination criterion is
going to be satisfied, or when.
21
GA Operators and Terminologies
22
23
1) Encoding
2) Fitness function
3) Selection
4) Recombination
Crossover
Mutation
1) Encoding
The process of representing the solution in the form of
a string that conveys the necessary information.
Binary Encoding
Octal Encoding
Hexadecimal Encoding
Permutation Encoding
Value Encoding
24
24
Encoding Methods
Chromosome A 10110010110011100101
Chromosome B 11111110000000011111
25
Encoding Methods continue…
Chromosome A 1 5 3 2 6 4 7 9 8
Chromosome B 8 5 6 7 2 3 1 4 9
26
Encoding Methods continue…
27
2) Fitness Function
28
3)Selection
The higher the fitness value, the more chance an individual has
to be selected ,which will increase the convergence rate of GA.
Basic Types
a)Proportionate based :- based on fitness criteria
b)Ordinal based :- based on ranking within the population
29
Selection methods
30
a)Roulette Wheel Selection 31
Strings that are fitter are assigned a larger slot and hence have
a better chance of appearing in the new population.
31
Example Of Roulette Wheel Selection
3 01000 64 5.5
32
Roulette Wheel For Example
33
b)Rank Selection
If the best chromosome fitness is 90%, its
circumference occupies 90% of Roulette wheel, and
then other chromosomes have too few chances to be
selected.
7993 4 1 3 2 5 6
4 1 3 2 5 6 8142
8479
6 3 4 5 2 1
2 6 3 4 5 1
8142
6872 2 6 3 4 5 1
4 3 2 1 5 6 6872
8479 4 3 2 1 5 6 8673
6 3 4 5 2 1
8142 5 2 6 4 3 1
2 6 3 4 5 1 8142
2 6 3 4 5 1
36
d) Elitism
Elitism is a method which copies the best
chromosome to the new offspring population
before crossover and mutation.
37
4)Recombination
Types
a) Crossover
b) Mutation
38
a) Crossover - Recombination
Two strings are picked from the mating pool at random to cross
over.
39
Crossover Methods - Recombination
40
Crossover methods- Recombination
41
Crossover methods- Recombination
42
Crossover methods- Recombination
43
b) Mutation - Recombination
44
b)Mutation - Recombination continue…
Flipping :-
Interchanging : -
Reversing : -
45
Example 1
46
GA to solve max< > continue…
47
GA to solve max< > continue…
48
GA to solve max< > continue…
The actual count of string no 1 is 1, hence it occurs once in the mating pool. The
actual count of string no 2 is 2, hence it occurs twice in the mating pool. Since the
actual count of string no 3 is 0, it does not occur in the mating pool. Similarly, the
actual count of string no 4 being 1, it occurs once in the mating pool.
Mutation is performed
50
Example 2
51
The Problem
The goal is to find the shortest circular tour, visiting every city
exactly once, so as to minimize the total travel cost, which
includes the cost of traveling from the last city back to the first
city’.
Mumbai 1
Cochin 2
Calcutta 3
Delhi 4
Bangalore 5
Chennai 6
53
TSP Encoding continue…
54
Fitness Function
The fitness function will be the total cost of the tour
represented by each chromosome.
55
Distance/Cost Matrix For TSP
1 2 3 4 5 6
56
Fitness Function continue…
57
Selection Operator
Two other solutions are picked again and another slot in the
mating pool is filled up with the better solution.
58
Tournament Selection continue…
Mating Pool
7993
6872
4 1 3 2 5 6
6872
4 3 2 1 5 6
8971
4 3 2 1 5 6 8673 3 6 4 1 2 5
5 2 6 4 3 1 8673
5 2 6 4 3 1
8971
3 6 4 1 2 5 7993
7993 4 1 3 2 5 6
4 1 3 2 5 6 8142
8479
6 3 4 5 2 1
2 6 3 4 5 1
8142
6872 2 6 3 4 5 1
4 3 2 1 5 6 6872
8479 4 3 2 1 5 6 8673
6 3 4 5 2 1
8142 5 2 6 4 3 1
2 6 3 4 5 1 8142
2 6 3 4 5 1
59
Why we cannot use single-point crossover ?
4 1 3 2 5 6 4 1 3 1 5 6
4 3 2 1 5 6 4 3 2 2 5 6
60
Crossover Operator
61
Edge Table
The Edge Table is an adjacency table that lists links into and out
of a city found in the two parent sequences.
62
Finding The Edge Table
Parent 1 4 1 3 2 5 6
Parent 2 4 3 2 1 5 6
1 4 3 2 5
2 -3 5 1
3 1 -2 4
4 -6 1 3
5 1 2 -6
6 -5 -4
63
Enhanced Edge Recombination Algorithm
1. Choose the initial city from one of the two parent tours.
2. Remove all occurrences of the current city from the left hand side of the
edge table.( These can be found by referring to the edge-list for the current
city).
4. Determine which of the cities in the edge-list of the current city has the
fewest entries in it's own edge-list. The city with fewest entries becomes the
current city. In case a negative integer is present, it is given preference. Ties
are broken randomly. Go to step 2.
Step 1 Step 2
1 4 3 2 5
1 3 2 5
2 -3 5 1
2 -3 5 1
3 1 -2 4
3 1 -2
4 -6 1 3
4 -6 1 3
5 3 2 -6
5 3 2 -6
6 -5 -4
6 -5
4 4 6
65
Enhanced Edge Recombination Algorithm
continue…
Step 3 Step 4
1 3 2 5 1 3 2
2 -3 5 1
2 -3 1
3 1 -2
3 1 -2
4 1 3
4 1 3
5 3 2
5 3 2
6 -5 6
4 6 5 4 6 5 1
66
Enhanced Edge Recombination Algorithm
continue…
Step 5 Step 6
1 3 2 1 2
2 -3 2
3 -2
3 -2
4 3 4
5 3 2 5 2
6 6
4 6 5 1 3 2
4 6 5 1 3
67
Mutation Operator
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
68
Classification of Genetic
Algorithm
69
Classification of Genetic Algorithm
70
1) Simple Genetic Algorithm (SGA)
71
2)Parallel and Distributed Genetic Algorithm (PGA and DGA)
72
2)Parallel and Distributed Genetic Algorithm (PGA and DGA) continue…
Master-Slave Parallelization:-
73
2)Parallel and Distributed Genetic Algorithm (PGA and DGA) continue…
74
2)Parallel and Distributed Genetic Algorithm (PGA and DGA) continue…
75
3)Adaptive Genetic Algorithm (AGA)
76
Advantages of GA
Parallelism
Solution space is wider.
Easy to discover global optimum
Only uses function evaluations.
Handles noisy functions well.
Handles large, poorly understood search spaces easily
They require no knowledge or gradient information about the
response surface
Discontinuities present on the response surface have little
effect on overall optimization performance
They are resistant to becoming trapped in local optima
77
Limitations
The problem of identifying fitness function
The problem of choosing the various parameters like the size
of the population, mutation rate, cross over rate, the selection
method and its strength.
Cannot easily incorporate problem specific information
Not good at identifying local optima
No effective terminator.
Not effective for smooth unimodal functions
Needs to be coupled with a local search technique.
Require large number of response (fitness) function evaluations
78
Applications
Time series forecasting.
Robot trajectory planning
Image Processing
Design–semiconductor layout, aircraft design, keyboard
configuration, communication networks
Scheduling–manufacturing, facility scheduling, resource allocation
Machine Learning–Designing neural networks, both architecture
and weights, improving classification algorithms, classifier systems
Signal Processing–filter design
Combinatorial Optimization–set covering, traveling salesman
(TSP), Sequence scheduling, routing, bin packing, graph coloring
and partitioning
79
Conclusion
80
References
81
Thank You