Genetic Algorithm Example

476 views
408 views

Published on

Published in: Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
476
On SlideShare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
20
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Genetic Algorithm Example

  1. 1. GENETIC ALGORITHM EXAMPLEAuthor: Kasun Ranga WijeweeraEmail: krw19870829@gmail.com(TOTAL MARKS = 30)Suppose we want to maximize the number of ones in a string of 10 binary digits.a) What is the best possible string? (5 marks)1111111111 (5 marks)b) How much number of strings can be generated for this problem? (5 marks)210= 1024 (5 marks)Now we are going to apply genetic algorithms to solve this problem. We toss a fair coin 60 timesand get the following initial population.s1 = 1111010101s2 = 0111000101s3 = 1110110101s4 = 0100010011s5 = 1110111101s6 = 0100110000c) Suggest an appropriate fitness function (5 marks)F (s) = Number of 1s in the binary string s (5 marks)d) Evaluate the fitness of each individual (6 marks)F (s1) = 7 (1 marks)F (s2) = 5 (1 marks)F (s3) = 7 (1 marks)F (s4) = 4 (1 marks)F (s5) = 8 (1 marks)F (s6) = 3 (1 marks)
  2. 2. Suppose that after performing selection, we get the following population.s1` = 1111010101 (s1)s2` = 1110110101 (s3)s3` = 1110111101 (s5)s4` = 0111000101 (s2)s5` = 0100010011 (s4)s6` = 1110111101 (s5)e) Apply single point cross over for the couples (s1`, s3`) and (s2`, s6`) at the points 3 and 6respectively (6 marks)For couple (s1`, s3`):s1`` = 1110111101 (1.5 marks)s3`` = 1111010101 (1.5 marks)For couple (s2`, s6`):s2`` = 1110111101 (1.5 marks)s6`` = 1110110101 (1.5 marks)f) Mutate the derived population with 0.1 probability (3 marks)Derived population,s1`` = 1110111101s2`` = 1110111101s3`` = 1111010101s4`` = 0111000101s5`` = 0100010011s6`` = 1110110101Note: Select 6 (= 10 * 6 * 0.1) random digits and perturb. (0.5 * 6 marks). Following is justan example.
  3. 3. s1``` = 1111111101s2``` = 1100111101s3``` = 1111000101s4``` = 0111000001s5``` = 0000010011s6``` = 1110100101

×