drasys.or.graph.tsp
Class ConstructBase

java.lang.Object
  |
  +--drasys.or.graph.tsp.TSPBase
        |
        +--drasys.or.graph.tsp.ConstructBase
Direct Known Subclasses:
CheapestInsertion, FarthestInsertion, FullEnumeration, NearestAddition, NearestInsertion

public abstract class ConstructBase
extends TSPBase

A base class containing features common to many construction TSP algorithms.


Constructor Summary
ConstructBase()
          The target graph must be set with 'setGraph()'.
ConstructBase(GraphI graph)
          Sets the target graph.
 
Method Summary
protected abstract  void construct()
           
 double constructClosedTour()
          Construct a closed tour solution.
 double constructOpenTour()
          Construct an open tour solution with arbitrary end points.
 double constructOpenTour(java.lang.Object originKey, java.lang.Object destinationKey)
          Construct a tour with explicit end points.
 double constructOpenTourFrom(java.lang.Object originKey)
          Construct an open tour solution with an explicit origin and arbitrary destination.
 double constructOpenTourTo(java.lang.Object destinationKey)
          Construct an open tour solution with an explicit destination and arbitrary origin.
protected  void saveTour()
           
 void selectVertex(boolean select)
          Selects all of the vertices in the graph to be in the tour if 'select' is true.
 void selectVertex(boolean[] select)
          Selects all of the vertices whose corresponding element in 'select' is true.
 void selectVertex(java.lang.Object key, boolean select)
          Selects the vertex to be in the tour if 'select' is true.
 
Methods inherited from class drasys.or.graph.tsp.TSPBase
checkChangeCount, countVertices, forwardCost, getCost, getTour, initVertices, initVertices, reverseCost, rotateClosedTour, setEdgeKey, setGraph, setProperties
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ConstructBase

public ConstructBase()
The target graph must be set with 'setGraph()'.

ConstructBase

public ConstructBase(GraphI graph)
Sets the target graph.
Method Detail

construct

protected abstract void construct()
                           throws TourNotFoundException

constructOpenTour

public double constructOpenTour(java.lang.Object originKey,
                                java.lang.Object destinationKey)
                         throws TourNotFoundException,
                                VertexNotFoundException
Construct a tour with explicit end points. An open tour is one where the origin and destination vertices are different.
Throws:
TourNotFoundException - if the tour can not be constructed.

constructOpenTourFrom

public double constructOpenTourFrom(java.lang.Object originKey)
                             throws TourNotFoundException,
                                    VertexNotFoundException
Construct an open tour solution with an explicit origin and arbitrary destination. An open tour is one where the origin and destination vertices are different.
Throws:
TourNotFoundException - if the tour can not be constructed.

constructOpenTourTo

public double constructOpenTourTo(java.lang.Object destinationKey)
                           throws TourNotFoundException,
                                  VertexNotFoundException
Construct an open tour solution with an explicit destination and arbitrary origin. An open tour is one where the origin and destination vertices are different.
Throws:
TourNotFoundException - if the tour can not be constructed.

constructOpenTour

public double constructOpenTour()
                         throws TourNotFoundException
Construct an open tour solution with arbitrary end points. An open tour is one where the origin and destination vertices are different.
Throws:
TourNotFoundException - if the tour can not be constructed.

constructClosedTour

public double constructClosedTour()
                           throws TourNotFoundException
Construct a closed tour solution. A closed tour is one where the origin and destination vertices are the same.
Throws:
TourNotFoundException - if the tour can not be constructed.

saveTour

protected void saveTour()

selectVertex

public void selectVertex(boolean[] select)
Selects all of the vertices whose corresponding element in 'select' is true. Unselects all of the vertices whose corresponding element in 'select' is false. All of the vertices are selected by default when the algorithm is constructed.

selectVertex

public void selectVertex(boolean select)
Selects all of the vertices in the graph to be in the tour if 'select' is true. Unselects all of the vertices if 'select' is false. All of the vertices are selected by default when the algorithm is constructed.

selectVertex

public void selectVertex(java.lang.Object key,
                         boolean select)
                  throws VertexNotFoundException
Selects the vertex to be in the tour if 'select' is true. Unselects the vertex if 'select' is false. All of the vertices are selected by default when the algorithm is constructed.


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