You are given a set of instances of the (symmetric) Travelling Salesman problem downloadable on Moodle. Each instance is a text file (with the format described below)giving you a number of “cities” n as well as integer-valued distances between them. Thedistances are symmetric, i.e., the distance d(i, j) from city i to city j is the same asthe distance d(j, i) from city j to city i. However, do note that the distances do notnecessarily fulfill the triangle inequality.A solution to the travelling salesman problem is a tour, i.e., a permutation of the citiesc1, . . . , cn (so that {c1, . . . , cn} = {1, . . . , n}). The length of a tour is given by
nX−1∑ d(ci, ci+1) + d(cn, c1)i=1
we are looking for tours whose length is as short as possible.The instances will be given to you in the following format (where angled brackets denote placeholders for values of a given type):
NAME = <name of instance : string>, POINTS = <number of cities n : integer>,<d(1, 2), d(1, 3), . . . , d(1, n), d(2, 3), . . . , d(2, n), . . . , d(n − 1, n) : list of integers> ,
Commas are used as delimiters; spaces, tabs, newlines, etc. should be ignored. Hence, afile might look like this:
NAME = sample, SIZE = 5, 3, 4, 3, 4, 5, 6, 5, 5, 8, 5,
solution format is like this :
NAME = sample, TOURSIZE = 5, LENGTH = 24, 2,3,1,5,4