drasys.or.graph.tsp
Class ConstructToImproveConverter

java.lang.Object
  |
  +--drasys.or.graph.tsp.ConstructToImproveConverter

public class ConstructToImproveConverter
extends java.lang.Object
implements ImproveI

This class allows a construction algorithm to be used as an improvement algorithm.


Constructor Summary
ConstructToImproveConverter(ConstructI construct)
           
ConstructToImproveConverter(ConstructI construct, GraphI graph)
           
 
Method Summary
 ConstructI getConstructAlgorithm()
           
 double getCost()
          Returns the cost of the solution tour.
 java.util.Vector getTour()
          Returns the solution tour.
 double improveClosedTour(java.util.Vector tour)
          Improve a closed tour solution.
 double improveOpenTour(java.util.Vector tour)
          Improve an open tour solution with arbitrary end points.
 double improveOpenTour(java.util.Vector tour, boolean fixedOrigin, boolean fixedDestination)
          Improve an open tour solution with fixed end points.
 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 edge key for the construction algorithm.
 void setGraph(GraphI graph)
          Sets the graph for the construction algorithm.
 void setProperties(PropertiesI properties)
          Sets the edge properties object for the construction algorithm.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ConstructToImproveConverter

public ConstructToImproveConverter(ConstructI construct)

ConstructToImproveConverter

public ConstructToImproveConverter(ConstructI construct,
                                   GraphI graph)
Method Detail

getConstructAlgorithm

public ConstructI getConstructAlgorithm()

setGraph

public void setGraph(GraphI graph)
Sets the graph for the construction algorithm.

setProperties

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

setEdgeKey

public void setEdgeKey(java.lang.Object edgeKey)
Sets the edge key for the construction algorithm. The default value for 'edgeKey' is null.

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 solution tour.
Throws:
GraphError - if no solution was created.

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.

improveOpenTour

public double improveOpenTour(java.util.Vector tour)
                       throws TourNotFoundException
Improve an open tour solution with arbitrary end points. An open tour is one where the origin and destination vertices are different.
Specified by:
improveOpenTour in interface ImproveI

improveOpenTour

public double improveOpenTour(java.util.Vector tour,
                              boolean fixedOrigin,
                              boolean fixedDestination)
                       throws TourNotFoundException
Improve an open tour solution with fixed end points. An open tour is one where the origin and destination vertices are different. The arguments can be used to fix either end.
Specified by:
improveOpenTour in interface ImproveI

improveClosedTour

public double improveClosedTour(java.util.Vector tour)
                         throws TourNotFoundException
Improve a closed tour solution. An closed tour is one where the origin and destination vertices are the same.
Specified by:
improveClosedTour in interface ImproveI


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