|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.ObjectTSP
public class TSP
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 |
---|
public TSP(java.lang.String fname) throws java.io.IOException
java.io.IOException
Method Detail |
---|
public void plot()
public void plot(int[] tour)
public double cost(int city1, int city2)
public double cost(int[] tour)
public int size()
public void setPointSize(int i)
public void pause(long inteval)
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |