Class TSP

java.lang.Object
  extended by TSP

public class TSP
extends java.lang.Object

A TSP object is a representation of a traveling salesman problem and provides methods to display the TSP, display a tour of that tsp and to get inter-city distances and the total cost of a tour where a tour is an integer array containg a permutation of the integers 0 to n-1


Constructor Summary
TSP(java.lang.String fname)
           
 
Method Summary
 double cost(int[] tour)
          deliver the cost of a tour, where a tour is an integer array containing a permutation of the integers 0 to n-1
 double cost(int city1, int city2)
          deliver the inter-city cost between two cities
 void pause(long inteval)
          allows a pause, in milliseconds, useful in animations
 void plot()
          plot the cities in the tsp
 void plot(int[] tour)
          plot the cities and the tour
 void setPointSize(int i)
          change the point size
 int size()
          the size is the number of cities in the tsp
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TSP

public TSP(java.lang.String fname)
    throws java.io.IOException
Throws:
java.io.IOException
Method Detail

plot

public void plot()
plot the cities in the tsp


plot

public void plot(int[] tour)
plot the cities and the tour


cost

public double cost(int city1,
                   int city2)
deliver the inter-city cost between two cities


cost

public double cost(int[] tour)
deliver the cost of a tour, where a tour is an integer array containing a permutation of the integers 0 to n-1


size

public int size()
the size is the number of cities in the tsp


setPointSize

public void setPointSize(int i)
change the point size


pause

public void pause(long inteval)
allows a pause, in milliseconds, useful in animations