|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--drasys.or.graph.tsp.TSPBase | +--drasys.or.graph.tsp.BestOf
This class implements a composite TSP algorithm by combining a set of construction algorithms with a set of improvement algorithms. A composite TSP algorithm is one that has a construction phase followed by an improvement phase. In the TSP package all basic algorithms are implemented as either a pure construction or improvement class with the associated interface. This class implements the construction phase by constructing a set of initial tours using each of the construction algorithms and retaining the best. Then in the improvement phase each of the improvement algorithms are applied in turn to improve the retained tour. If the new tour is an improvement then it becomes the retained tour.
Constructor Summary | |
BestOf()
|
|
BestOf(GraphI graph)
|
Method Summary | |
void |
addConstruct(ConstructI construct)
Adds a construction algorithm. |
void |
addConstruct(ConstructI construct,
int minSize,
int maxSize)
Adds a construction algorithm. |
void |
addImprove(ImproveI improve)
Adds an improvement algorithm. |
void |
addImprove(ImproveI improve,
int minSize,
int maxSize)
Adds an improvement algorithm. |
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. |
double |
getCost()
Returns the cost of the solution tour. |
java.util.Vector |
getTour()
Returns the improved tour from the construction algorithm. |
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. |
void |
setEdgeKey(java.lang.Object edgeKey)
Sets the edge key for all of the contained TSP algorithms. |
void |
setGraph(GraphI graph)
Sets the graph for all of the contained TSP algorithms. |
void |
setProperties(PropertiesI properties)
Sets the edge properties object for all of the contained TSP algorithms. |
Methods inherited from class drasys.or.graph.tsp.TSPBase |
checkChangeCount,
countVertices,
forwardCost,
initVertices,
initVertices,
reverseCost,
rotateClosedTour |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
Constructor Detail |
public BestOf()
public BestOf(GraphI graph)
Method Detail |
public void addConstruct(ConstructI construct)
public void addConstruct(ConstructI construct, int minSize, int maxSize)
public void addImprove(ImproveI improve)
public void addImprove(ImproveI improve, int minSize, int maxSize)
public void setGraph(GraphI graph)
public void setProperties(PropertiesI properties)
public void setEdgeKey(java.lang.Object edgeKey)
public double constructOpenTour(java.lang.Object originKey, java.lang.Object destinationKey) throws TourNotFoundException, VertexNotFoundException
public double constructOpenTourFrom(java.lang.Object originKey) throws TourNotFoundException, VertexNotFoundException
public double constructOpenTourTo(java.lang.Object destinationKey) throws TourNotFoundException, VertexNotFoundException
public double constructOpenTour() throws TourNotFoundException
public double constructClosedTour() throws TourNotFoundException
public void selectVertex(boolean[] select)
public void selectVertex(boolean select)
public void selectVertex(java.lang.Object key, boolean select) throws VertexNotFoundException
public java.util.Vector getTour()
public double getCost()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |