drasys.or.graph.tsp
Class TSPBase

java.lang.Object
  |
  +--drasys.or.graph.tsp.TSPBase
Direct Known Subclasses:
BestOf, ConstructBase, Geni, ImproveBase

public abstract class TSPBase
extends java.lang.Object

A base class containing features common to many TSP algorithms.


Method Summary
protected  void checkChangeCount()
           
protected  int countVertices()
           
 double forwardCost(int r, int c)
          Retuns the forward cost between two vertices.
 double getCost()
          Returns the cost of the solution tour.
 java.util.Vector getTour()
          Returns the improved tour from the construction algorithm.
protected  void initVertices(int from, int to)
           
protected  void initVertices(java.util.Vector tour)
           
 double reverseCost(int c, int r)
          Retuns the reverse cost between two vertices.
 java.util.Vector rotateClosedTour(java.util.Vector tour, java.lang.Object key)
          Rotates the closed tour until the vertex that matches key is the vertex that is repeated on both ends.
 void setEdgeKey(java.lang.Object edgeKey)
          Sets the key used to select from parallel edges between vertices.
 void setGraph(GraphI graph)
          Sets the graph.
 void setProperties(PropertiesI properties)
          Sets the edge properties object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

checkChangeCount

protected void checkChangeCount()

setProperties

public void setProperties(PropertiesI properties)
Sets the edge properties object.

rotateClosedTour

public java.util.Vector rotateClosedTour(java.util.Vector tour,
                                         java.lang.Object key)
                                  throws VertexNotFoundException
Rotates the closed tour until the vertex that matches key is the vertex that is repeated on both ends.

setEdgeKey

public void setEdgeKey(java.lang.Object edgeKey)
Sets the key used to select from parallel edges between vertices. The default value for 'edgeKey' is null.

setGraph

public void setGraph(GraphI graph)
Sets the graph.

initVertices

protected void initVertices(int from,
                            int to)

countVertices

protected int countVertices()

initVertices

protected void initVertices(java.util.Vector tour)

getCost

public double getCost()
Returns the cost of the solution tour.
Throws:
GraphError - if no solution was created.

getTour

public java.util.Vector getTour()
Returns the improved tour from the construction algorithm. The vector contains all the edges and the vertices in alternating order starting and ending with a vertex. The elements will always be arranged in the order of forward tour traversal.
Throws:
GraphError - if no solution was created.

forwardCost

public final double forwardCost(int r,
                                int c)
Retuns the forward cost between two vertices.

reverseCost

public final double reverseCost(int c,
                                int r)
Retuns the reverse cost between two vertices.


Copyright(C)1997-2000 by DRA Systems all rights reserved. OpsResearch.com