|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objecttasks.TSPUtils
public final class TSPUtils
Utility class for TSP.
Method Summary | |
---|---|
static double |
getDistance(int[] path,
double[][] coords)
Computes the roundtrip distance of the given path |
static double |
getDistance(int i,
int j,
double[][] coords)
Gets the distance from city i to city j |
static double |
getLowerBound(int[] remaining,
double[][] coords,
int lastCoordIndex)
Computes the lower bound on the current partial path. |
static int[] |
getMinPath(int[] a,
int[] b,
double[][] coords)
Gets the minimum path among the 2 input paths |
static double |
getOneWayDistance(int[] path,
double[][] coords)
Computes partial path distance, without returning to city zero. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static double getDistance(int i, int j, double[][] coords)
i
- city indexj
- city indexcoords
- city coordinates
public static double getDistance(int[] path, double[][] coords)
path
- the path tourcoords
- the city coordinates
public static double getOneWayDistance(int[] path, double[][] coords)
path
- partial path.coords
- coordinates of the cities.
public static double getLowerBound(int[] remaining, double[][] coords, int lastCoordIndex)
remaining
- the list of cities that are not yet part of the pathcoords
- coordinates of the cities.lastCoordIndex
- index of the last coordinate in the partial path.
public static int[] getMinPath(int[] a, int[] b, double[][] coords)
a
- path tourb
- path tourcoords
- city coordinates
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |