SlideShare ist ein Scribd-Unternehmen logo
1 von 39
Genetic Algorithms
• Introduction
• Genetic algorithms and optimization
  techniques
• Fitness function
• Genetic operators
• Case study: Job Shop Scheduling



                                   1    1
Introduction
• Decision making is required in all fields
including science & Technology, management etc.
• Many traditional optimization procedures have
been developed to solve problems like linear and
nonlinear programming, inventory, assignment
and scheduling problems
•The main drawback of these traditional
techniques is most of the time they may end up
with local optima rather than global optima
                                   2
Introduction contd..
• Some non traditional search and optimization
  techniques include
 - Genetic Algorithms
 - Simulated Annealing
 - Ant Colony optimization etc.
• The concept of GA is conceived by Prof.
  Holland of university of Michigan



                                        3
Introduction contd..
• Genetic Algorithms are techniques to
  solve complex problems. The basis of
  these techniques relies on the natural
  process of human evolution over a period
  of time




                               4         4
Difference between Genetic Algorithm and
       traditional optimization techniques
• GA works with a string coding of variables instead of
  variables; the coding discretizes the search space
  even for continuous functions but only appropriate
  coding of the problem can converge to a right
  solution
• Since GA requires function values at discrete points,
  a discrete or discontinuous function can also be
  handled
• GA operators find the similarities in string structures
  and hence may find the global best solution

                                           5
Difference between Genetic Algorithm and
   traditional optimization techniques contd..
• GA processes more than one string simultaneously
  and thus works with a population of solutions instead
  of one solution at a time; also previously found
  information is used efficiently in the next iteration
• Since GA is population based search algorithm,
  multiple optimal solutions can be obtained without
  much effort
• GA does not require any additional information
  except the object function value

                                         6
Difference between Genetic Algorithm and
  traditional optimization techniques contd..
• Many real world optimization problems are
  multimodal problems      and GA can handle
  such problems
      - GA skips the local minimum (due to the
  probabilities used) and explores all the
  solution space and hence can reach the global
  minimum


                                    7
Theory of Darwinian Evolution
• Chromosomes are the basis of creation of life

• Every chromosome contains millions of genes

• Every gene contributes to a phenotype – a
  specific feature or characteristic of the child
  such as the color of the eye, blood group etc.
  that are inherited from parents/ancestors

                                      8             8
Theory of Darwinian Evolution contd..

• Each gene for the blood type can have the
  values 0, 1, or 2 called alleles

• A set of alleles form a gene-pair called
  genotypes

      For example for the blood group or
  phenotype A, the genotype is 01 or 11; for
  phenotype AB, the genotype is 21
                                      9
Theory of Darwinian Evolution contd..

• Some of the genes mutate (change the values
  from one to another randomly) due to
  exposure to chemicals, or biological effects

• Over a number of generations of individuals,
  survival and reproduction are more
  predominant in the population


                                  10         10
Structure of Genetic algorithm


 G Generate
 e             evaluate          Optimization        Best individuals
                                                 y
 nInitial      objective         Criteria met?   e
 epopulation                                     s
 r             function
                                                                Result
                                           no
start
                                    Selection
                    Generate
                    New            Recombination

                    population
                                    Mutation




                                                        11
Steps in Genetic Algorithm

• Genetic algorithms are based on the theory of
  selection
  1.A set of random solutions are generated
• Only those solutions survive that satisfy a
  fitness function
• Each solution in the set is a chromosome
• A set of such solutions forms a population


                                    12            12
Genetic Algorithms contd..
2. The algorithm uses three basic genetic operators
   namely
(i)Reproduction
(ii)crossover and
(iii) mutation    along with a fitness function to
   evolve a new population or the next generation

• Thus the algorithm uses these operators and the
  fitness function to guide its search for the optimal
  solution
• It is a guided random search mechanism
                                        13          13
Significance of the genetic operators
• Reproduction or selection by two parent
  chromosomes is done based on their fitness
• Reproduction ensures that only the fittest of the
  solutions made to form offsprings
• Reproduction will force the GA to search that
  area which has highest fitness values
Crossover or recombination: Crossover ensures that
  the search progresses in the right direction by
  making new chromosomes that possess
  characteristics similar to both the parents

                                      14          14
Significance of the genetic operators contd..

Mutation: To avoid local optimum, mutation is
   used
It facilitates a sudden change in a gene within a
   chromosome allowing the algorithm to see for
   the solution far way from the current ones




                                     15             15
Genetic operator: Reproduction

•    There are many techniques for Reproduction
     or selection operator
1.   Roulette wheel selection
2.   Tournament selection
3.   Ranked position selection
4.   Steady state selection



                                    16
1. Roulette wheel selection
•   The circumference of Roulette wheel is
    divided into segments and marked for each
    string proportionate to the fitness value     6
       1
                 20%    217%
                        11



           5    19%     3 19
                       14%
                         %
•                 4

•   The wheel is spun n times; each time a
    segment is selected by the wheel pointer
•   The segment with highest fitness value will
    have more probability for selection
                                     17
Roulette wheel selection contd..
• In practice the procedure is as follows

• The individual fitness values are mapped to
  contiguous segments of a line

• Using fitness values of the string selection
  probability is computed using pi=Fi / ΣFj j=1,2,
  …,n



                                       18
Roulette wheel selection contd..

• Cumulative probability for each string is computed;
  the ith string in the population represents the
  cumulative probability from pi-1 to pi
• A random number is generated and the string for
  which the random number lies in the cumulative
  probability range is selected for the mating pool
• The process is repeated until the desired number of
  individuals (called mating population) is obtained


                                          19
Roulette wheel selection - Example
Table 1.1: Strings and fitness values
Number of 1 2 3 4 5 6 7 8 9                     10
Individual
Fitness value2.0 1.8 1.6 1.4 1.2 1.0 0.8 0.6 0.4 0.2
Total fitness =11.0 and 2.0/11.0= 0.181~0.18
Table1.2: Computations of probabilities
Number of 1 2 3 4 5 6 7 8 9                       10
Individual
Selection 0.18 0.16 0.15 0.13 0.11 0.09 0.07 0.06 0.04 0.02
Probability
Cumulative 0.18 0.34 0.49 0.62 0.73 0.82 0.89 0.95 0.99 1.01
Probability


                                                       20
Roulette wheel selection – Example contd..
Selection Procedure:
Let the six generated random numbers be
0.81, 0.32, 0.96, 0.01, 0.65, and 0.42
    1 2       3 4      5   6    7    8 9         10

0.0 0.18 0.34 0.49 0.62 0.73 0.82 0.89 0.95 0.99 1.01




0.81 falls between 0.73 and 0.82;so string 6 is selected
0.32 falls between 0.18 and 0.34;so string 2 is selected
0.96 falls between 0.05 and 0.99;so string 9 is selected
0.01 falls between 0.00 and 0.18;so string 1 is selected
0.65 falls between 0.62 and 0.73;so string 5 is selected
0.42 falls between 0.34 and 0.49;so string 3 is selected
Mating population after selection:1,2, 3,5, 6, 9           21
Crossover or recombination
• Crossover operator produces new offspring
  after combining the information contained in
  two parents
• Crossover is performed with a crossover
  probability Pc
• A random number say r is generated and
  compared with Pc
• If Pc > r crossover occurs; otherwise the two
  strings are repeated without any change
                                   22
Crossover methods
1.   Real valued crossover
  The following methods are used to get a new offspring from
     two parent strings
  1.1 Discrete crossover
  1.2 Intermediate crossover
  1.3 Line crossover
2. Binary valued crossover
The following methods are used to get a new offspring from two
     binary encoded strings of parents selected from mating pool
   2.1 Single-point crossover
   2.2 Multi-point crossover
     2.3 Uniform crossover
     2.4 Shuffle crossover

                                                23
Crossover or recombination
• Crossover operator produces new offspring
  after combining the information contained in
  two parents
• Crossover is performed with a crossover
  probability Pc
• A random number say r is generated and
  compared with Pc
• If Pc > r crossover occurs; otherwise the two
  strings are repeated without any change

                                   24
Binary valued Crossover-Single Point crossover
Single Point crossover method
• One crossover point is selected randomly between 1 and the
   number of bits in a chromosome
• The bits are exchanged between the parents about this point
   (after this point)
• Thus two new offspring are produced
• Example: Consider two parents with 11 binary variables each
Parent 1: 0 1 1 1 0 0 1 1 0 1 0
Parent 2: 1 0 1 0 1 1 0 0 1 0 1
Randomly selected crossover point 5

Offspring 1: 0 1 1 1 0 1 0 0 1 0 1
Offspring 2: 1 0 1 0 1 0 1 1 0 1 0


                                              25
Parents                               Offspring




          Figure 4. Single Point crossover
                                                  26
Mutation
• After crossover operation, the string is subjected to mutation
  operation
• Mutation prevents falling all solutions of the population into a
  local optimum
• Mutation operator alters a chromosome locally to create a
  better string
• Mutation causes movement in the search space and restores
  the lost information in the population
• Bit wise mutation is performed with a probability of mutation
  Pm
• A random number r is generated and compared to Pm
• If Pm > r , then mutation occurs; otherwise the bit is kept
  unchanged

                                                  27
Importance of mutation
• Mutation is used to maintain diversity in the population
• Consider the following strings
1110
1001
1100
1000
All the four strings have 1 in the left most position
’If the optimum solution requires a 0 in the left most position,
    the selection or crossover operators will not change the bit
The mutation operation will change its value




                                                28
Mutation methods
1.    Binary valued Mutation
    - This is widely used encoding mechanism
      - In this real value of the variables are transformed to binary
      codes and the genetic operators work on these coded
      strings
The bit-wise operators are as below
1.1 One’s complement operator
1.2 Logical Bit-wise Operator
1.3 Shift Operator
1.4 Swap Operator
1.5 Inverse Operator
2. Real valued Mutation

                                                    29
One’s complement operator
• This unary operator causes the bits of the string to
   be inverted; 1 becomes 0 and 0 becomes 1
• Example:
String before mutation: 1100 1110
A random number r between 0 and 1 is selected and
   compared with mutation probability Pm
If Pm > r , then mutation occurs; otherwise the bit is kept
   unchanged
String after mutation            : 0011 0001
with 1’s complement operator

                                             30
Job Shop Scheduling problem
• Suppose there are three manufacturing units M1, M2
  and M3, each of which is capable of manufacturing a
  different product

• A schedule could be a set of numbers 20,35,15 where
  each number indicates the quantity of the concerned
  product manufactured by M1, M2, and M3
  respectively

• The schedule could yield a profit say 40 computed by
  some equation

• The problem is to optimize (maximize) the profit
• The function used to compute the profit is called the fitness
  function                                     31             31
Job Shop Scheduling problem contd..

• The set {20,35,15} forms the chromosome; its
  members form the genes, Alleles are the
  values that these genes can assume

• The problem can be simplified in terms of
  binary numbers by assuming a unit is ON
  (manufacturing) or OFF (not manufacturing)



                                  32         32
Job Shop Scheduling problem contd..
• A schedule { 1,0,1} yields a chromosome that
  indicates that M1 and M3 are on and M2 is off

    The fitness function could be the binary number
  formed from the individual genes in the
  chromosome; for example the schedule {1,0,1} has
  fitness of (101) 2 or decimal 5

  The problem is to find the best schedule to maximize
  the value of the numbers formed by the genes
  comprising the chromosome
   The solution {1,1,1} could be found using genetic
  algorithm approach                     33          33
Using GA to solve Job Shop Scheduling
                    problem
1. Represent a solution as a chromosome and find a
    suitable fitness function
   Define the chromosomes like {1,0,1}, {1,1,0} etc.,
    and define the fitness function as
   f(chromosome) = (concat(Gene1,Gene2, Gene3))10
2. Choose a population of solutions and initialize it
   Let the population size N be 4; let the initialized
    population be [{0,0,1}, {0,1,0}, {1,1,0}, {1,0,1}]
3. Apply the genetic operators one by one

                                           34            34
Using GA to solve Job Shop Scheduling problem contd..

3. Determine the fitness of each solution fi and
  the total fitness of the population ∑fi as
  follows
  Compute the normalized fitness or fitness
  probability pi, and the expected count of the
  solution (number of solutions that could
  occur) Ec
The computed values are shown in Table 1.


                                            35            35
Using GA to solve Job Shop Scheduling problem contd..
Solution       Solution       fi=concat(Gen
                              e1,Gene2,
                                              %pi=fi/  Ec=N*%pi
No.                           Gene3))10       ∑fi *100 (N=4)

1              {0,1,0}        1               7.14          28.6
2              {0,1,0}        2               14.29         57.1
3              {1,1,0}        6               42.86         171.4
4              {1,0,1}        5               35.71         142.9
∑                             14              100           400
Maximum                       6               42.86         171.43


                                                        36
           Table 1. Fitness and expected count of a generation
Using GA to solve Job Shop Scheduling problem contd..
(b) Reproduction
      Four random numbers are generated to select four
     chromosomes for the next generation
Let the random numbers be 265, 801, 515 and 85 Then the four
     chromosomes are selected based on the fitness probability
     and shown in Table 2. These four chromosomes are called
     the mating pool
Table 2.
Value generated         Selected Solution
265                  {1,1,0}
801                 {1,0,1}
515                 {1,1,0}
85                  {0,0,1}

                                              37
Applying genetic operators

Reproduction or selection operator is applied on the
  mating pool and two solutions are selected. There are
  {1,0,1} and {1,1,0}
 (c) Crossover is applied on {1,0,1} and {1,1,0}
  choosing crossing site 2 and the resultant
  chromosomes are {1,0,0} and {1,1,1}
 (d) Mutation occurs rarely. Mutation flips the value of
  a randomly selected gene in a chromosome
  For example the chromosome {0,1,0} could mutate to
  any of {1,1,0} or {0,0,0} or {0,1,1}
                                          38
Applying genetic operators
• As we have not transgressed through many generations,
  assume that mutation will not occur
• The resultant next generation population along with fitness
  function are shown in Table 3.
       resultant solution Si     fi
      {0,0,1}                   1
    {1,0,0}                    4
     {1,1,1}                   7
      {1,1,0}                  6
         ∑                    19
     Maximum                   7
Thus the solution is {1,1,1} that has highest fitness value

                                                39

Weitere ähnliche Inhalte

Was ist angesagt?

Particle Swarm Optimization - PSO
Particle Swarm Optimization - PSOParticle Swarm Optimization - PSO
Particle Swarm Optimization - PSOMohamed Talaat
 
Flowchart of GA
Flowchart of GAFlowchart of GA
Flowchart of GAIshucs
 
Genetic Algorithm
Genetic AlgorithmGenetic Algorithm
Genetic AlgorithmSHIMI S L
 
Introduction to Genetic Algorithms
Introduction to Genetic AlgorithmsIntroduction to Genetic Algorithms
Introduction to Genetic AlgorithmsDr. C.V. Suresh Babu
 
Genetic algorithms in Data Mining
Genetic algorithms in Data MiningGenetic algorithms in Data Mining
Genetic algorithms in Data MiningAtul Khanna
 
Reinforcement learning, Q-Learning
Reinforcement learning, Q-LearningReinforcement learning, Q-Learning
Reinforcement learning, Q-LearningKuppusamy P
 
Introduction to Genetic Algorithms
Introduction to Genetic AlgorithmsIntroduction to Genetic Algorithms
Introduction to Genetic AlgorithmsAhmed Othman
 
Particle Swarm Optimization: The Algorithm and Its Applications
Particle Swarm Optimization: The Algorithm and Its ApplicationsParticle Swarm Optimization: The Algorithm and Its Applications
Particle Swarm Optimization: The Algorithm and Its Applicationsadil raja
 
Introduction to Genetic algorithms
Introduction to Genetic algorithmsIntroduction to Genetic algorithms
Introduction to Genetic algorithmsAkhil Kaushik
 
Genetic Algorithm by Example
Genetic Algorithm by ExampleGenetic Algorithm by Example
Genetic Algorithm by ExampleNobal Niraula
 
Particle Swarm optimization
Particle Swarm optimizationParticle Swarm optimization
Particle Swarm optimizationmidhulavijayan
 
Recurrent Neural Network (RNN) | RNN LSTM Tutorial | Deep Learning Course | S...
Recurrent Neural Network (RNN) | RNN LSTM Tutorial | Deep Learning Course | S...Recurrent Neural Network (RNN) | RNN LSTM Tutorial | Deep Learning Course | S...
Recurrent Neural Network (RNN) | RNN LSTM Tutorial | Deep Learning Course | S...Simplilearn
 
Nature-Inspired Optimization Algorithms
Nature-Inspired Optimization Algorithms Nature-Inspired Optimization Algorithms
Nature-Inspired Optimization Algorithms Xin-She Yang
 

Was ist angesagt? (20)

Genetic Algorithm
Genetic AlgorithmGenetic Algorithm
Genetic Algorithm
 
Particle Swarm Optimization - PSO
Particle Swarm Optimization - PSOParticle Swarm Optimization - PSO
Particle Swarm Optimization - PSO
 
Flowchart of GA
Flowchart of GAFlowchart of GA
Flowchart of GA
 
Genetic Algorithm
Genetic AlgorithmGenetic Algorithm
Genetic Algorithm
 
Introduction to Genetic Algorithms
Introduction to Genetic AlgorithmsIntroduction to Genetic Algorithms
Introduction to Genetic Algorithms
 
Genetic algorithms in Data Mining
Genetic algorithms in Data MiningGenetic algorithms in Data Mining
Genetic algorithms in Data Mining
 
Reinforcement learning, Q-Learning
Reinforcement learning, Q-LearningReinforcement learning, Q-Learning
Reinforcement learning, Q-Learning
 
Introduction to Genetic Algorithms
Introduction to Genetic AlgorithmsIntroduction to Genetic Algorithms
Introduction to Genetic Algorithms
 
Particle Swarm Optimization: The Algorithm and Its Applications
Particle Swarm Optimization: The Algorithm and Its ApplicationsParticle Swarm Optimization: The Algorithm and Its Applications
Particle Swarm Optimization: The Algorithm and Its Applications
 
Introduction to Genetic algorithms
Introduction to Genetic algorithmsIntroduction to Genetic algorithms
Introduction to Genetic algorithms
 
Genetic Algorithm by Example
Genetic Algorithm by ExampleGenetic Algorithm by Example
Genetic Algorithm by Example
 
Introduction to Genetic Algorithms
Introduction to Genetic AlgorithmsIntroduction to Genetic Algorithms
Introduction to Genetic Algorithms
 
Metaheuristics
MetaheuristicsMetaheuristics
Metaheuristics
 
Differential evolution
Differential evolutionDifferential evolution
Differential evolution
 
Particle Swarm optimization
Particle Swarm optimizationParticle Swarm optimization
Particle Swarm optimization
 
Genetic algorithm
Genetic algorithmGenetic algorithm
Genetic algorithm
 
Recurrent Neural Network (RNN) | RNN LSTM Tutorial | Deep Learning Course | S...
Recurrent Neural Network (RNN) | RNN LSTM Tutorial | Deep Learning Course | S...Recurrent Neural Network (RNN) | RNN LSTM Tutorial | Deep Learning Course | S...
Recurrent Neural Network (RNN) | RNN LSTM Tutorial | Deep Learning Course | S...
 
Nature-Inspired Optimization Algorithms
Nature-Inspired Optimization Algorithms Nature-Inspired Optimization Algorithms
Nature-Inspired Optimization Algorithms
 
Genetic Algorithms
Genetic AlgorithmsGenetic Algorithms
Genetic Algorithms
 
Hill climbing algorithm
Hill climbing algorithmHill climbing algorithm
Hill climbing algorithm
 

Ähnlich wie Genetic Algorithms - Artificial Intelligence

Genetic Algorithms - GAs
Genetic Algorithms - GAsGenetic Algorithms - GAs
Genetic Algorithms - GAsMohamed Talaat
 
AI.3-Evolutionary Computation [15-18].pdf
AI.3-Evolutionary Computation [15-18].pdfAI.3-Evolutionary Computation [15-18].pdf
AI.3-Evolutionary Computation [15-18].pdfThninh2
 
Genetic_Algorithm_AI(TU)
Genetic_Algorithm_AI(TU)Genetic_Algorithm_AI(TU)
Genetic_Algorithm_AI(TU)Kapil Khatiwada
 
Evolutionary (deep) neural network
Evolutionary (deep) neural networkEvolutionary (deep) neural network
Evolutionary (deep) neural networkSoo-Yong Shin
 
Introduction to genetic algorithms
Introduction to genetic algorithmsIntroduction to genetic algorithms
Introduction to genetic algorithmsshadanalam
 
Genetic algorithms
Genetic algorithmsGenetic algorithms
Genetic algorithmsCraig Nicol
 
Genetic algorithm raktim
Genetic algorithm raktimGenetic algorithm raktim
Genetic algorithm raktimRaktim Halder
 
Genetic algorithm_raktim_IITKGP
Genetic algorithm_raktim_IITKGP Genetic algorithm_raktim_IITKGP
Genetic algorithm_raktim_IITKGP Raktim Halder
 
Evolutionary algorithms
Evolutionary algorithmsEvolutionary algorithms
Evolutionary algorithmsM S Prasad
 
evolutionary algo's.ppt
evolutionary algo's.pptevolutionary algo's.ppt
evolutionary algo's.pptSherazAhmed103
 
Flowchart of ga
Flowchart of gaFlowchart of ga
Flowchart of gaDEEPIKA T
 
GA of a Paper 2012.pptx
GA of a Paper 2012.pptxGA of a Paper 2012.pptx
GA of a Paper 2012.pptxwaqasjavaid26
 

Ähnlich wie Genetic Algorithms - Artificial Intelligence (20)

Ga ppt (1)
Ga ppt (1)Ga ppt (1)
Ga ppt (1)
 
Genetic Algorithm
Genetic AlgorithmGenetic Algorithm
Genetic Algorithm
 
0101.genetic algorithm
0101.genetic algorithm0101.genetic algorithm
0101.genetic algorithm
 
Genetic algorithm
Genetic algorithmGenetic algorithm
Genetic algorithm
 
Genetic Algorithms - GAs
Genetic Algorithms - GAsGenetic Algorithms - GAs
Genetic Algorithms - GAs
 
AI.3-Evolutionary Computation [15-18].pdf
AI.3-Evolutionary Computation [15-18].pdfAI.3-Evolutionary Computation [15-18].pdf
AI.3-Evolutionary Computation [15-18].pdf
 
Genetic_Algorithm_AI(TU)
Genetic_Algorithm_AI(TU)Genetic_Algorithm_AI(TU)
Genetic_Algorithm_AI(TU)
 
Evolutionary (deep) neural network
Evolutionary (deep) neural networkEvolutionary (deep) neural network
Evolutionary (deep) neural network
 
CI_L02_Optimization_ag2_eng.pdf
CI_L02_Optimization_ag2_eng.pdfCI_L02_Optimization_ag2_eng.pdf
CI_L02_Optimization_ag2_eng.pdf
 
Introduction to genetic algorithms
Introduction to genetic algorithmsIntroduction to genetic algorithms
Introduction to genetic algorithms
 
Genetic algorithms
Genetic algorithmsGenetic algorithms
Genetic algorithms
 
Genetic Algorithm
Genetic AlgorithmGenetic Algorithm
Genetic Algorithm
 
Genetic algorithm raktim
Genetic algorithm raktimGenetic algorithm raktim
Genetic algorithm raktim
 
Genetic algorithm_raktim_IITKGP
Genetic algorithm_raktim_IITKGP Genetic algorithm_raktim_IITKGP
Genetic algorithm_raktim_IITKGP
 
Evolutionary algorithms
Evolutionary algorithmsEvolutionary algorithms
Evolutionary algorithms
 
evolutionary algo's.ppt
evolutionary algo's.pptevolutionary algo's.ppt
evolutionary algo's.ppt
 
CI_L11_Optimization_ag2_eng.pptx
CI_L11_Optimization_ag2_eng.pptxCI_L11_Optimization_ag2_eng.pptx
CI_L11_Optimization_ag2_eng.pptx
 
Flowchart of ga
Flowchart of gaFlowchart of ga
Flowchart of ga
 
GA of a Paper 2012.pptx
GA of a Paper 2012.pptxGA of a Paper 2012.pptx
GA of a Paper 2012.pptx
 
BGA.pptx
BGA.pptxBGA.pptx
BGA.pptx
 

Kürzlich hochgeladen

Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Celine George
 
General AI for Medical Educators April 2024
General AI for Medical Educators April 2024General AI for Medical Educators April 2024
General AI for Medical Educators April 2024Janet Corral
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingTechSoup
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)eniolaolutunde
 
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...christianmathematics
 
9548086042 for call girls in Indira Nagar with room service
9548086042  for call girls in Indira Nagar  with room service9548086042  for call girls in Indira Nagar  with room service
9548086042 for call girls in Indira Nagar with room servicediscovermytutordmt
 
Class 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdfClass 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdfAyushMahapatra5
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxVishalSingh1417
 
IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...
IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...
IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...PsychoTech Services
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13Steve Thomason
 
Disha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdfDisha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdfchloefrazer622
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Krashi Coaching
 
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhikauryashika82
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphThiyagu K
 
Measures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDMeasures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDThiyagu K
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfJayanti Pande
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introductionMaksud Ahmed
 

Kürzlich hochgeladen (20)

Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17
 
General AI for Medical Educators April 2024
General AI for Medical Educators April 2024General AI for Medical Educators April 2024
General AI for Medical Educators April 2024
 
Mattingly "AI & Prompt Design: The Basics of Prompt Design"
Mattingly "AI & Prompt Design: The Basics of Prompt Design"Mattingly "AI & Prompt Design: The Basics of Prompt Design"
Mattingly "AI & Prompt Design: The Basics of Prompt Design"
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy Consulting
 
Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)
 
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
 
9548086042 for call girls in Indira Nagar with room service
9548086042  for call girls in Indira Nagar  with room service9548086042  for call girls in Indira Nagar  with room service
9548086042 for call girls in Indira Nagar with room service
 
Class 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdfClass 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdf
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptx
 
IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...
IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...
IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13
 
Disha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdfDisha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdf
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
 
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot Graph
 
Measures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDMeasures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SD
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdf
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introduction
 

Genetic Algorithms - Artificial Intelligence

  • 1. Genetic Algorithms • Introduction • Genetic algorithms and optimization techniques • Fitness function • Genetic operators • Case study: Job Shop Scheduling 1 1
  • 2. Introduction • Decision making is required in all fields including science & Technology, management etc. • Many traditional optimization procedures have been developed to solve problems like linear and nonlinear programming, inventory, assignment and scheduling problems •The main drawback of these traditional techniques is most of the time they may end up with local optima rather than global optima 2
  • 3. Introduction contd.. • Some non traditional search and optimization techniques include - Genetic Algorithms - Simulated Annealing - Ant Colony optimization etc. • The concept of GA is conceived by Prof. Holland of university of Michigan 3
  • 4. Introduction contd.. • Genetic Algorithms are techniques to solve complex problems. The basis of these techniques relies on the natural process of human evolution over a period of time 4 4
  • 5. Difference between Genetic Algorithm and traditional optimization techniques • GA works with a string coding of variables instead of variables; the coding discretizes the search space even for continuous functions but only appropriate coding of the problem can converge to a right solution • Since GA requires function values at discrete points, a discrete or discontinuous function can also be handled • GA operators find the similarities in string structures and hence may find the global best solution 5
  • 6. Difference between Genetic Algorithm and traditional optimization techniques contd.. • GA processes more than one string simultaneously and thus works with a population of solutions instead of one solution at a time; also previously found information is used efficiently in the next iteration • Since GA is population based search algorithm, multiple optimal solutions can be obtained without much effort • GA does not require any additional information except the object function value 6
  • 7. Difference between Genetic Algorithm and traditional optimization techniques contd.. • Many real world optimization problems are multimodal problems and GA can handle such problems - GA skips the local minimum (due to the probabilities used) and explores all the solution space and hence can reach the global minimum 7
  • 8. Theory of Darwinian Evolution • Chromosomes are the basis of creation of life • Every chromosome contains millions of genes • Every gene contributes to a phenotype – a specific feature or characteristic of the child such as the color of the eye, blood group etc. that are inherited from parents/ancestors 8 8
  • 9. Theory of Darwinian Evolution contd.. • Each gene for the blood type can have the values 0, 1, or 2 called alleles • A set of alleles form a gene-pair called genotypes For example for the blood group or phenotype A, the genotype is 01 or 11; for phenotype AB, the genotype is 21 9
  • 10. Theory of Darwinian Evolution contd.. • Some of the genes mutate (change the values from one to another randomly) due to exposure to chemicals, or biological effects • Over a number of generations of individuals, survival and reproduction are more predominant in the population 10 10
  • 11. Structure of Genetic algorithm G Generate e evaluate Optimization Best individuals y nInitial objective Criteria met? e epopulation s r function Result no start Selection Generate New Recombination population Mutation 11
  • 12. Steps in Genetic Algorithm • Genetic algorithms are based on the theory of selection 1.A set of random solutions are generated • Only those solutions survive that satisfy a fitness function • Each solution in the set is a chromosome • A set of such solutions forms a population 12 12
  • 13. Genetic Algorithms contd.. 2. The algorithm uses three basic genetic operators namely (i)Reproduction (ii)crossover and (iii) mutation along with a fitness function to evolve a new population or the next generation • Thus the algorithm uses these operators and the fitness function to guide its search for the optimal solution • It is a guided random search mechanism 13 13
  • 14. Significance of the genetic operators • Reproduction or selection by two parent chromosomes is done based on their fitness • Reproduction ensures that only the fittest of the solutions made to form offsprings • Reproduction will force the GA to search that area which has highest fitness values Crossover or recombination: Crossover ensures that the search progresses in the right direction by making new chromosomes that possess characteristics similar to both the parents 14 14
  • 15. Significance of the genetic operators contd.. Mutation: To avoid local optimum, mutation is used It facilitates a sudden change in a gene within a chromosome allowing the algorithm to see for the solution far way from the current ones 15 15
  • 16. Genetic operator: Reproduction • There are many techniques for Reproduction or selection operator 1. Roulette wheel selection 2. Tournament selection 3. Ranked position selection 4. Steady state selection 16
  • 17. 1. Roulette wheel selection • The circumference of Roulette wheel is divided into segments and marked for each string proportionate to the fitness value 6 1 20% 217% 11 5 19% 3 19 14% % • 4 • The wheel is spun n times; each time a segment is selected by the wheel pointer • The segment with highest fitness value will have more probability for selection 17
  • 18. Roulette wheel selection contd.. • In practice the procedure is as follows • The individual fitness values are mapped to contiguous segments of a line • Using fitness values of the string selection probability is computed using pi=Fi / ΣFj j=1,2, …,n 18
  • 19. Roulette wheel selection contd.. • Cumulative probability for each string is computed; the ith string in the population represents the cumulative probability from pi-1 to pi • A random number is generated and the string for which the random number lies in the cumulative probability range is selected for the mating pool • The process is repeated until the desired number of individuals (called mating population) is obtained 19
  • 20. Roulette wheel selection - Example Table 1.1: Strings and fitness values Number of 1 2 3 4 5 6 7 8 9 10 Individual Fitness value2.0 1.8 1.6 1.4 1.2 1.0 0.8 0.6 0.4 0.2 Total fitness =11.0 and 2.0/11.0= 0.181~0.18 Table1.2: Computations of probabilities Number of 1 2 3 4 5 6 7 8 9 10 Individual Selection 0.18 0.16 0.15 0.13 0.11 0.09 0.07 0.06 0.04 0.02 Probability Cumulative 0.18 0.34 0.49 0.62 0.73 0.82 0.89 0.95 0.99 1.01 Probability 20
  • 21. Roulette wheel selection – Example contd.. Selection Procedure: Let the six generated random numbers be 0.81, 0.32, 0.96, 0.01, 0.65, and 0.42 1 2 3 4 5 6 7 8 9 10 0.0 0.18 0.34 0.49 0.62 0.73 0.82 0.89 0.95 0.99 1.01 0.81 falls between 0.73 and 0.82;so string 6 is selected 0.32 falls between 0.18 and 0.34;so string 2 is selected 0.96 falls between 0.05 and 0.99;so string 9 is selected 0.01 falls between 0.00 and 0.18;so string 1 is selected 0.65 falls between 0.62 and 0.73;so string 5 is selected 0.42 falls between 0.34 and 0.49;so string 3 is selected Mating population after selection:1,2, 3,5, 6, 9 21
  • 22. Crossover or recombination • Crossover operator produces new offspring after combining the information contained in two parents • Crossover is performed with a crossover probability Pc • A random number say r is generated and compared with Pc • If Pc > r crossover occurs; otherwise the two strings are repeated without any change 22
  • 23. Crossover methods 1. Real valued crossover The following methods are used to get a new offspring from two parent strings 1.1 Discrete crossover 1.2 Intermediate crossover 1.3 Line crossover 2. Binary valued crossover The following methods are used to get a new offspring from two binary encoded strings of parents selected from mating pool 2.1 Single-point crossover 2.2 Multi-point crossover 2.3 Uniform crossover 2.4 Shuffle crossover 23
  • 24. Crossover or recombination • Crossover operator produces new offspring after combining the information contained in two parents • Crossover is performed with a crossover probability Pc • A random number say r is generated and compared with Pc • If Pc > r crossover occurs; otherwise the two strings are repeated without any change 24
  • 25. Binary valued Crossover-Single Point crossover Single Point crossover method • One crossover point is selected randomly between 1 and the number of bits in a chromosome • The bits are exchanged between the parents about this point (after this point) • Thus two new offspring are produced • Example: Consider two parents with 11 binary variables each Parent 1: 0 1 1 1 0 0 1 1 0 1 0 Parent 2: 1 0 1 0 1 1 0 0 1 0 1 Randomly selected crossover point 5 Offspring 1: 0 1 1 1 0 1 0 0 1 0 1 Offspring 2: 1 0 1 0 1 0 1 1 0 1 0 25
  • 26. Parents Offspring Figure 4. Single Point crossover 26
  • 27. Mutation • After crossover operation, the string is subjected to mutation operation • Mutation prevents falling all solutions of the population into a local optimum • Mutation operator alters a chromosome locally to create a better string • Mutation causes movement in the search space and restores the lost information in the population • Bit wise mutation is performed with a probability of mutation Pm • A random number r is generated and compared to Pm • If Pm > r , then mutation occurs; otherwise the bit is kept unchanged 27
  • 28. Importance of mutation • Mutation is used to maintain diversity in the population • Consider the following strings 1110 1001 1100 1000 All the four strings have 1 in the left most position ’If the optimum solution requires a 0 in the left most position, the selection or crossover operators will not change the bit The mutation operation will change its value 28
  • 29. Mutation methods 1. Binary valued Mutation - This is widely used encoding mechanism - In this real value of the variables are transformed to binary codes and the genetic operators work on these coded strings The bit-wise operators are as below 1.1 One’s complement operator 1.2 Logical Bit-wise Operator 1.3 Shift Operator 1.4 Swap Operator 1.5 Inverse Operator 2. Real valued Mutation 29
  • 30. One’s complement operator • This unary operator causes the bits of the string to be inverted; 1 becomes 0 and 0 becomes 1 • Example: String before mutation: 1100 1110 A random number r between 0 and 1 is selected and compared with mutation probability Pm If Pm > r , then mutation occurs; otherwise the bit is kept unchanged String after mutation : 0011 0001 with 1’s complement operator 30
  • 31. Job Shop Scheduling problem • Suppose there are three manufacturing units M1, M2 and M3, each of which is capable of manufacturing a different product • A schedule could be a set of numbers 20,35,15 where each number indicates the quantity of the concerned product manufactured by M1, M2, and M3 respectively • The schedule could yield a profit say 40 computed by some equation • The problem is to optimize (maximize) the profit • The function used to compute the profit is called the fitness function 31 31
  • 32. Job Shop Scheduling problem contd.. • The set {20,35,15} forms the chromosome; its members form the genes, Alleles are the values that these genes can assume • The problem can be simplified in terms of binary numbers by assuming a unit is ON (manufacturing) or OFF (not manufacturing) 32 32
  • 33. Job Shop Scheduling problem contd.. • A schedule { 1,0,1} yields a chromosome that indicates that M1 and M3 are on and M2 is off The fitness function could be the binary number formed from the individual genes in the chromosome; for example the schedule {1,0,1} has fitness of (101) 2 or decimal 5 The problem is to find the best schedule to maximize the value of the numbers formed by the genes comprising the chromosome The solution {1,1,1} could be found using genetic algorithm approach 33 33
  • 34. Using GA to solve Job Shop Scheduling problem 1. Represent a solution as a chromosome and find a suitable fitness function Define the chromosomes like {1,0,1}, {1,1,0} etc., and define the fitness function as f(chromosome) = (concat(Gene1,Gene2, Gene3))10 2. Choose a population of solutions and initialize it Let the population size N be 4; let the initialized population be [{0,0,1}, {0,1,0}, {1,1,0}, {1,0,1}] 3. Apply the genetic operators one by one 34 34
  • 35. Using GA to solve Job Shop Scheduling problem contd.. 3. Determine the fitness of each solution fi and the total fitness of the population ∑fi as follows Compute the normalized fitness or fitness probability pi, and the expected count of the solution (number of solutions that could occur) Ec The computed values are shown in Table 1. 35 35
  • 36. Using GA to solve Job Shop Scheduling problem contd.. Solution Solution fi=concat(Gen e1,Gene2, %pi=fi/ Ec=N*%pi No. Gene3))10 ∑fi *100 (N=4) 1 {0,1,0} 1 7.14 28.6 2 {0,1,0} 2 14.29 57.1 3 {1,1,0} 6 42.86 171.4 4 {1,0,1} 5 35.71 142.9 ∑ 14 100 400 Maximum 6 42.86 171.43 36 Table 1. Fitness and expected count of a generation
  • 37. Using GA to solve Job Shop Scheduling problem contd.. (b) Reproduction Four random numbers are generated to select four chromosomes for the next generation Let the random numbers be 265, 801, 515 and 85 Then the four chromosomes are selected based on the fitness probability and shown in Table 2. These four chromosomes are called the mating pool Table 2. Value generated Selected Solution 265 {1,1,0} 801 {1,0,1} 515 {1,1,0} 85 {0,0,1} 37
  • 38. Applying genetic operators Reproduction or selection operator is applied on the mating pool and two solutions are selected. There are {1,0,1} and {1,1,0} (c) Crossover is applied on {1,0,1} and {1,1,0} choosing crossing site 2 and the resultant chromosomes are {1,0,0} and {1,1,1} (d) Mutation occurs rarely. Mutation flips the value of a randomly selected gene in a chromosome For example the chromosome {0,1,0} could mutate to any of {1,1,0} or {0,0,0} or {0,1,1} 38
  • 39. Applying genetic operators • As we have not transgressed through many generations, assume that mutation will not occur • The resultant next generation population along with fitness function are shown in Table 3. resultant solution Si fi {0,0,1} 1 {1,0,0} 4 {1,1,1} 7 {1,1,0} 6 ∑ 19 Maximum 7 Thus the solution is {1,1,1} that has highest fitness value 39