13
Genetic Algorithms
Presentation By:
Divya Rani R,
Fazeelath Naziya
Presentation Outline 13
1. Introduction
2. History
3. Search Techniques
4. Basic concepts
5. Biological Background
6. Search Space
7. Fitness Function
8. Simple Genetic Algorithm
9. Encoding
– GA Operators
– Reproduction
– Crossover
– Mutation
– Parameters of GA
– Example Benefits
– Applications
– Conclusion
– Bibliography
–
Introduction
Introduction 13
Computerized search and optimization algorithms based on
Darwin’s Principle of Natural Selection
Part of Evolutionary Algorithms
Basic concept - to simulate processes in natural system
necessary for evolution
Structural Engineering Problems, Biology, Computer
Science, Image processing and Pattern Recognition,
physical science, social sciences and Neural Networks
Provide efficient, effective techniques for optimization
History 13
Evolutionary Computing – 1960 by Rechenberg
Developed by John Holland, University of Michigan -
1970
Got popular in the late 1980’s
Based on ideas from Darwinian Evolution theory
“Survival of the fittest”
1986 – Optimization of a Ten Member Plane
13
Search Techniques
Searchtechniques
Calculus-basedtechniques Guidedrandomsearchtechniques Enumerativetechniques
Directmethods Indirectmethods Evolutionaryalgorithms Simulatedannealing Dynamicprogramming
Finonacci Newton Evolutionarystrategies Geneticalgorithms
Parallel Sequential
Centralized Distributed Steady-state Generational
13
Basic Concepts
GA converts design space into genetic space
Works with a coding variables
Traditional optimization techniques are deterministic in
nature, but GA uses randomized operators
Three important aspects:
1. Definition of objective function
2. Definition and implementation of genetic representation
3. Definition and implementation of genetic operators
Biological Background 13
Biological Background
Each cell of a living organisms contains chromosomes - strings
of DNA
Each chromosome contains a set of genes - blocks of DNA
A collection of genes – genotype
A collection of aspects (like eye colour) – phenotype
Reproduction involves recombination of genes from parents
The fitness of an organism is how much it can reproduce
before it dies
Genetic operators
Search Space 13
The space for all possible feasible solutions
Each feasible solution can be "marked" by its value of the
fitness of the problem
GA is started with a set of solutions called populations
Used to form a new population
More suitable, more chances to select
This is repeated until best population is obtained
13
Fitness Function
Particular solution may be ranked against all
Measures the quality of the represented solution
It is always problem dependent
The fitness of a solution is measured, how best it
gives the result
For instance, Knapsack problem
Fitness Function = Total value of the things in the
knapsack
13
Simple Genetic Algorithm
Step 1: Encoding of the problem in a binary string
Step 2: Random generation of a population
Step 3: Calculate fitness of each solution
Step 4: Select pairs of parent strings based on fitness
Step 5: Generate new string with crossover and mutation until a
new population has been produced
Repeat step 2 to 5 until satisfying solution is obtained
Encoding 13
The process of representing the solution in the form of a string
Binary Encoding – Every chromosome is a string of bits, 0 or 1
Chromosome A 101101100011
Chromosome B 010011001100
Ex: Knapsack Problem
Encoding: Each bit specifies if the thing is in knapsack or not
Contd..
13
Permutation Encoding – Every chromosome is a string of
numbers, which represents the number in the sequence. Used
in ordering problems.
Ex: Traveling Sales Person Problem
Encoding: Chromosome represents the order of cities, in which
the salesman will visit them
Chromosome A 1 5 3 2 6 4 7 9 8
Chromosome B 8 5 6 7 2 3 1 4 9
Contd..
13
Value Encoding – Every chromosome is a string of
some values. Values can be form numbers, real numbers
or characters.
Chromosome 1.2324 5.3243 0.4556 2.3293 2.4545
A
Chromosome ABDJEIFJDHDIERJFDLDFLFEGT
B
Ex: F inding weig hts for neural network
Chromosome
(back), (back), (right), (forward), (left)
The Cproblem: To find the weights of synapses
connecting input to hidden layer and hidden layer to
output layer
Encoding: Each value chromosome represent the
corresponding weights
Contd..
13
Tree Encoding – Every chromosome is a tree of some
objects, such as functions or commands in a programming
language
Used for evolving programs or expressions in Programming
Languages
( do_until step wall )
(+ x (/ 5 y))
Ex: Finding a function from given values
The problem: Some input and output values are given.
Task is to find a function, which will give the best output to
all inputs
Encoding: Chromosome are functions represented i
13
Operators of GA
Three Basic operators:
1. Reproduction
2. Crossover
3. Mutation
The new poopulation is further evaluated and tested for
termination
If the termination criteria are not met, the population is
iteratively operated
One cycle of operations and the subsequent evaluation
– Generation in GA
Reproduction 13
Chromosomes are selected from the population to be
parents to crossover and produce offspring
Also known as Selection Operator
Parents are selected according to their fitness
There are many methods to select the best
chromosomes
e Roulette Wheel Selection
e Rank Selection
e Tournament Selection
t Steady State Selection
e Elitism
The better the chromosomes are, the more chances to
Contd
.. 13
Roulette Wheel Selection:
Main idea: A string is selected from the mating pool
with a probability proportional to the fitness
Probability of the ith selected string:
Chance to be selected is exactly proportional to fitness
Chromosome with bigger fitness will be selected more
times
Contd
.. 13
No. String Fitnes % Of Total
1 01101 s
169 14.4
2 11000 576 49.2
3 01000 64 5.5
4 10011 361 30.9
Total 1170 100.0
Chrom os om e1
Chrom os om e 2
Chrom os om e 3
Chrom os om e 4
Contd..
13
Rank Selection:
Main idea: First ranks the population and then every
chromosome receives fitness from this ranking
The worst will have fitness 1, second worst 2 etc. and the
best will have fitness N
After this all the chromosomes have a chance to be
selected. But this method can lead to slower
convergence, because the best chromosomes do not
differ so much from other ones
Disadvantage: the population must be sorted on each
Contd..
13
Tournment Selection:
Binary Tournament: Two individuals are randomly
chosen; the fitter of the two is selected as a parent
Probabilistic Binary Tournament: Two individuals are
randomly chosen, with a chance p, 0.5<p<1, the fitter of
the two is selected as a parent
Larger Tournaments: ‘n’ individuals are randomly
chosen, the fittest one is selected as a parent
Contd..
13
Steady-State Selection:
Main idea: Big part of chromosomes should survive to
next generation
Working:
In every generation is selected a few (good - with
high fitness) chromosomes for creating a new
offspring
Then some (bad - with low fitness) chromosomes
are removed and the new offspring is placed in their
place
The rest of population survives to new generation
Contd..
13
Elitism:
Main idea: copy the best chromosomes (solutions) to
new population before applying crossover and
mutation
When creating a new population by crossover or
mutation the best chromosome might be lost
Forces GAs to retain some number of the best
individuals at each generation.
Improves performance
Crossover 13
Applied to create a better string
Proceeds in three steps
1. The reproduction operator selects at random a pair of
two individual strings for mating
2. A cross-site is selected at random along the string
length
3. The position values are swapped between two strings
following the cross-site
MAY NOT ALWAYS yield a better or good solution
Since parents are good, probability of the child being
good is high
If offspring is not good, it will be removed in the next
iteration during “Selection”
Contd..
Contd..
13
1. Single Point Crossover:
Single Point Crossover:
A cross-site is selected randomly along the length of the
mated stringsis selected randomly along the length of the mated
A cross-site
Bits next to the cross-site are exchanged
strings
If good strings are not created by crossover, they will not
Bits next to the cross-site are exchanged
survive beyond next generation
If good strings are not created by crossover, they will not
1 0 1 1 beyond
survive Parent1
1 1 1 1 next generation
Offspring1 10111001
Pa 01010001 1 Parent2
111 Offspring2
Offspri 01010111
rent1 1011 ng1 101110 01
Parent2 01010001 01010111
Strings before Mating Offspring2
Strings after Mating
Strings before Strings after Mating
Mating
Contd..
13
Two-point Point Crossover:
Two random sites are chosen
The contents bracketed by these are exchanged between
two mated parents
Parent1 10010111 Offspring1 10010011
Parent2 01110001 Offspring2 01110101
Strings before Strings after
Mating Mating
Contd..
Uniform Crossover:
13
Bits are randomly copied from the first or from the second
parent
A random mask is generated
The mask determines which bits are copied from one parent
and which from the other parent
Mask: 0110011000 (Randomly generated)
Parent 1 1010001110
Parent 2 0011010010
Offspring 0011001010
1
Offspring 1010010110
2
Mutation 13
Restores lost genetic materials
Mutation restores lost genetic materials
Mutation of a bit involves flipping
Mutation of flipping it,
it, changing
changing 00 to
to 1 and vice
versa mutate
mutate
Offspring1 1011011111 Offspring1 1011001111
Offspring1
Offspring2
1011011111
1000000000 Offs
Offspring2 ing1 1011001111
1010000000
OffsOriginal 1010000000
ing2offspring Offspring2 1000000000
Mutated offspring
Original offspring ut ted offspring
Parameters of GA 13
Crossover probability:
How often will be crossover performed
If there is no crossover, offspring is exact copy of parents
If there is a crossover, offspring is made from parts of
parents' chromosome
If crossover probability is 100%, then all offspring is made
by crossover
If it is 0%, whole new generation is made from exact
copies of chromosomes from old population
Contd..
13
Mutation Probability:
How often will be parts of chromosome mutated
If there is no mutation, offspring is taken after crossover
(or copy) without any change
If mutation is performed, part of chromosome is changed
If mutation probability is 100%, whole chromosome is
changed
If it is 0%, nothing is changed
Contd..
13
Population Size:
Describes how many chromosomes are in population
If there are too few chromosomes, GA have a few
possibilities to perform crossover and only a small part of
search space is explored
If there are too many chromosomes, GA slows down
Example 13
Traveling Salesman Problem (TSP)
Assume number of cities N = 10
Representation: it is an ordered list of city
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)
Crossover
:
Parent1 (3 5 7 2 1 6 4 8)
Parent2 (2 5 7 6 8 1 3 4)
Child (5 8 7 2 1 6 3 4)
Mutation: * *
Before: (5 8 7 2 1 6 3 4)
After: (5 8 6 2 1 7 3 4)
13
Benefits
Easy to understand
Modular, separate from application
Supports multi-objective optimization
Easy to exploit previous or alternate solutions
Flexible in forming building blocks for hybrid applications
Substantial history and range of use
Disadvantage:
GA requires more computational time
It is slower than some other methods
Applications 13
Automotive design
In designing composite materials and aerodynamic shapes for
race cars and regular means of transportation (including aviation) can
return combinations of best materials and best engineering to provide
faster, lighter, more fuel efficient and safer vehicles
the process can be done much quicker and more efficiently by
computer modeling using GA searches to return a range of options for
13
Engineering design
• To optimize the structural and operational design of buildings, factories,
machines, etc. is a rapidly expanding application of GAs
•
Used to optimizing the design of heat exchangers, robot gripping arms,
satellite booms, building trusses, flywheels, turbines, and just about any
other computer-assisted engineering design application.
13
Robotics
• Robotics involves human designers and engineers trying out all sorts of
things in order to create useful machines that can do work for humans
• GAs can be programmed to search for a range of optimal designs and
components for each specific use, or to return results for entirely new
types of robots that can perform multiple tasks and have more general
application
13
Optimized Telecommunications
Routing
• GAs are being developed that it will allow for dynamic and
anticipatory routing of circuits for telecommunications networks
• These could take notice of your system's instability and anticipate
your re-routing needs.
• optimize placement and routing of cell towers for best coverage and
ease of switching
13
Trip, Traffic and Shipment Routing
• Traveling Salesman Problem or TSP can be used to plan the most efficient
routes and scheduling for travel planners, traffic routers and even
shipping companies
• The shortest routes for traveling and the timing to avoid traffic tie-ups
and rush hours
• GA contributed more to it than the travel agent did
13
• Computer Gaming
• Encryption and Code Breaking
• Computer Aided Molecular Design
• Gene Expression Profiling
• Finance and Investment strategies
• Marketing and Marchandising
Conclusion 13
Genetic algorithms are original systems based on the
supposed functioning of the Living. The method is very
different from classical optimization algorithms. These
algorithms are nevertheless extremely efficient, and are
used in many fields.
Bibliography 13
Neural Networks, Fuzzy Logic, and Genetic
Algorithms
- S. Rajasekaran
- G. A. Vijayalakshmi Pai
13