Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask Java Expert


Home >> Java

Traveling Salesman Problem (TSP)

Given a set P of points (e.g., a bunch of cities) and pairwise "distances" between these points, the Traveling Salesman Problem (TSP) seeks to find a shortest tour that starts from a point and visits every point exactly once and returns to the starting point. TSP is computationally very difficult; the fastest algorithms for this problem run in exponential time and there are reasons to believe that faster algorithms do not exist for TSP. A special case of TSP is the metric TSP problem in which distances satisfy the triangle inequality, i.e., for any three points p1, p2, p3, distance(p1, p3) ≤ distance(p1, p2)+distance(p2, p3). Even metric TSP is computationally difficult, but there are good approximation algorithms for metric TSP. In this homework you are required to implement a simple 2-approximation algorithm for metric TSP that is based on computing an MST.

Experiments

1. Report the following statistics on the execution of Boruvka's algorithm on the input graph:

(i) how many iterations does the algorithm take and (ii) what is the size of the smallest connected component at the end of each iteration. Recall that Boruvka's algorithm comes with the guarantee that in each iteration, the size of the smallest component, at least doubles. In practice, the size of connected components can grow much more quickly than this guarantee suggests. The point of this experiment is to understand this issue.

2. As we saw in class, the asymptotic performance of Kruskal's algorithm relies on the perfor- mance of the implementation of the Disjoint Set Union Find data structure.

If you implemented this data structure as a reverse tree with Union by depth, then the depth of the deepest tree associated with a component is a good measure of the performance of this data structure. So in this case, report the maximum depth of a reverse tree after each iteration. Note that this quantity is 1 after the first iteration of Kruskal's algorithm and it will typically remain unchanged for a number of iterations and then increase by 1.

If you implemented the Disjoint Set Union Find data structure as a shallow threaded tree with union by size, then the maximum number of times the "leader" pointer of a node is changed is a good measure of the performance of the data structure. So in this case, report the maximum number of times the "leader" pointer of a node is changed after each iteration. Note that this quantity is 1 after the first iteration of Kruskal's algorithm and it will typically remain unchanged for a number of iterations and then increase by 1.

It seems best to report these statistics in a plot with the x-axis being the iteration index and the y-axis being the measure of the data structure performance being reported.

3. Output the 127 edges in the computed MST and the weight of the computed MST.

4. After transforming the computed MST into a Traveling Salesman Tour, output the tour and its weight. So you're being asked to output the Traveling Salesman tour prior to using the 2-OPT and 3-OPT local search heuristics to improve the tour.

5. Output the Traveling Salesman Tour and its weight after using the 2-OPT local search heuris- tic.

6. Output the Traveling Salesman Tour and its weight after using the 2-OPT and 3-OPT local search heuristics.

What to Turn in

You are expected to turn in two items for this homework.

1. A single file named hw8.ext containing all your code. The extension ".ext" will of course depend on the programming language you use. Your code should be extensively documented. For example, functions should be preceded by comment blocks that tell the reader what the purpose of the function is, variable names should be suggestive of their purpose, etc. The file should also start with a listing of any bugs or issues with your code, sources you used, etc. You are not allowed to share code with classmates, but it is okay to use code available on the web, with appropriate attribution. For example, you might find it convenient to use a class that implements the max-heap data structure. This is fine, provide you carefully acknowledge your source. We will set up a dropbox on ICON for you to upload your code file. This needs to be done before class time on Tue, April 18th .

2. A single pdf file named hw8.pdf containing the results of all your experiments. You should upload this file onto the ICON dropbox and bring a printout to class on Tue, April 18th. This document should be well-formatted, should contain clear and concise text, and clearly and completely labeled plots.

Extra Credit Opportunities

1. Find an optimal Traveling Salesman tour for the given input. Given the current state of human knowledge, any algorithm that does this is bound to be some variant of brute force, taking exponential amount of time. But, there are some pretty sophisticated brute force implementations for the Traveling Salesman tour computation out there and you are welcome to download and use whatever you find. To get this extra credit, report the Traveling Salesman tour that has been computed, along with its weight. Then write a paragraph on how you found this tour, e.g., what software you downloaded, how you used it, and how long it took to find the tour.

2. Show on Google maps the MST and Traveling Salesman tours you computed for the experi- ments listed above. If you do this, then attach pictures of the MST and Traveling Salesman tours to your document hw8.pdf. You are welcome to go crazy and make a webpage, allow users to interact with these structures you're constructing, etc.

Java, Programming

  • Category:- Java
  • Reference No.:- M92395750
  • Price:- $25

Priced at Now at $25, Verified Solution

Have any Question?


Related Questions in Java

Can someone please help me with the following java

can someone please help me with the following java question The input is an N by N matrix of nonnegative integers. Each individual row is a decreasing sequence from left to right. Each individual column is a decreasing s ...

Assignment - method in our madnessthe emphasis for this

Assignment - "Method in our Madness" The emphasis for this assignment is methods with parameters. In preparation for this assignment, create a folder called Assign_3 for the DrJava projects for the assignment. A Cityscap ...

In ruby the hash class inherits from enumerable suggesting

In Ruby, the Hash class inherits from Enumerable, suggesting to a programmer that Hashes are collections. In Java, however, the Map classes are not part of the JCF (Java Collections Framework). For each language, provide ...

Project descriptionwrite a java program to traverse a

Project Description: Write a java program to traverse a directory structure (DirWalker.java) of csv files that contain csv files with customer info. A simple sample in provided in with the sample code but you MUST will r ...

Overviewyou are required to use java se 80 and javafx to

Overview You are required to use Java SE 8.0 and JavaFX to develop a Graphical User Interface (GUI) for the FlexiRent rental property management program created in Assignment 1. This assignment is designed to help you: 1 ...

Project requirementsfor the problem described in the next

Project requirements For the problem described in the next section, you must do the following: 1. include your student ID at the end of all filenames for all java code files. Three classes have been identified in section ...

Solving 2nd degree equationsbull write the following java

Solving 2nd degree equations • Write the following Java methods • boolean real-sols(double a, double b, double c): it returns true if the 2nd degree equation ax2 + bx + c has real solutions • double solution1(double a, d ...

Part a specification - robot simulationpart a

PART A Specification - Robot Simulation PART A Requirements To complete this assignment you will use the supplied eclipse project Robot P1/. It is already set up to execute a simple arm movement loop which you will build ...

Operating systems assignment -problem 1 sharing the bridgea

Operating Systems Assignment - Problem 1: Sharing the Bridge A new single lane bridge is constructed to connect the North Island of New Zealand to the South Island of New Zealand. Farmers from each island use the bridge ...

Assessment -java program using array of Assessment -JAVA Program using array of objects

Assessment -JAVA Program using array of objects Objectives This assessment item relates to the course learning outcomes as stated in the Unit Profile. Details For this assignment, you are required to develop a Windowed G ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As