Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
18 views10 pages

GA Ex 1

The document outlines the steps involved in a Genetic Algorithm to maximize the function f(X) for X values ranging from 0 to 31. It details the process of selecting population size, encoding type, parental chromosomes, crossover, mutation, and evaluation of offspring until a stopping criterion is met. Example calculations are provided to illustrate the selection and evaluation of chromosomes throughout the algorithm.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
18 views10 pages

GA Ex 1

The document outlines the steps involved in a Genetic Algorithm to maximize the function f(X) for X values ranging from 0 to 31. It details the process of selecting population size, encoding type, parental chromosomes, crossover, mutation, and evaluation of offspring until a stopping criterion is met. Example calculations are provided to illustrate the selection and evaluation of chromosomes throughout the algorithm.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 10

Genetic Algorithm

Example
Genetic Algorithm- Example
Maximize the function f(X) = , Where X value ranges from 0-31

Steps: Choose population size


1. Select Encoding Type
2. Choose population size
3. Randomly choose population
Let n=4
4. Select parental chromosomes
5. Crossover and Mutation  Randomly choose population
6. Evaluation of offspring
7. If stopping criteria not reached, Go to Step 4
Select Encoding Type Let it be 13, 24, 8 and 19

0 Binary Coding 31  Select parental chromosomes

0 0 0 0 0 1 1 1 1 1
Genetic Algorithm- Example
 Select parental chromosomes

String No. Initial X f(X) = Probability Expected Actual


Population Count Count Count
1 01101 13 169 0.14
=169/1170 =0.58
=169/293

2 11000 24 576 0.49


=576/1170 =1.97
=576/293

3 01000 8 64 0.06
= 64/1170 = 0.22
= 64/293

=1.23
=361/293
4 10011 19 361 =361/1170
0.31
Total 1170 1 Probability Count

Avg 293

1st Qtr 2nd Qtr 3rd Qtr 4th Qtr


Genetic Algorithm- Example
 Select parental chromosomes
String No. Initial X f(X) = Probability Expected Actual
Population Count Count Count
1 01101 13 169 0.14
=169/1170 =0.58 1
2 11000 24 576 0.49
=576/1170 =1.97 2
3 01000 8 64 = 64/1170
0.06 = 0.22 0
=361/1170 =1.23 Need to eliminate,
4 10011 19 361 0.31 1 since it is not selected
for rotation due to its
Total 1170 1 4 least value

Avg 293 Total number of


wheel turns
Genetic Algorithm- Example
 Step 5: Cross Over and Mutation
String No. Initial X f(X) = Probability Expected Actual
Population Count Count Count
1 01101 1
2 11000 2
3 01000 0
4 10011 1

String 2 11000 Parental String 2 11000 Parental


Combination 1 Combination 2
String 1 01101 String 4 10011
Genetic Algorithm- Example
 Step 5: Cross Over and Mutation
Next Generation
Child Chromosomes
String 2 1100 0
11001

String 1 0110 1 01100

String 2 11 000
11011
String 4 10 011 10000
Genetic Algorithm- Example
String No. Offspring X f(X) =

1 01100 12 144
2 11011 25 625
3 01000 8 64 Solution not improved

4 10000 16 256  Step 6: Mutation


String No. Offspring X f(X) =
Total 1089
1 01101 12 144
2 11001 25 625
3 11000 24 576
4 10000 16 256
Total 1601

You might also like