algo
Class DistTSP

java.lang.Object
  extended by algo.DistTSP
All Implemented Interfaces:
TSPInf

public class DistTSP
extends java.lang.Object
implements TSPInf

A parallel algorithm for an euclidean 2d TSP Problem.

Author:
Heinz Kredel.

Field Summary
protected  DistBestStore best
           
protected  ChannelFactory cf
           
protected  Graph graph
           
protected  java.lang.String hostfile
           
private static Logger logger
           
protected  java.lang.String master
           
protected  int number
           
protected  Point[] points
           
protected  int port
           
protected  DistRunTSP[] threads
           
 
Constructor Summary
DistTSP(Point[] p, int th)
           
 
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.
 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 DistBestStore best

number

protected int number

hostfile

protected java.lang.String hostfile

port

protected int port

master

protected java.lang.String master

cf

protected ChannelFactory cf

threads

protected DistRunTSP[] threads

logger

private static Logger logger
Constructor Detail

DistTSP

public DistTSP(Point[] p,
               int th)
Parameters:
p - the cities.
th - number of processes.
Method Detail

getIterations

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

getMaxIterations

public long getMaxIterations()
Specified by:
getMaxIterations in interface TSPInf
Returns:
the maximal number of iterations.

setMaxIterations

public long setMaxIterations(long m)
Specified by:
setMaxIterations in interface TSPInf
Parameters:
m - the maximal number of iterations.
Returns:
the previous maximal number of iterations.

actualBest

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

setBest

public void setBest(Path b)
Specified by:
setBest in interface TSPInf
Parameters:
b - a 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:
bestPath.

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 Path.