algo
Class SeqByteTSP

java.lang.Object
  extended by algo.SeqByteTSP
All Implemented Interfaces:
TSPInf, java.io.Serializable

public class SeqByteTSP
extends java.lang.Object
implements TSPInf, java.io.Serializable

A sequential algorithm for an euclidean 2d TSP Problem.

Author:
Heinz Kredel.
See Also:
Serialized Form

Field Summary
protected  double best
           
protected  Path bestPath
           
protected  Graph graph
           
protected  long iter
           
protected  long maxiter
           
protected  Point[] points
           
 
Constructor Summary
SeqByteTSP(Point[] p)
           
SeqByteTSP(Point[] p, Graph g)
           
 
Method Summary
 Path actualBest()
           
 Path getBest()
          Search the best path for a TSP problem.
 Path getBest(long max)
          Search the best path for a TSP problem.
 void getBest(Path path)
          Search the best path for a TSP problem.
 void getBestRec(Path path, int depth)
           
 long getIterations()
           
 long getMaxIterations()
           
 void setBest(Path b)
           
 long setMaxIterations(long m)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

graph

protected Graph graph

points

protected Point[] points

best

protected double best

bestPath

protected Path bestPath

iter

protected long iter

maxiter

protected long maxiter
Constructor Detail

SeqByteTSP

public SeqByteTSP(Point[] p)
Parameters:
p - the cities.

SeqByteTSP

public SeqByteTSP(Point[] p,
                  Graph g)
Parameters:
p - the cities.
g - the corresponding graph.
Method Detail

getIterations

public long getIterations()
Specified by:
getIterations in interface TSPInf
Returns:
number of iterations.

getMaxIterations

public long getMaxIterations()
Specified by:
getMaxIterations in interface TSPInf
Returns:
maxiter.

setMaxIterations

public long setMaxIterations(long m)
Specified by:
setMaxIterations in interface TSPInf
Parameters:
m - new maxIter.
Returns:
old maxIter.

actualBest

public Path actualBest()
Specified by:
actualBest in interface TSPInf
Returns:
the actual best Path.

setBest

public void setBest(Path b)
Specified by:
setBest in interface TSPInf
Parameters:
b - a possible new best path.

getBest

public Path getBest()
Description copied from interface: TSPInf
Search the best path for a TSP problem.

Specified by:
getBest in interface TSPInf
Returns:
getBest(Long.MAX_VALUE).

getBest

public Path getBest(long max)
Description copied from interface: TSPInf
Search the best path for a TSP problem.

Specified by:
getBest in interface TSPInf
Parameters:
max - maximal number of iterations.
Returns:
best Path.

getBest

public void getBest(Path path)
Description copied from interface: TSPInf
Search the best path for a TSP problem. Starting with path p.

Specified by:
getBest in interface TSPInf
Parameters:
path - a starting path.

getBestRec

public void getBestRec(Path path,
                       int depth)
Parameters:
path - a starting path.
depth - length of this path.