Soft Computing Techniques
Week-06 Assignment-06 (Solution)
1. 5, range is 4.99 to 5.01. Given function is f (x) = (x − 4)2 and x ∈ [0, 31], ϵ = 1.0. Also, we have,
b−a
2n − 1 ≥
ϵ
31 −0
=⇒ 2n − 1 ≥
1
=⇒ 2n ≥32
=⇒ n ≥ 5
which gives n = 5.
2. (c). For the given data we have,
Population Fitness value
2 f (2) = (2 − 4)2 = 4
7 f (7) = (7 − 4)2 = 9
11 f (11) = (11 − 4)2 = 49
30 f (30) = (30 − 4)2 = 676
31 f (31) = (31 − 4)2 = 729
Since we have to minimize the given function, so 2 is the fittest.
3. (b). 2 and 7 are represented by 00010 and 00111, when we apply one-point crossover at the third
location we get,
2 :000|10
7 :001|11
O1 :000|11
O2 :001|10
4. (a). The phenotypes will be given by,
00011 = 21 + 20
=⇒ 00011 = 3
00110 = 22 + 21
=⇒ 00110 = 6
5. (d). 2 and 11 are represented by 00010 and 01011, when we apply one-point crossover at the second
location we get,
2 :00|010
11 :01|011
O3 :00|011
O4 :01|010
6. (a). The phenotypes will be given by,
00011 = 21 + 20
=⇒ 00011 = 3
01010 = 23 + 21
=⇒ 00110 = 10
7. (d). Given the fitness function f (x) which is equal to numbers of ones in the bit string x, so for the
given population we have,
Population Fitness value
0000 1111 4
0001 1001 3
0010 1011 4
0011 1110 5
4+3+4+5
8. (b). We know that the average value is given by, Average = 4 =4
So, we get
Fitness value
Population Fitness value Expected count = Average
4
0000 1111 4 4 =1
3
0001 1001 3 4
4
0010 1011 4 4 =1
5
0011 1110 5 4
9. (d). The sum of the population is,
Sum = 4 + 3 + 4 + 5
=⇒ Sum = 16
So, the selection probability is
Fitness value
Population Fitness value Selection Probability = Sum
4
0000 1111 4 16 = 0.25
3
0001 1001 3 16 = 0.1875
4
0010 1011 4 16 = 0.25
5
0011 1110 5 16 = 0.3125
10. 0.10, range is 0.09 to 0.11.
We have the binary encoded value of chromosome 01100101 which is,
01100101 = 26 + 25 + 22 + 20
=⇒ 01100101 = 101
Let X = 101 ∈
/ [0, 25.5], so we will use a formula to make X lie inside the given interval, given by
n b−a o
x=a+ X
2n − 1
Here, we have 8 bits =⇒ n = 8 and the given interval is [0, 25.5] =⇒ b = 25.5 and a=0. Then the
above formula becomes,
n 25.5 − 0 o
x=0+ × 101
28 − 1
n 25.5 o
x= × 101
255
=⇒ x = 10.1
Now, the functional value at x = 10.1 is given by,
200
y = 0.1x2 +
x
200
=⇒ y = 0.1 × (10.1)2 +
10.1
=⇒ y ≈ 30
Then the expected count of the given chromosome is,
y
E.C. = P
yi
30
=⇒ E.C. =
300
=⇒ E.C. = 0.1