$29.99
Description: For this assignment, you will write a short Python program that gathers a
data element from each of a number of data files. It will then determine the minimum
and mean values for that data element and report them. The data represent runs of
a traveling salesman algorithm. The data element we want to evaluate represents the
length of the shortest path found during a run of the algorithm. Our goal, is to find
the overall minimum and mean for a large number of runs of the algorithm.
Details: The zipped file you downloaded includes this assignment writeup and a directory
called datafiles that includes approximately 100 directories. Each directory has a
name of the form run.xxx, where xxx is an integer. You cannot depend on those
integers being consecutive. Within each directory, there are several files. The file we
are interested in has the name run.xxx.runbest, where xxx is the same integer as in
the directory name.
Each runbest file contains a single line. Reading that line gives you a string. From
that string, you must access the minumum distance, which is preceded by F. Here is
an example line from one of the files:
G 1265 I 5091 L 55 F 79666.000 -1.000 ( 0, 7935) 5 4 18 50 47 15 32 12 11
10 36 35 51 1 40 41 42 16 7 34 9 8 33 20 26 0 28 27 29 30 38 17 37 31 24
21 25 39 49 3 48 2 13 6 54 19 52 53 23 22 43 46 45 44 14
In this example line, the value of interest is 79666.0. The rest of the line is not relevant
for this assignment.
Your program should produce concise, easy-to-read output that conveys all required
information: number of runs represented, minimum value, and mean value.
1
Adhere to common coding conventions and comment your code.. Include a comment
at the top that looks like this:
#
# Assignment 1
#
# This program performs simple analysis of a data element across a
# large number of data files representing runs of a traveling salesman
# algorithm.
#