Commp6560 2022

You might also like

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 3

comp6560_2022

1(i). The selection method in a Genetic Algorithm can be used to controlthe exploration and
exploitation properties of the search.
True – their should be a balance between exploration and exploitation. This can be used to control
the search properties. Exploration width of the search guarantees that different regions of the search
are visited.

1(ii). Performing a crossover between 2 identical individuals will result in different offspring.
False – A crossover between two identicals individuals will result into two different new offsprings.
A swap in genetic material is based on a random crossover point. This occcurs on both parents by
exchanging this gene points and results to two child individuals.

1(iii). The best individual fitness value of a generation can be lower than the previous generation.
False – GA search algorithm aims at obtaining optimised values and also learning. It follows the
evolutionary analogy of “survival for the best”. The search is guided by a fitness function, candidate
solutions which are good are used to generate others. This function is ensures that candidates
selected are higher than the individual fitness value so as to ensure a better mutations.

1(iv). The individual selected as a winner in a tournament selection is chosen at random


False - in computer science there is no such thing as generating a random. Their has to be a
function or mathematical expression that will be used to generate a random number.

1(v). Genetic Algorithms guarantee finding the optimal solution for a given
problem.
True – This is due to the fact that GA is considered a technique for function optimisation. The
structure of the function is already known and GA is used to try and find optimal values for the
function.

(b) Given the following 2 individuals of a Genetic Programming population.


(I) Perform a subtree crossover between Individuals 1 and 2, showing
the resulting offspring (2 individuals)

or +

b < b b

< 10 10
b 10 10
(ii) Perform a subtree mutation on Individual 1 using the node ‘<’ as the
mutation point, showing the resulting offspring (1 individual)

<

b b

b b

(iii) Create a new individual using a full initialisation method and a


maximum tree depth of 3.

2(a) Consider the problem of finding the shortest path in a city map starting from a point A and
terminating at a point B. Is this a travelling salesman problem (TSP)? Justify your answer, also
referring to the computational complexity of the problem.
Yes this is a travell salesman problem. This is because the said problem involves a start point and a
goal destination. Their are numerous ways of getting from the start to the goal. Each of this paths
have different cost even though all of them achieve the same goal. In order to find the shortest path
the travelling salesman algorithm can be used. In terms of complexity we talk about time
complexity. We are actually creating all the possible extenstions of E-nodes in terms of tree nodes.
Which is nothing but a permutation. Suppose we have N cities, then we need to generate all the
permutations of the (N-1) cities, excluding the root city. Hence the time complexity for generating
the permutation is O((n-1)!), which is equal to O(2^(n-1)).

(b) (i) Consider the following 5-city TSP problem illustrated in Figure A. The edges of the graph
correspond to the distance between the cities. What is the cost of the dashed tour (i.e. the tour 1-2-3-
4-5-1)?
current tour: 1-2-3-4-5-1
cost :1+6+2+1+2= cost 12
b(ii) Is there any better solution (tour) to improve the cost calculated in (i)? Indicate the tour, the
cost and justify why this is a better solution with respect to the previous tour.
Shortest tour = 1-2-5-1
cost = 1+1+2=4
c) (i) Consider the following 5-city TSP problem illustrated in Figure B. The edges of the graph
correspond to the distance between the cities. Explain what are the main differences compared to
the TSP problem presented in Figure A?
The main difference between the two is the fact that in the first one moveent takes place in both
ways from any point to another. while in the second one there is a difference in cost for moving
from point 5-4 which costs 1 and from point 5 – 4 which costs 2. This makes the figure b an
asymmetric TSP. Their is also a path in figure b that only supports movement in one direction. This
is moving from point 4 to point 3. Their is no path for point 3 to point 4.

(ii) Write a viable tour and its related cost for the TSP problem in Figure B
A viable tour in figure b has to be the distance 1-2-5-1. This path will is the most viable because it
has the lowest cost on the traveller. The cost for this will add to 4. Which is the cheapest route

d (i) Consider a Genetic Algorithm implementation to solve a TSP problem. Is the binary
representation a good choice for the individual representation? Justify your answer.
This approach is not recommended for solving TSP. A GA approach for the TSP with a binary
representation and classical operators.The illegal tours are evaluated on thebasis of complete tours
created by a greedy algorithm. The results will be high in quality however there is a limitation. Only
100 cities can be used in this test case.
d(ii) provide an example of an idividual representation for the tour in figure A (tour 1-2-3-4-5-1)
jusify choice
graph representation - basic components of GP and terminal set variables and constants
and function set functions appropriate for solving the problem.example below

1 3 5
2
4 1

D (iii)Describe a suitable mutation operator and apply mutation to the individual from (ii).
simple inversion mutation this refers to when different points merge during mutation to form a single new individual.
Example: (1 2 |3 4 |5 1)
new tour becomes (123451)

You might also like