Faculty of Computers and Artificial Intelligence-
Cairo University
Midterm Exam
Course Name: Soft Computing/ Genetics algorithms Date: 23-11-2022
Course Code: CS464 Duration: 1 hour
Instructor : Dr. Samar Hesham Total marks: 20
Question one:
Crossover and mutation are the main operators of a Genetic Algorithm.
a- Differentiate between single-point and multiple-point crossover, on both binary and floating point
representations. [2 marks]
Single point multi point
b- Show by example- using binary strings- how can a 2-point crossover be carried out.[ 1 mark}
c- Explain the operation of the mutation operator on both binary and floating point representations. [3
marks]
Binary
Chromosome = bits[1…L]
for(i=1 to L)
{ Generate Random number ri ϵ [0, 1]
if(ri ≤ Pm)
flip bit[i]
elseif(ri > Pm)
1
no change to bit[i] }
floating point (either uniform or non uniform mutation is accepted)
Question two:
a. According to the schema theorem, what happens to highly fit schemata in successive generations?
What are the effects of selection, crossover and mutation according to the theorem?
Why use crossover and mutation?[3 marks]
Answer:
2
3
Probability of survival schema after xover
Probability of survival schema after mutation
4
Why xover and mutation
X over is for Exploration: Discovering promising areas in the search space,
i.e. gaining information on the problem
Mutation is for Exploitation: Optimizing within a promising area, i.e. using information
Question three:
a. Discuss whether there is survival of the fittest in a generational GA. [explain your answer] [2 marks]
No, survival of the fittest won’t happen in generational replacement as we create enough individuals to
generate pop_size offspring ,each individual survives for exactly one generation and the entire set of
parents is replaced by the offspring.
Question four:
a. Given a population of PopSize Individuals, which are bit-strings of length L. Let the frequency of
allele 1 be 0.3 at position i, that is 30% of all individuals contains a 1 and 70% a 0. How does this
allele frequency change after performing k crossover operations with one-point crossover?[2 marks]
Using only Crossover will not change frequency of the allele only mutation can change the
frequency
b. Calculate the probability that a binary chromosome with length L will not be changed by applying
the usual bit-flip mutation with Pm=1/L.[1 mark]
1-1/L
Question five:
5
a. Assume we want to maximize the following function
F(x)= x4+x2+10 for the range x€[0,63]. Design the system with popsize=4 and preform GA operators
until reaching Generation 1. ( put your assumptions).[3 marks]
The student will initialize any four binary chromosomes with size = 6 and
Preform GA operators
Applying fitness function at G0
Selection ( both tournament and roulette wheel accepted)
Xover ( single or multi point are accepted)
Mutation
Using the initialized chromosomes
b. Using examples ,discuss the crossover and mutation operators in Genetic programming.[3 marks]
Mutation
6
7