tasks
Class TSPResult

java.lang.Object
  extended by tasks.TSPResult
All Implemented Interfaces:
Shared, java.io.Serializable

public class TSPResult
extends java.lang.Object
implements java.io.Serializable, Shared

TSPResult class. Stores a tour and its distance.

See Also:
Serialized Form

Constructor Summary
TSPResult(int[] path, double dist)
          Constructor for TSPResult
 
Method Summary
 double getDist()
          Gets the path distance
 int[] getPath()
          Gets the path
 boolean isNewerThan(Shared shared)
          if we found a solution with a shorter path, it is newer than what we currently have.
 java.lang.String toString()
          Returns string representation of the result.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

TSPResult

public TSPResult(int[] path,
                 double dist)
Constructor for TSPResult

Parameters:
path - the TSP tour path
dist - the distance of the rondtrip path
Method Detail

getPath

public int[] getPath()
Gets the path

Returns:
the path

getDist

public double getDist()
Gets the path distance

Returns:
the path distance

isNewerThan

public boolean isNewerThan(Shared shared)
if we found a solution with a shorter path, it is newer than what we currently have.

Specified by:
isNewerThan in interface Shared
Parameters:
shared - this contains a TSP result with the best possible path we found so far. Null if we have not found a path.
Returns:
if this is a shorter path, returns true, false otherwise

toString

public java.lang.String toString()
Returns string representation of the result.

Overrides:
toString in class java.lang.Object
Returns:
ouput string with distance of this result