0% found this document useful (0 votes)
22 views2 pages

Genetic

The document outlines a genetic algorithm exercise involving the evaluation of fitness for a population of chromosomes, crossover operations, and the search for an optimal solution. It includes calculations for fitness based on specific functions and describes the processes of selection, crossover, and mutation for generating new populations. Additionally, it poses questions regarding the ability to reach optimal solutions without mutation and provides examples of fitness functions for further analysis.

Uploaded by

rocedo8037
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)
22 views2 pages

Genetic

The document outlines a genetic algorithm exercise involving the evaluation of fitness for a population of chromosomes, crossover operations, and the search for an optimal solution. It includes calculations for fitness based on specific functions and describes the processes of selection, crossover, and mutation for generating new populations. Additionally, it poses questions regarding the ability to reach optimal solutions without mutation and provides examples of fitness functions for further analysis.

Uploaded by

rocedo8037
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/ 2

Smart Systems – 2024/2025

Genetic Algorithm
Dr.Yasser Fouad

1) Suppose a genetic 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 initial population consist of four individuals with the following chromosomes:
x1 = 6 5 4 1 3 5 3 2
x2 = 8 7 1 2 6 6 0 1
x3 = 2 3 9 2 1 2 8 5
x4 = 4 1 8 5 2 0 9 4
a) Evaluate the fitness of each individual, showing all your workings, and arrange them
in order with the fittest first and the least fit last.

b) Perform the following crossover operations:


i) Cross the fittest two individuals using one–point crossover at the middle point.
ii) Cross the second and third fittest individuals using a two–point crossover
(points b and f).
iii) Cross the first and third fittest individuals using a uniform crossover.

c) Suppose the new population consists of the six offspring individuals received by the
crossover operations in the above question. Evaluate the fitness of the new population,
showing all your workings.

d) By looking at the fitness function and considering that genes can only be digits
between 0 and 9 find the chromosome representing the optimal solution (i.e. with the
maximum fitness). Find the value of the maximum fitness.

e) By looking at the initial population of the algorithm can you say whether it will be
able to reach the optimal solution without the mutation operator?
Smart Systems – 2024/2025
Genetic Algorithm
Dr.Yasser Fouad

2) Consider the following fitness function: fitness = 5a + 3bc – d + 2e, Compute the
fitness of each of the members of the initial populavion below.
a b c d e

1 1 0 1 1

0 1 1 0 1

1 1 0 0 0

1 0 1 1 1

1 0 0 0 0

Assuming the first two of members of the population are selected for reproduction, and
crossover the rest where crossover point is that between b and c, show the resulting
children.

3) Consider the following fitness function: fitness (bitstring) = number of 1’s in the
bitstring where both adjacent bits are 0’s. For example, fitness (“010110100”) = 2;
fitness (“100011011”) = 0; and fitness (“010101010”) = 4. (Notice that 1’s in the first or
last position in the string are not counted in the fitness function, even if adjacent to a 0.)
Assume the design of our genetic algorithm is:

a) Create an initial population containing 4 random 9-bit strings.


b) Discard the 2 least-fit ones (break ties randomly).
c) Do a single-point cross-over using the 2 most fit. The 2 children that result and
their parents constitute the next generation.
d) Randomly mutate 1 bit in 1 string in the population.
e) Go to step (b).

Start with the initial population and show what the next two (2) generations might
look like. Explain your reasoning.

You might also like