Question: Deliverable A program: import java.io . File; import java.io . FileNotFoundException; import java.util.Scanner; public class GraphCycle { public static void main ( String [ ]
Deliverable A program:
import java.ioFile;
import java.ioFileNotFoundException;
import java.util.Scanner;
public class GraphCycle
public static void mainString args
int distanceMatrix;
int numCities;
Step : Read and Parse the File
try
File file new FileUserssaidwDesktopFatxt;
Scanner scanner new Scannerfile;
numCities scanner.nextInt; Read number of cities
distanceMatrix new intnumCitiesnumCities;
Fill the distance matrix
for int i ; i numCities; i
for int j ; j numCities; j
distanceMatrixij scanner.nextInt;
scanner.close;
catch FileNotFoundException e
System.out.printlnFile not found.";
return;
Step and : Calculate the Hamiltonian Cycle Path and Distance
int totalDistance ;
System.out.printPath: ;
for int i ; i numCities; i
System.out.printi ;
if i numCities
totalDistance distanceMatrixii ;
else
totalDistance distanceMatrixi; Return to start
System.out.println
Total Distance: totalDistance;
Start with your ideally working submission of Deliverable A Read a file of the name Fbtxt This is a file of distances between cities in which the value of each city is a floating point number that lists either the latitude or longitude of each city.
Using the algorithm one or both of the papers on bitonic tours that is in DL BitonicTour Paper Reference One andor BitonicTour Paper Reference Two find the shortest bitonic tour going from the highest value to the lowest value, then back to the highest value for each set of cities
A bitonic tour is a Traveling Salesperson Tour Deliverable A was a Traveling Salesperson problem where you start at a given city, visit every other city in order exactly once and go back home Deliverable B is a more complex Traveling Salesperson Tour in which you start with a city at one end say most northerly or westerly go in one direction southeast to the most southerlyeasterly city maybe visiting cities along the way and return home visiting every unvisited city southtonortheasttowest on the way back.
The prog handout describes the format of the input file for this and all program deliverables.
As will always be the case in this class, the program must be written in Java and must run on the University Windows computer systems. To ensure this I strongly recommend that you:
Use only Oracle Java SE constructs, and
Test it on the University systems before submission if you have any doubts about its ability to run on the University Windows.
Submit the Java source code to the open Deliverable B submission folder. Submit your code as an Eclipse package or submit all the java source files in a zipped archive, and in addition all java source files as text file yes both ways plus screen shots proving your code runs. You need not include test files.
Algorithm:
The bitonic tour algorithm is described in the two bitonic tour papers uploaded under Program in DL Use whichever algorithm you find easiest to understand theyre essentially similar and will give identical results
Output:
The input will be a table of distances representing a graph, like the one below. The largest graph I will test with will have cities.
~ val C D F M N S W
Chicago ~
Denver ~
FortWorth ~
Minneapolis ~
Nashville ~
SaintLouis ~
Winnipeg ~
Yields output:
Shortest bitonic tour has distance
Tour is W M C S N F D W
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
