0% found this document useful (0 votes)
5 views4 pages

GA Numerical

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views4 pages

GA Numerical

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

Q1.

Q2. Suppose a gene c algorithm uses chromosomes of the form x = abcdefgh


with a fixed length of eight genes. Each gene can be any digit between 0 and 9.
Let the fitness of individual x be calculated as:
f(x) = (a+b)−(c+d)+(e+f)−(g+h)
and let the ini al popula on consist of four individuals with the following
chromosomes:
x1 = 65413532
x2 = 87126601
x3 = 23921285
x4 = 41852094
Find the following:
a) Evaluate the fitness of each individual, showing all your workings, and
arrange them in order with the fi est first and the least fit last.
b) Perform the crossover opera ons
c) Suppose the new popula on consists of the six offspring individuals
received by the crossover opera ons in the above ques on. Evaluate the
fitness of the new popula on, showing all your workings. Has the overall
fitness improved?
Ans1.
Ans.2. a)
f(x1) = (6+5)−(4+1)+(3+5)−(3+2)=9
f(x2) = (8+7)−(1+2)+(6+6)−(0+1)=23
f(x3) = (2+3)−(9+2)+(1+2)−(8+5)=−16
f(x4) = (4+1)−(8+5)+(2+0)−(9+4)=−19
The order is x2, x1, x3 and x4.
b)
i) Cross the fi est two individuals using one–point crossover at
the middle point.
Answer: One–point crossover on x2 and x1:
x2 = 8712 6601 ⇒ O1= 87123532
x1 = 6541 3532 ⇒ O2 = 65416601
ii) Cross the second and third fi est individuals using a two–
point crossover (points b and f).
Answer: Two–point crossover on x1 and x3
x1 = 65 4135 32 ⇒ O3= 65921232
x3 = 23 9212 85 ⇒ O4 = 23413585
iii) Cross the first and third fi est individuals (ranked 1st and
3rd) using a uniform crossover
Answer: In the simplest case uniform crossover means just a
random exchange of genes between two parents. For
example, we may swap genes at posi ons a, d and f of
parents x2 and x3:
x2 = 87126601 ⇒ O5= 27126201
x3 = 23921285 ⇒ O6 = 83921685
d) Suppose the new popula on consists of the six offspring
individuals received by the crossover opera ons in the above
ques on. Evaluate the fitness of the new popula on, showing
all your workings. Has the overall fitness improved?
Answer: The new popula on is:
O1 = 87123532
O2 = 65416601
O3 = 65921232
O4 = 23413585
O5 = 27126201
O6 = 83921685
Now apply the fitness func on f(x) = (a+b)−(c+d)+(e+f)−(g+h):
f(O1) = (8+7)−(1+2)+(3+5)−(3+2)=15
f(O2) = (6+5)−(4+1)+(6+6)−(0+1)=17
f(O3) = (6+5)−(9+2)+(1+2)−(3+2)=−2
f(O4) = (2+3)−(4+1)+(3+5)−(8+5)=−5
f(O5) = (2+7)−(1+2)+(6+2)−(0+1)=13
f(O6) = (8+3)−(9+2)+(1+6)−(8+5)=−6

The overall fitness has improved

You might also like