SlideShare a Scribd company logo
Department of Computer Science
University of Tabriz
Fall 2015
By: F. Karimi
• Intelligence can be defined as the capability of a system to adapt its behavior
to an ever-changing environment.
• We are products of evolution, and thus by modelling the process of evolution,
we might expect to create intelligent behavior.
• Evolutionary computation simulates evolution on a computer.
• The result of such a simulation is a series of optimization algorithms, usually
based on a simple set of rules.
• Optimization iteratively improves the quality of solutions until an
optimal, or at least feasible, solution is found.
2
• The evolutionary approach to machine learning is based on computational
models of natural selection and genetics.
• We call them evolutionary computation, an umbrella term that combines
genetic algorithms, evolution strategies and genetic programming.
• All these techniques simulate evolution by using the processes of selection,
mutation and reproduction.
• More precisely, evolutionary algorithms maintain a population of structures
that evolve according to rules of selection and other operators, such as
recombination and mutation.
3
4
Search Techniques
Calculus Base
Techniques
Guided random
search techniques
Enumerative
Techniques
BFSDFS Dynamic
Programming
Tabu Search Hill
Climbing
Simulated
Anealing
Evolutionary
Algorithms
Genetic
Programming
Genetic
Algorithms
Fibonacci Sort
• Several different methods of evolutionary computation are now known.
• They all simulate natural evolution, generally by creating a population of
individuals, evaluating their fitness, generating a new population through
genetic operations, and repeating this process a number of times.
5
Genetic
Algorithm
(GA)
Genetic
Programming
(GP)
Evolutionary
Strategy(ES)
Evolutionary
Programming
(EP)
• Genetic Algorithms (GA) are a class of stochastic search algorithms based
on biological evolution.
• They have been used successfully for tackling large, complex and multi
modal search spaces.
• Originally developed by John Holland (1975).
• Inspired by the biological evolution process.
• Uses concepts of “Natural Selection” and “Genetic
Inheritance” (Darwin1859).
• Particularly well suited for hard problems where little is
known about the underlying search space.
• Widely-used in business, science and engineering.
6
• Each cell of a living organisms contains chromosomes - strings of DNA
• Each chromosome contains a set of genes - blocks of DNA
• Reproduction involves recombination of genes from parents
• The fitness of an organism is how much it can reproduce before it dies
7
• Genetic Algorithms search by simultaneously
considering a number of potential solutions.
• These solutions are selected by using an objective
fitness function.
• Selected solutions are then manipulated by using
operators such as crossover and mutation to expand the
search.
• As a result, after a number of successive reproductions,
the less fit chromosomes become extinct, while those
best able to survive gradually come to dominate the
population.
8
9
Initial population
Selection
Crossover & mutation
Intermediate population
(mating pool)
Replacement
Next population
One Generation
10
Genotype space = {0,1}LPhenotype space
Encoding
(representation)
Decoding
(inverse representation)
011101001
010001001
10010010
10010001
Chromosome
(individual)
• Two mechanisms link a GA to the problem it is solving: encoding and
evaluation.
• GAs use an objective function to guide the search towards areas of optimal
solution in the search landscape.
• This function evaluates the fitness of each individual and is there to make
sure that the fitter members of the population have a higher chance of being
selected for reproduction.
• Fitness functions are specific to a search space.
11
Max f(x)=x2 0<x<31
constraint
• Choosing a good encoding is vital since the members of the population use
an encoding to represent the solutions and they are directly affected by the
search.
• Coding, mapping from phenotypes to genotypes, is performed in a number of
ways such as Binary, Real-valued, Adaptive and …
12
10110
x=13
f(x)=169
Chromosome
Gene
 Every chromosome is a string of bits, 0 or 1
Ex: Knapsack Problem
Encoding: Each bit specifies if the thing is in knapsack or not
13
010011001100Chromosome B
101101100011Chromosome A
• 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
14
8 5 6 7 2 3 1 4 9Chromosome B
1 5 3 2 6 4 7 9 8Chromosome A
• Every chromosome is a string of some values. Values can be form
numbers, real numbers or characters.
Ex: Finding weights for neural network
The problem: 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 15
Chromosome A 1.2324 5.3243 0.4556 2.3293 2.4545
Chromosome B ABDJEIFJDHDIERJFDLDFLFEGT
Chromosome C (back), (back), (right), (forward), (left)
• 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
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 in a tree
16
( + x ( / 5 y ) ) ( do_until step wall )
17
• Genetic algorithm has a main generational process cycle.
• This cycle is driven mainly by generation number.
• Within this cycle, an initial population is created; each individual is coded so
as to be represented numerically.
• Then each individual of population is assigned a fitness value which is a
parameter with respect to which each individual is evaluated whether or not
to live in subsequent generations.
18
19
Pop size=4
Max f(x)=x2 0<x<31
19
• Chromosomes are selected from the population to be parents to crossover
and produce offspring.
• This process involves randomly picking members of the population that are
used for crossover and mutation and creation of the next population.
• Main idea: better individuals get higher chance
20
Roulette wheel
Tournament
SUS
Rank based
– Implementation: roulette wheel technique
» Assign to each individual a part of the roulette wheel
» Spin the wheel n times to select n individuals
21
fitness(A) = 3
fitness(B) = 1
fitness(C) = 2
A C
1/6 = 17%
3/6 = 50%
B
2/6 = 33%
• The tournament selection strategy provides selective pressure by holding a
tournament competition among N individuals.
• The best individual from the tournament is the one with the highest fitness,
which is the winner of tournament.
• Tournament competitions and the winner are
then come back to the population.
22
23
 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
 Elitism can very rapidly increase performance of GA, because it prevents
losing the best found solution
24
• Crossover operator is a method for sharing
information between chromosomes.
• Selected parents reproduce the offspring by
performing a crossover operation on the
chromosomes.
• If a pair of chromosomes does not cross over,
then chromosome cloning takes place, and the
offspring are created as exact copies of each
parent.
25
• Two point crossover
• Uniform crossover
26
Parent 1
Parent 2
offspring 1
offspring 2
0.6< Probability of crossover (Pc) <0.9
Parent 1
Parent 2
Mask
offspring 1
offspring 2
27
Invalid offspring!!!
Remove
Repair
Penalize
Exploration
• Mutation is a random process where once the genes are replaced by another
to produce a new genetic structure.
• In genetic algorithms, mutation is randomly applied with low probability and
modifies elements in the chromosomes.
• mutation operator does play a role of local random search within the
framework of the generational process cycle
28
Exploitation
• Mutation is considered a secondary search operator for a GA and crossover
is considered the main means of GA search.
29
Swap mutation
Before mutation
After mutation
0.01< Probability of mutation (Pm) <0.001
29
Before mutation
After mutation
Insertion mutation
• Termination is the criterion by which the genetic algorithm decides whether to
continue searching or stop the search.
– Generation Number - A termination method that stops the evolution when
the user-specified max number of evolutions have been run. This
termination method is always active.
– Evolution Time
– Fitness Threshold
– Population Convergence
The entire set of generations is called a run. At the end of a run, we expect
to find one or more highly fit chromosomes.
30
Flow chart
31
• Step 1: Represent the problem variable domain as a chromosome of a fixed
length, choose the size of a chromosome population N, the crossover
probability pc and the mutation probability pm.
• Step 2: Define a fitness function to measure the performance, or fitness, of
an
individual chromosome in the problem domain. The fitness function
establishes the basis for selecting chromosomes that will be mated during
reproduction.
• Step 3: Randomly generate an initial population of chromosomes of size N:
x1 ; x2 ; . . . ; xN
• Step 4: Calculate the fitness of each individual chromosome:
f(x1), f(x2), ….., f(xn )
• Step 5: Select a pair of chromosomes for mating from the current population.
Parent chromosomes are selected with a probability related to their fitness.
Highly fit chromosomes have a higher probability of being selected for mating
than less fit chromosomes.
• Step 6: Create a pair of offspring chromosomes by applying the genetic
operators – crossover and mutation.
• Step 7: Place the created offspring chromosomes in the new population.
• Step 8: Repeat Step 5 until the size of the new chromosome population
becomes equal to the size of the initial population, N.
• Step 9: Replace the initial (parent) chromosome population with the new
(offspring) population.
• Step 10: Go to Step 4, and repeat the process until the termination criterion is
satisfied
32
• Finding maximum value of the function (15x – x2) 0<x<15
• Size of the chromosome population N is 6, the crossover probability pc
equals 0.7, and the mutation probability pm equals 0.001.
• Initial population of chromosomes by filling six 4-bit strings with randomly
generated ones and zeros.
33
The fitness function and chromosome locations: (a) chromosome initial
locations; (b) chromosome final locations
• The size of the chromosome population remains unchanged from one
generation to the next.
34
• To select a chromosome for mating, a random number is generated in the
interval [0, 100] and the chromosome whose segment spans the random
number is selected.
• In our example, we have an initial population of six chromosomes. Thus, to
establish the same population in the next generation, the roulette wheel
would be spun six times.
35
36
• After selection and crossover, the
average fitness of the chromosome
population has improved and gone
from 36 to 42.
• The final population would consist
of only chromosomes:
• Suppose it is desired to find the maximum of the ‘peak’ function of two
variables:
• To calculate the fitness of each chromosome. This is done in two stages: First,
a chromosome is decoded by converting it into two real numbers, x and y, in the interval
between -3 and 3.
37
-3<x, y<3
• Now the range of integers that can be handled by 8-bits, that is the
range from 0 to (28-1), is mapped to the actual range of parameters x
and y, that is the range from -3 to 3:
• To obtain the actual values of x and y, we multiply their decimal values
by
0.0235294 and subtract 3 from the results:
38
• Whether or not an optimal solution is
being reached?
39
Crossover=0.7
Mutation= 0.001
Iteration number= 100
• One way of providing some degree of insurance is to compare results
obtained under different rates of mutation
40
Local maximum solution global maximum solution
• Quality of optimization procedures are frequently evaluated by using common
standard literature benchmarks.
41
42
43
44
Domain Application Types
Control gas pipeline, pole balancing, missile evasion, pursuit
Design semiconductor layout, aircraft design, keyboard
configuration, communication networks
Scheduling manufacturing, facility scheduling, resource allocation
Robotics trajectory planning
Machine Learning designing neural networks, improving classification
algorithms, classifier systems
Signal Processing filter design
Game Playing poker, checkers, prisoner’s dilemma
Combinatorial
Optimization
set covering, travelling salesman, routing, bin packing,
graph colouring and partitioning
• The GA techniques have a solid theoretical foundation. That foundation is
based on the Schema Theorem.
• A schema is a set of bit strings of ones, zeros and asterisks, where each
asterisk can assume either value 1 or 0.
• The ones and zeros represent the fixed positions of a schema, while
asterisks represent ‘wild cards’.
• stands for a set of 4-bit strings. Each string in this set begins with 1 and ends
with 0. These strings are called instances of the schema.
45
• chromosome matches a schema when the fixed positions in the schema
match the corresponding positions in the chromosome.
• These chromosomes are said to be instances of the schema H.
• The number of defined bits (non-asterisks) in a schema is called the order.
• The schema H, for example, has two defined bits, and thus its order is 2.
46
• In short, genetic algorithms manipulate schemata when they run. If GAs use a
technique that makes the probability of reproduction proportional to chromosome
fitness, then according to the Schema Theorem (Holland, 1975), we can predict
the presence of a given schema in the next chromosome generation.
• In other words, we can describe the GA’s behavior in terms of the increase or
decrease in the number of instances of a given schema (Goldberg, 1989).
47
a schema with above-average fitness will indeed tend to occur more
frequently in the next generation of chromosomes, and a schema with below
average fitness will tend to occur less frequently.
• Crossover and mutation can both create and destroy instances of a schema.
• Here we will consider only destructive effects, that is effects that decrease
the number of instances of the schema H.
• The schema will survive after crossover if at least one of its offspring is also
its instance.
• This is the case when crossover does not occur within the defining length of
the schema.
• The distance between the outermost defined bits of a schema is called
defining length.
48
3
5
• If crossover takes place within the defining length, the schema H can be
destroyed and offspring that are not instances of H can be created.
• Thus, the probability that the schema H will survive after crossover can be
defined as:
l and ld are, respectively, the length and the defining length of the schema H.
• It is clear, that the probability of survival under crossover is higher for short
schemata rather than for long ones.
49
• Let pm be the mutation probability for any bit of the schema H, and n be the
order of the schema H.
• Then (1- pm) represents the probability that the bit will not be mutated, and
thus the probability that the schema H will survive after mutation is
determined as:
50
It is also clear that the probability of survival under mutation is higher for
low-order schemata than for high-order ones.
• This equation describes the growth of a schema from one generation to the
next. It is known as the Schema Theorem:
• Because equation considers only the destructive effects of crossover and
mutation, it gives us a lower bound on the number of instances of the
schema H in the next generation.
51
• A fastest search technique
• GAs will produce "close" to optimal results in a "reasonable" amount of time
• Suitable for parallel processing
• Fairly simple to develop
• Makes no assumptions about the problem space
52
• Number of permutations of functions and variables.
• The search space is vast.
• It requires a lot of computer work, even when a good set of operations,
terminals and controlling algorithm are chosen.
53
• Genetic algorithms are a very powerful tool, but need to be applied
intelligently.
• For example, coding the problem as a bit string may change the nature of the
problem being investigated.
• In other words, there is a danger that the coded representation becomes a
problem that is different from the one we wanted to solve.
54
55
Thanks for
your attention.
• An evolution strategy is a purely numerical optimization procedure that is
similar to a focused Monte Carlo search.
• Unlike genetic algorithms, evolution strategies use only a mutation operator.
• In addition, the representation of a problem in a coded form is not required.
• Evolution strategies are used in technical optimization problems when no
analytical objective function is available, and no conventional optimization
method exists – only the engineer’s intuition.
56
• Genetic programming is a recent development in the area of evolutionary
computation.
• It was greatly stimulated in the 1990s by John Koza.
• Genetic programming applies the same evolutionary approach as genetic
algorithms.
• However, genetic programming is no longer breeding bit strings that
represent coded solutions but complete computer programs that solve a
problem at hand.
• Solving a problem by genetic programming involves determining the set of
arguments, selecting the set of functions, defining a fitness function to
evaluate the performance of created computer programs, and choosing the
method for designating a result of the run.
57

More Related Content

PPTX
Introduction to Genetic Algorithms
PPTX
Genetic Algorithms
PPTX
Genetic Algorithm
PDF
Understanding Convolutional Neural Networks
PPTX
Genetic Algorithm
PPT
Genetic Algorithms - Artificial Intelligence
PPTX
Genetic algorithm
PPTX
Genetic algorithm
Introduction to Genetic Algorithms
Genetic Algorithms
Genetic Algorithm
Understanding Convolutional Neural Networks
Genetic Algorithm
Genetic Algorithms - Artificial Intelligence
Genetic algorithm
Genetic algorithm

What's hot (20)

PPTX
GENETIC ALGORITHM
PPTX
Introduction to Genetic Algorithms
PPTX
Genetic Algorithm
PPT
Genetic algorithm
PPTX
Genetic Algorithm by Example
PPTX
Genetic algorithm
PPTX
Lecture 26 local beam search
PPTX
Fuzzy Genetic Algorithm
PPTX
MACHINE LEARNING - GENETIC ALGORITHM
PDF
Genetic Algorithms
PDF
Genetic Algorithms
PPTX
Genetic algorithms in Data Mining
PPT
Genetic algorithm
PPT
Introduction to Genetic algorithms
PPT
Introduction to Genetic Algorithms
PPTX
Flowchart of GA
PPTX
Metaheuristics
PPTX
Deep neural networks
PDF
Convolutional Neural Networks (CNN)
PPTX
Soft computing (ANN and Fuzzy Logic) : Dr. Purnima Pandit
GENETIC ALGORITHM
Introduction to Genetic Algorithms
Genetic Algorithm
Genetic algorithm
Genetic Algorithm by Example
Genetic algorithm
Lecture 26 local beam search
Fuzzy Genetic Algorithm
MACHINE LEARNING - GENETIC ALGORITHM
Genetic Algorithms
Genetic Algorithms
Genetic algorithms in Data Mining
Genetic algorithm
Introduction to Genetic algorithms
Introduction to Genetic Algorithms
Flowchart of GA
Metaheuristics
Deep neural networks
Convolutional Neural Networks (CNN)
Soft computing (ANN and Fuzzy Logic) : Dr. Purnima Pandit
Ad

Viewers also liked (20)

PPTX
Clustering using GA and Hill-climbing
PPTX
Agile software development and extreme Programming
PPTX
optimizing code in compilers using parallel genetic algorithm
PDF
Simulated Binary Crossover
PPT
PPT
PDF
Genetic Algorithms
PPTX
Introduction to genetic programming
PPTX
Genetic programming
ODP
Genetic Programming in Python
PDF
Introduction to Genetic Programming
PPTX
Powerpoint Presentation
DOCX
PPT
EFFECTS OF SOCIAL MEDIA ON YOUTH
PPT
Clarke slideshare
PDF
Madhusha B Ed
PPTX
University Assignment Literacy Assessment
PDF
Getting Started with MongoDB
PPSX
POWR POINT PRESENTATION
PDF
Paginas libres
DOCX
huruf prasekolah
Clustering using GA and Hill-climbing
Agile software development and extreme Programming
optimizing code in compilers using parallel genetic algorithm
Simulated Binary Crossover
PPT
Genetic Algorithms
Introduction to genetic programming
Genetic programming
Genetic Programming in Python
Introduction to Genetic Programming
Powerpoint Presentation
EFFECTS OF SOCIAL MEDIA ON YOUTH
Clarke slideshare
Madhusha B Ed
University Assignment Literacy Assessment
Getting Started with MongoDB
POWR POINT PRESENTATION
Paginas libres
huruf prasekolah
Ad

Similar to Genetic Algorithm (20)

PPTX
Genetic algorithm optimization technique.pptx
PPTX
PPT
Evolutionary algorithms
PPT
0101.genetic algorithm
PPTX
introduction of genetic algorithm
PPTX
GA of a Paper 2012.pptx
PDF
Genetic Algorithms in Artificial Intelligence
PPTX
Genetic algorithm raktim
PPTX
Genetic algorithm_raktim_IITKGP
PPT
Genetic Algorithms - GAs
PPTX
PPTX
Genetic algorithm
PPT
Genetic-Algorithms.ppt
PPT
Genetic-Algorithms.ppt
PPT
Genetic-Algorithms for machine learning and ai.ppt
PPT
AI_PPT_Genetic-Algorithms.ppt
PPT
Genetic-Algorithms forv artificial .ppt
PPT
Genetic-Algorithms-computersciencepptnew.ppt
PPTX
Introduction to Genetic algorithm
PDF
RM 701 Genetic Algorithm and Fuzzy Logic lecture
Genetic algorithm optimization technique.pptx
Evolutionary algorithms
0101.genetic algorithm
introduction of genetic algorithm
GA of a Paper 2012.pptx
Genetic Algorithms in Artificial Intelligence
Genetic algorithm raktim
Genetic algorithm_raktim_IITKGP
Genetic Algorithms - GAs
Genetic algorithm
Genetic-Algorithms.ppt
Genetic-Algorithms.ppt
Genetic-Algorithms for machine learning and ai.ppt
AI_PPT_Genetic-Algorithms.ppt
Genetic-Algorithms forv artificial .ppt
Genetic-Algorithms-computersciencepptnew.ppt
Introduction to Genetic algorithm
RM 701 Genetic Algorithm and Fuzzy Logic lecture

Recently uploaded (20)

PDF
BMEC211 - INTRODUCTION TO MECHATRONICS-1.pdf
PDF
PPT on Performance Review to get promotions
PPTX
Infosys Presentation by1.Riyan Bagwan 2.Samadhan Naiknavare 3.Gaurav Shinde 4...
PPTX
FINAL REVIEW FOR COPD DIANOSIS FOR PULMONARY DISEASE.pptx
PPTX
UNIT 4 Total Quality Management .pptx
PDF
PREDICTION OF DIABETES FROM ELECTRONIC HEALTH RECORDS
PDF
keyrequirementskkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
PPTX
Artificial Intelligence
PDF
R24 SURVEYING LAB MANUAL for civil enggi
PDF
III.4.1.2_The_Space_Environment.p pdffdf
PPTX
Safety Seminar civil to be ensured for safe working.
PPTX
Current and future trends in Computer Vision.pptx
PDF
BIO-INSPIRED HORMONAL MODULATION AND ADAPTIVE ORCHESTRATION IN S-AI-GPT
DOCX
ASol_English-Language-Literature-Set-1-27-02-2023-converted.docx
PDF
null (2) bgfbg bfgb bfgb fbfg bfbgf b.pdf
PPTX
Sustainable Sites - Green Building Construction
PPTX
Engineering Ethics, Safety and Environment [Autosaved] (1).pptx
PPTX
6ME3A-Unit-II-Sensors and Actuators_Handouts.pptx
PPTX
M Tech Sem 1 Civil Engineering Environmental Sciences.pptx
PDF
A SYSTEMATIC REVIEW OF APPLICATIONS IN FRAUD DETECTION
BMEC211 - INTRODUCTION TO MECHATRONICS-1.pdf
PPT on Performance Review to get promotions
Infosys Presentation by1.Riyan Bagwan 2.Samadhan Naiknavare 3.Gaurav Shinde 4...
FINAL REVIEW FOR COPD DIANOSIS FOR PULMONARY DISEASE.pptx
UNIT 4 Total Quality Management .pptx
PREDICTION OF DIABETES FROM ELECTRONIC HEALTH RECORDS
keyrequirementskkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
Artificial Intelligence
R24 SURVEYING LAB MANUAL for civil enggi
III.4.1.2_The_Space_Environment.p pdffdf
Safety Seminar civil to be ensured for safe working.
Current and future trends in Computer Vision.pptx
BIO-INSPIRED HORMONAL MODULATION AND ADAPTIVE ORCHESTRATION IN S-AI-GPT
ASol_English-Language-Literature-Set-1-27-02-2023-converted.docx
null (2) bgfbg bfgb bfgb fbfg bfbgf b.pdf
Sustainable Sites - Green Building Construction
Engineering Ethics, Safety and Environment [Autosaved] (1).pptx
6ME3A-Unit-II-Sensors and Actuators_Handouts.pptx
M Tech Sem 1 Civil Engineering Environmental Sciences.pptx
A SYSTEMATIC REVIEW OF APPLICATIONS IN FRAUD DETECTION

Genetic Algorithm

  • 1. Department of Computer Science University of Tabriz Fall 2015 By: F. Karimi
  • 2. • Intelligence can be defined as the capability of a system to adapt its behavior to an ever-changing environment. • We are products of evolution, and thus by modelling the process of evolution, we might expect to create intelligent behavior. • Evolutionary computation simulates evolution on a computer. • The result of such a simulation is a series of optimization algorithms, usually based on a simple set of rules. • Optimization iteratively improves the quality of solutions until an optimal, or at least feasible, solution is found. 2
  • 3. • The evolutionary approach to machine learning is based on computational models of natural selection and genetics. • We call them evolutionary computation, an umbrella term that combines genetic algorithms, evolution strategies and genetic programming. • All these techniques simulate evolution by using the processes of selection, mutation and reproduction. • More precisely, evolutionary algorithms maintain a population of structures that evolve according to rules of selection and other operators, such as recombination and mutation. 3
  • 4. 4 Search Techniques Calculus Base Techniques Guided random search techniques Enumerative Techniques BFSDFS Dynamic Programming Tabu Search Hill Climbing Simulated Anealing Evolutionary Algorithms Genetic Programming Genetic Algorithms Fibonacci Sort
  • 5. • Several different methods of evolutionary computation are now known. • They all simulate natural evolution, generally by creating a population of individuals, evaluating their fitness, generating a new population through genetic operations, and repeating this process a number of times. 5 Genetic Algorithm (GA) Genetic Programming (GP) Evolutionary Strategy(ES) Evolutionary Programming (EP)
  • 6. • Genetic Algorithms (GA) are a class of stochastic search algorithms based on biological evolution. • They have been used successfully for tackling large, complex and multi modal search spaces. • Originally developed by John Holland (1975). • Inspired by the biological evolution process. • Uses concepts of “Natural Selection” and “Genetic Inheritance” (Darwin1859). • Particularly well suited for hard problems where little is known about the underlying search space. • Widely-used in business, science and engineering. 6
  • 7. • Each cell of a living organisms contains chromosomes - strings of DNA • Each chromosome contains a set of genes - blocks of DNA • Reproduction involves recombination of genes from parents • The fitness of an organism is how much it can reproduce before it dies 7
  • 8. • Genetic Algorithms search by simultaneously considering a number of potential solutions. • These solutions are selected by using an objective fitness function. • Selected solutions are then manipulated by using operators such as crossover and mutation to expand the search. • As a result, after a number of successive reproductions, the less fit chromosomes become extinct, while those best able to survive gradually come to dominate the population. 8
  • 9. 9 Initial population Selection Crossover & mutation Intermediate population (mating pool) Replacement Next population One Generation
  • 10. 10 Genotype space = {0,1}LPhenotype space Encoding (representation) Decoding (inverse representation) 011101001 010001001 10010010 10010001 Chromosome (individual)
  • 11. • Two mechanisms link a GA to the problem it is solving: encoding and evaluation. • GAs use an objective function to guide the search towards areas of optimal solution in the search landscape. • This function evaluates the fitness of each individual and is there to make sure that the fitter members of the population have a higher chance of being selected for reproduction. • Fitness functions are specific to a search space. 11 Max f(x)=x2 0<x<31 constraint
  • 12. • Choosing a good encoding is vital since the members of the population use an encoding to represent the solutions and they are directly affected by the search. • Coding, mapping from phenotypes to genotypes, is performed in a number of ways such as Binary, Real-valued, Adaptive and … 12 10110 x=13 f(x)=169 Chromosome Gene
  • 13.  Every chromosome is a string of bits, 0 or 1 Ex: Knapsack Problem Encoding: Each bit specifies if the thing is in knapsack or not 13 010011001100Chromosome B 101101100011Chromosome A
  • 14. • 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 14 8 5 6 7 2 3 1 4 9Chromosome B 1 5 3 2 6 4 7 9 8Chromosome A
  • 15. • Every chromosome is a string of some values. Values can be form numbers, real numbers or characters. Ex: Finding weights for neural network The problem: 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 15 Chromosome A 1.2324 5.3243 0.4556 2.3293 2.4545 Chromosome B ABDJEIFJDHDIERJFDLDFLFEGT Chromosome C (back), (back), (right), (forward), (left)
  • 16. • 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 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 in a tree 16 ( + x ( / 5 y ) ) ( do_until step wall )
  • 17. 17
  • 18. • Genetic algorithm has a main generational process cycle. • This cycle is driven mainly by generation number. • Within this cycle, an initial population is created; each individual is coded so as to be represented numerically. • Then each individual of population is assigned a fitness value which is a parameter with respect to which each individual is evaluated whether or not to live in subsequent generations. 18
  • 20. • Chromosomes are selected from the population to be parents to crossover and produce offspring. • This process involves randomly picking members of the population that are used for crossover and mutation and creation of the next population. • Main idea: better individuals get higher chance 20 Roulette wheel Tournament SUS Rank based
  • 21. – Implementation: roulette wheel technique » Assign to each individual a part of the roulette wheel » Spin the wheel n times to select n individuals 21 fitness(A) = 3 fitness(B) = 1 fitness(C) = 2 A C 1/6 = 17% 3/6 = 50% B 2/6 = 33%
  • 22. • The tournament selection strategy provides selective pressure by holding a tournament competition among N individuals. • The best individual from the tournament is the one with the highest fitness, which is the winner of tournament. • Tournament competitions and the winner are then come back to the population. 22
  • 23. 23
  • 24.  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  Elitism can very rapidly increase performance of GA, because it prevents losing the best found solution 24
  • 25. • Crossover operator is a method for sharing information between chromosomes. • Selected parents reproduce the offspring by performing a crossover operation on the chromosomes. • If a pair of chromosomes does not cross over, then chromosome cloning takes place, and the offspring are created as exact copies of each parent. 25
  • 26. • Two point crossover • Uniform crossover 26 Parent 1 Parent 2 offspring 1 offspring 2 0.6< Probability of crossover (Pc) <0.9 Parent 1 Parent 2 Mask offspring 1 offspring 2
  • 28. • Mutation is a random process where once the genes are replaced by another to produce a new genetic structure. • In genetic algorithms, mutation is randomly applied with low probability and modifies elements in the chromosomes. • mutation operator does play a role of local random search within the framework of the generational process cycle 28 Exploitation
  • 29. • Mutation is considered a secondary search operator for a GA and crossover is considered the main means of GA search. 29 Swap mutation Before mutation After mutation 0.01< Probability of mutation (Pm) <0.001 29 Before mutation After mutation Insertion mutation
  • 30. • Termination is the criterion by which the genetic algorithm decides whether to continue searching or stop the search. – Generation Number - A termination method that stops the evolution when the user-specified max number of evolutions have been run. This termination method is always active. – Evolution Time – Fitness Threshold – Population Convergence The entire set of generations is called a run. At the end of a run, we expect to find one or more highly fit chromosomes. 30 Flow chart
  • 31. 31 • Step 1: Represent the problem variable domain as a chromosome of a fixed length, choose the size of a chromosome population N, the crossover probability pc and the mutation probability pm. • Step 2: Define a fitness function to measure the performance, or fitness, of an individual chromosome in the problem domain. The fitness function establishes the basis for selecting chromosomes that will be mated during reproduction. • Step 3: Randomly generate an initial population of chromosomes of size N: x1 ; x2 ; . . . ; xN • Step 4: Calculate the fitness of each individual chromosome: f(x1), f(x2), ….., f(xn )
  • 32. • Step 5: Select a pair of chromosomes for mating from the current population. Parent chromosomes are selected with a probability related to their fitness. Highly fit chromosomes have a higher probability of being selected for mating than less fit chromosomes. • Step 6: Create a pair of offspring chromosomes by applying the genetic operators – crossover and mutation. • Step 7: Place the created offspring chromosomes in the new population. • Step 8: Repeat Step 5 until the size of the new chromosome population becomes equal to the size of the initial population, N. • Step 9: Replace the initial (parent) chromosome population with the new (offspring) population. • Step 10: Go to Step 4, and repeat the process until the termination criterion is satisfied 32
  • 33. • Finding maximum value of the function (15x – x2) 0<x<15 • Size of the chromosome population N is 6, the crossover probability pc equals 0.7, and the mutation probability pm equals 0.001. • Initial population of chromosomes by filling six 4-bit strings with randomly generated ones and zeros. 33
  • 34. The fitness function and chromosome locations: (a) chromosome initial locations; (b) chromosome final locations • The size of the chromosome population remains unchanged from one generation to the next. 34
  • 35. • To select a chromosome for mating, a random number is generated in the interval [0, 100] and the chromosome whose segment spans the random number is selected. • In our example, we have an initial population of six chromosomes. Thus, to establish the same population in the next generation, the roulette wheel would be spun six times. 35
  • 36. 36 • After selection and crossover, the average fitness of the chromosome population has improved and gone from 36 to 42. • The final population would consist of only chromosomes:
  • 37. • Suppose it is desired to find the maximum of the ‘peak’ function of two variables: • To calculate the fitness of each chromosome. This is done in two stages: First, a chromosome is decoded by converting it into two real numbers, x and y, in the interval between -3 and 3. 37 -3<x, y<3
  • 38. • Now the range of integers that can be handled by 8-bits, that is the range from 0 to (28-1), is mapped to the actual range of parameters x and y, that is the range from -3 to 3: • To obtain the actual values of x and y, we multiply their decimal values by 0.0235294 and subtract 3 from the results: 38
  • 39. • Whether or not an optimal solution is being reached? 39 Crossover=0.7 Mutation= 0.001 Iteration number= 100
  • 40. • One way of providing some degree of insurance is to compare results obtained under different rates of mutation 40 Local maximum solution global maximum solution
  • 41. • Quality of optimization procedures are frequently evaluated by using common standard literature benchmarks. 41
  • 42. 42
  • 43. 43
  • 44. 44 Domain Application Types Control gas pipeline, pole balancing, missile evasion, pursuit Design semiconductor layout, aircraft design, keyboard configuration, communication networks Scheduling manufacturing, facility scheduling, resource allocation Robotics trajectory planning Machine Learning designing neural networks, improving classification algorithms, classifier systems Signal Processing filter design Game Playing poker, checkers, prisoner’s dilemma Combinatorial Optimization set covering, travelling salesman, routing, bin packing, graph colouring and partitioning
  • 45. • The GA techniques have a solid theoretical foundation. That foundation is based on the Schema Theorem. • A schema is a set of bit strings of ones, zeros and asterisks, where each asterisk can assume either value 1 or 0. • The ones and zeros represent the fixed positions of a schema, while asterisks represent ‘wild cards’. • stands for a set of 4-bit strings. Each string in this set begins with 1 and ends with 0. These strings are called instances of the schema. 45
  • 46. • chromosome matches a schema when the fixed positions in the schema match the corresponding positions in the chromosome. • These chromosomes are said to be instances of the schema H. • The number of defined bits (non-asterisks) in a schema is called the order. • The schema H, for example, has two defined bits, and thus its order is 2. 46
  • 47. • In short, genetic algorithms manipulate schemata when they run. If GAs use a technique that makes the probability of reproduction proportional to chromosome fitness, then according to the Schema Theorem (Holland, 1975), we can predict the presence of a given schema in the next chromosome generation. • In other words, we can describe the GA’s behavior in terms of the increase or decrease in the number of instances of a given schema (Goldberg, 1989). 47 a schema with above-average fitness will indeed tend to occur more frequently in the next generation of chromosomes, and a schema with below average fitness will tend to occur less frequently.
  • 48. • Crossover and mutation can both create and destroy instances of a schema. • Here we will consider only destructive effects, that is effects that decrease the number of instances of the schema H. • The schema will survive after crossover if at least one of its offspring is also its instance. • This is the case when crossover does not occur within the defining length of the schema. • The distance between the outermost defined bits of a schema is called defining length. 48 3 5
  • 49. • If crossover takes place within the defining length, the schema H can be destroyed and offspring that are not instances of H can be created. • Thus, the probability that the schema H will survive after crossover can be defined as: l and ld are, respectively, the length and the defining length of the schema H. • It is clear, that the probability of survival under crossover is higher for short schemata rather than for long ones. 49
  • 50. • Let pm be the mutation probability for any bit of the schema H, and n be the order of the schema H. • Then (1- pm) represents the probability that the bit will not be mutated, and thus the probability that the schema H will survive after mutation is determined as: 50 It is also clear that the probability of survival under mutation is higher for low-order schemata than for high-order ones.
  • 51. • This equation describes the growth of a schema from one generation to the next. It is known as the Schema Theorem: • Because equation considers only the destructive effects of crossover and mutation, it gives us a lower bound on the number of instances of the schema H in the next generation. 51
  • 52. • A fastest search technique • GAs will produce "close" to optimal results in a "reasonable" amount of time • Suitable for parallel processing • Fairly simple to develop • Makes no assumptions about the problem space 52
  • 53. • Number of permutations of functions and variables. • The search space is vast. • It requires a lot of computer work, even when a good set of operations, terminals and controlling algorithm are chosen. 53
  • 54. • Genetic algorithms are a very powerful tool, but need to be applied intelligently. • For example, coding the problem as a bit string may change the nature of the problem being investigated. • In other words, there is a danger that the coded representation becomes a problem that is different from the one we wanted to solve. 54
  • 56. • An evolution strategy is a purely numerical optimization procedure that is similar to a focused Monte Carlo search. • Unlike genetic algorithms, evolution strategies use only a mutation operator. • In addition, the representation of a problem in a coded form is not required. • Evolution strategies are used in technical optimization problems when no analytical objective function is available, and no conventional optimization method exists – only the engineer’s intuition. 56
  • 57. • Genetic programming is a recent development in the area of evolutionary computation. • It was greatly stimulated in the 1990s by John Koza. • Genetic programming applies the same evolutionary approach as genetic algorithms. • However, genetic programming is no longer breeding bit strings that represent coded solutions but complete computer programs that solve a problem at hand. • Solving a problem by genetic programming involves determining the set of arguments, selecting the set of functions, defining a fitness function to evaluate the performance of created computer programs, and choosing the method for designating a result of the run. 57