You are on page 1of 5

1

SCJ 3553 Artificial Intelligence



Assignment (Genetic Algorithm)

Name : Matric No. :

Question 1

A population of 6 chromosomes as shown in Table 1 has been generated in order to perform the GA
operations. Binary encoding scheme was applied in this question as shown in Figure 1. Table 2 shows
the integer coded in binary form. Assume that Generational update was performed by replacing all the
parents from previous generation. Find the maximum value of the function x
2
+ y
2
, where parameter x
and y varies between 0 and 15.



Figure 1 Example of Chromosome

Table 1 Chromosome Generated

Parent Chromosome Fitness
A 0 0 1 0 0 1 0 1 29
B 0 1 1 1 0 0 0 1 50
C 1 0 1 1 0 0 1 1 130
D 1 0 0 1 1 1 0 0 225
E 1 0 1 0 1 0 0 0 164
F 0 1 0 0 0 1 1 0 52

Table 2 Integer coded in binary form.









x x x x y y y y
Integer Binary Integer Binary Integer Binary
1 0001 6 0110 11 1011
2 0010 7 0111 12 1100
3 0011 8 1000 13 1101
4 0100 9 1001 14 1110
5 0101 10 1010 15 1111
2

(a) Find the solution produced by the 2 parents after Crossover operation, where single point
crossover was performed at bit number 4.
(i) A and D
(ii) B and E
(iii) C and F

(b) By using result from (a), find the solution produced after mutation operation, where flipping
mutation was performed
(i) At bit 1.
(ii) At bit 6.
(iii) At bit 4.

Q Child (a) Chromosome (b) Chromosome
(i)
P
(A and D)

Q
(A and D)

(ii)
R
(B and E)

S
(B and E)

(iii)
T
(C and F)

U
(C and F)


(c) By using the result from (b), evaluate the fitness for each child.

Chromosome
Chromosome
String x
Decoded
Integer
Chromosome
String y
Decoded
Integer
Fitness
Fitness
Ratio
(%)
Cumulative
Fitness
Ratio (%)
P
Q
R
S
T
U
Total -




3

(d) Based on the result in (c),


(i) Which children contain the best fitness and what is the value for parameter x and y?

(ii) If elitism was performed by selecting 2 parents from the previous generation,
(1) Which parent should be selected? Why?

(2) Which child should be replaced? Why?

(e) Based on your opinions, is it possible that all 6 children will contain the same chromosome
structure after 2000 iterations were performed? Why?




Question 2
(a) By using GA Toolbox, perform the experiment below.

Fitness function: @rastriginsfcn
Number of variables: 3
Lower Bounds: Default
Upper Bounds: Default
Population type: Double vector
Population size: 100
Creation function: Constraint dependent
Scaling function: Rank
Selection function: Roulette
Crossover fraction: 0.7
Mutation function: Uniform
Rate: Default
Crossover function: Single Point
Generation: 100
Stall Generation: 100








4

Record your 10 times testing results in the table below.


No. Parameter 1 Parameter 2 Parameter 3 Fitness Value
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
Average

(b) Which is the most optimum result for this testing?

(c) What is the most optimum values for Parameter 1, 2 and 3 based on the result shown in (a)?
Parameter 1: Parameter 2: Parameter 3:

(d) Perform another experiment by using setting below:

Fitness function: @rastriginsfcn
Number of variables: 3
Lower Bounds: Default
Upper Bounds: Default
Population type: Double vector
Population size: 100
Creation function: Constraint dependent
Scaling function: Rank
Selection function: Tournament
Tournament size: Default
Crossover fraction: Default
Mutation function: Uniform
Rate: Default
Crossover function: Two Points
Generation: 100
Stall Generation: 100



5

Record your 10 times testing results in the table below.


No. Parameter 1 Parameter 2 Parameter 3 Fitness Value
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
Average

(e) Which is the most optimum result for this testing?

(f) What is the most optimum value for Parameter 1, 2 and 3 based on the result shown in (d)?
Parameter 1: Parameter 2: Parameter 3:

(g) Which parameters setting performed better based on the result in (a) and (d)? Why?



(h) What will happen to the average of fitness when number of testing is increased?



Due date: Week 14 23/5/2013 (Thursday) 12.00 pm
Submit in hardcopy format to N28-Level 4-429-01.
No late submission.

You might also like