 Hello, everyone. The topic for my today's lecture is travelling sales person problem. At the end of the session, the students will be able to solve the travelling sales person problem using dynamic programming. First of all see the introduction. Now, dynamic programming can be applied to the subject selection problems like the 0 1 abstract problem and the permutation problems. The permutation problems are generally much harder to solve since for n number of objects there could be n factorial different permutations. Whereas, subset selection problems they have 2 raise to n different subset for n number of objects. Now, let us see the travelling sales person problem. We have a graph G equal to V comma E where V is a set of vertices and E is a set of edges and number of vertices is equal to n that is mod V equal to n and the number of vertices is greater than 1. So, we have more than 1 vertices in the graph. Now, C i j indicates the cost of the edge from i to j and C i j is generally greater than 0 for all values of i and j. For that edge i comma j if it does not exist in the set of edges E. So, C i j will be equal to infinity meaning C i j equal to infinity for the edge which is not existing from i to j. Now, a tour of the graph G is nothing but a directed simple cycle that includes every vertex in the set V and the cost of the tour is nothing but the sum of the cost of the edges on the tour. And our aim is to find the tour of minimum cost. The tour starts and ends at the vertex 1 and every tour has an edge from 1 to k where k belongs to V minus 1 and the path from vertex k to 1. Now, the path from vertex k to 1 it goes through each vertex in V minus 1 k exactly once. And the path from k to 1 will be the shortest path distance that goes from vertex k to all the vertices in V minus 1 k and ultimately reaches the vertex 1. So, this will be a shortest path distance from k to 1. So, thus the principle of optimality holds. Now, G of i comma s is the length of the shortest path that starts at vertex i and goes through all the vertices in the set s and terminates at vertex 1. Now, in this travelling salesperson problem our main aim is to find the value of the function G of 1 comma V minus 1 which will which is nothing but the length of the optimal salesperson tour. Now, simplifying the above equation it becomes G of 1 comma V minus 1 equal to minimum of C of 1 k plus G of k comma V minus 1 k for all the values of k ranging from 2 to n. For the vertices i that do not belong to set s G of i s will be equal to minimum of C of i j plus G of j comma s minus j where j belongs to the set s and G of i comma phi. Now, phi indicates an empty set G of i comma phi is equal to C i 1 meaning the cost of the edge from vertex i to 1 where i ranges from 1 to n. Now, this is the example figure 1 shows the directed graph and figure 2 shows the cost matrix. Now, the cost matrix the values are nothing but it could be either the cost or the length of the edge. For example, this value 10 indicates from vertex 1 to vertex 2 the cost is 10 units. Now, to find the optimal tour we have the formula G of i comma s equal to minimum of C of i j plus G of j comma s minus j where i does not belong to s. Now, we consider initially mod s equal to 0 meaning the set s consisting of no vertices that is s would be an empty set. So, G of 2 comma phi is nothing but cost of the edge from 2 to 1. So, 2 to 1 it is 5 G of 3 phi will be equal to C of 3 1 equal to 6 and G of 4 comma phi equal to C of 4 1 that is cost of the edge from vertex 4 to 1 equal to 8. Now, next we go for mod s equal to 1 meaning the set s consisting of 1 element. So, now G of 2 comma 3 will be equal to C of 2 3 plus G of 3 comma phi. Now, C of 2 3 is equal to 9 and G of 3 comma 5 as it is calculated above is equal to 6. So, 9 plus 6 equal to 15. Now, this G of 2 comma 3 having cost 15 is nothing but the path from vertex 2 to 3 and going from 3 to 1. Similarly, G of 2 comma 4 equal to C of 2 4 plus G of 4 comma phi which is nothing but equal to 10 plus 8 equal to 18. Next G of 3 comma 2 equal to C of 3 2 plus G of 2 comma 5 equal to 13 plus 5 equal to 18 and G of 3 4 equal to C of 3 4 plus G of 4 comma 5 equal to 12 plus 8 equal to 20. Now, next G of 4 comma 2 equal to C of 4 2 plus G of 2 comma 5 equal to 8 plus 5 equal to 13 and finally, G of 4 comma 3 equal to C of 4 3 the cost of the edge of the edge from 4 to 3 plus g of 3 comma 5. Now this is equal to 9 plus 6 equal to 15. These are the values calculated till now. Now we go for mod s equal to 2 meaning the set s consisting of 2 vertices. So, we now calculate first g of 2 comma 3 4 which is nothing but equal to minimum of c of 2 3 plus g of 3 comma 4 comma c of 2 4 plus g of 4 comma 3 equal to minimum of 9 plus 20 comma 10 plus 15 equal to 25. Now this value 25 has come from this part and this is nothing but c of 2 4 plus g of 4 comma 3. So, this is nothing but as shown in the diagram cost of the edge from vertex 2 to 4 and then the further part. So, this value of 25 is nothing but the cost of the path from 2 to 4 4 to 3 and finally 3 to 1. Now next, now the students are expected to think and write the answer to the following question. Calculate the values of g of 3 comma 2 4 and g of 4 comma 2 3. Now pause the video and write your answer. Ok, similar to how we calculated g of 2 comma 3 4, we will now calculate g of 3 comma 2 4 is equal to minimum of c of 3 2 plus g of 2 4 comma c of 3 4 plus g of 4 2 equal to minimum of 13 plus 18 comma 12 plus 13 equal to 25. Now this 25 comes from this part which is nothing but c of 3 4 plus g of 4 comma 2. So, now 3 to 4 4 to 2 and 2 to 1. So, this path has length 25. Now next g of 4 comma 2 3 equal to minimum of c of 4 2 plus g of 2 comma 3 comma c of 4 3 plus g of 3 comma 2 which equals minimum of 8 plus 15 comma 9 plus 18 equal to 23. Now this 23 has come from this part this is nothing but cost of 4 2 plus g of 2 comma 3. So, 4 to 2 2 to 3 and 3 to 1 this path has cost 23. So, these are the 2 answers of the question which was asked. Now next we go for mod s equal to 3 meaning the set s consisting of 3 vertices. So, now we have g of 1 comma 2 3 4 which is equal to minimum of c 1 2 plus g of 2 comma 3 4 comma c of 1 3 plus g of 3 comma 2 4 comma c of 1 4 plus g of 4 comma 2 3 which equals minimum of 10 plus 25 comma 15 plus 25 comma 20 plus 23 and the answer is 35. Now this 35 has come from this value and this value is nothing but c of 1 2 plus g of 2 comma 3 4 meaning the path from 1 to 2 then 2 to 4 4 to 3 and 3 to 1. So, this path has the value 35 or the cost 35. So, in this way we have calculated a tour that starts from vertex 1 goes to the vertex 2 4 and 3 respectively and ultimately reaches vertex 1. So, this is nothing but the optimal sales person tour. So, the optimal sales person tour is going from vertex 1 to 2 then to 4 then to 3 and finally, coming back to vertex 1. So, this is the reference for the video lecture. Thank you.