Midterm2019 2020
Midterm2019 2020
Simple_Genetic_Algorithm()
{
Initialize the Population;
Calculate Fitness Function; // Evaluate Individuals …
b) [10 marks] State five different representation (encoding) used in a Genetic algorithm and
Discuss how the different representations affect the other operators mainly crossover and
mutation operators.
Binary (Gray) encoding, Integer encoding, character (String) encoding, floating point
encoding, Permutation encoding.
Binary (Gray), Integer, and character (String) encoding have no effect on Mutation or
Crossover but floating point encoding affects on Mutation (Uniform/Non-Uniform Mutation),
and Permutation encoding affects on Mutation(Swap Mutation) and affects on Crossover
(Order1 Crossover).
Page | 1
d) [10 marks] How to apply the Roulette Wheel Selection and Tournament Selection for:
i. The best individuals have the lowest fitness
Roulette wheel Selection: uses the 1 - fitness or 1/fitness portion in selection
Tournament Selection: selects the individual with minimum fitness
e) [10 marks] The following chromosome has eight genes with values in range [-5,5], Show the
chromosome after performing a uniform mutation on the fourth gene, knowing that the
random numbers generated for the operation: r1 = 0.3, r2 = 1.7.
∆L ∆U
2.3 -1.1 4 0.8 -2 3.1 1.4 4.9
Page | 2
Question 2: Genetic Programming [20 marks]
A program uses genetic programming for solving a problem where an example individual of the
population is: (x true) ((x false) (¬z → (x y)))
a) [5 marks] Represent the individual as a parse tree.
x true →
x false ¬
z x y
b) [5 marks] State the function and terminal sets presented in this individual.
c) [5 marks] Mention two differences between Genetic Programming and Genetic Algorithm
chromosomes.
1. In GA, chromosomes are linear structures (bit strings, integer string, permutations)
But GP uses tree shaped chromosomes which are non-linear structures.
2. In GA, the size of the chromosomes is fixed but Trees in GP may vary in depth and
width.
Find the crisp value of quality given size= 2 and weight =25
Page | 3