Question: ( C ) Implement Complete the implementation of the function k _ tsp _ mtz _ encoding , cost _ matrix ) below. It follows

(C) Implement
Complete the implementation of the function k_tsp_mtz_encoding , cost_matrix) below. It follows the same input convention as the code supplied
in the notes. The input n denotes the size of the graph with vertices labeled 0,dots,n-1,k is the number of salespeople, and cost_matrix is a list of lists
wherein cost_matrix[i][j] is the edge cost to go from i to j for ij. Your code must avoid accessing cost_matrix[i][i] to avoid bugs.
These entries will be supplied as None in the test cases.
Your code must return a list 1 st that has exactly k lists in it, wherein 1 st [j] represents the locations visited by the jth salesperson.
For the example above, for k=2, your code must return
[0,2,1,4],[0,3]
For the example above, for k=3, your code must return
[0,1,4],[0,2],[0,3]
In [13]: from pulp import *
def k_tsp_mtz_encoding(n,k, cost_matrix
 (C) Implement Complete the implementation of the function k_tsp_mtz_encoding , cost_matrix)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!