drasys.or.graph.vrp
Class Composite

java.lang.Object
  |
  +--drasys.or.graph.vrp.VRPBase
        |
        +--drasys.or.graph.vrp.ConstructBase
              |
              +--drasys.or.graph.vrp.RandomizableBase
                    |
                    +--drasys.or.graph.vrp.Composite

public class Composite
extends RandomizableBase
implements ConstructI

This class implements a composite VRP algorithm by combining a construction algorithm with an improvement algorithm. A composite VRP algorithm is one that has a construction phase followed by an improvement phase. In the VRP package all basic algorithms are implemented as either a pure construction or improvement class with the associated interface. This class implements the composite algorithm by constructing an initial tour using the construction algorithm and then improving it with the improvement algorithm.


Fields inherited from class drasys.or.graph.vrp.ConstructBase
_selected
 
Fields inherited from class drasys.or.graph.vrp.VRPBase
_closed, _depotKey, _edgeKey, _graph, _maxCost, _maxLoad, _out, _properties, _vehicleCost
 
Constructor Summary
Composite(ConstructI construct, ImproveI improve)
           
Composite(ConstructI construct, ImproveI improve, GraphI graph)
           
 
Method Summary
 double constructClosedTours(java.lang.Object depotKey)
          Construct a solution with closed tours that begin and end at the depot vertex.
 double constructInboundTours(java.lang.Object depotKey)
          Construct a solution with open tours that begin at arbitrary vertices and end at the depot vertex.
 double constructOutboundTours(java.lang.Object depotKey)
          Construct a solution with open tours that begin at the depot vertex and end at arbitrary vertices.
 ConstructI getConstructAlgorithm()
           
 double getCost()
          Returns the total cost of the solution tours.
 double[] getCosts()
          Returns the cost of each solution tour.
 ImproveI getImproveAlgorithm()
           
 double[] getLoads()
          Returns the load for each solution tour.
 java.util.Vector[] getTours()
          Returns the tours in the solution.
 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 setCapacityConstraint(double maxLoadPerVehicle)
          Sets the vehicle capacity constraint.
 void setCostConstraint(double maxCostPerVehicle)
          Sets the vehicle cost constraint.
 void setEdgeKey(java.lang.Object edgeKey)
          Sets the edge key for the construction and improvement algorithms.
 void setGraph(GraphI graph)
          Sets the graph for the construction and improvement algorithms.
 void setProperties(PropertiesI properties)
          Sets the edge properties object for the construction and improvement algorithms.
 void setVehicleCost(double vehicleCost)
          Sets the vehicle cost constraint.
 
Methods inherited from class drasys.or.graph.vrp.RandomizableBase
getRandom, setRandom, setStrength
 
Methods inherited from class drasys.or.graph.vrp.ConstructBase
isSelected, sizeOfSelected
 
Methods inherited from class drasys.or.graph.vrp.VRPBase
copyTours, getCost, getGraph, getLoad, getLoads
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Composite

public Composite(ConstructI construct,
                 ImproveI improve)

Composite

public Composite(ConstructI construct,
                 ImproveI improve,
                 GraphI graph)
Method Detail

getConstructAlgorithm

public ConstructI getConstructAlgorithm()

getImproveAlgorithm

public ImproveI getImproveAlgorithm()

setGraph

public void setGraph(GraphI graph)
Sets the graph for the construction and improvement algorithms.
Overrides:
setGraph in class ConstructBase

setProperties

public void setProperties(PropertiesI properties)
Sets the edge properties object for the construction and improvement algorithms.
Overrides:
setProperties in class ConstructBase

setVehicleCost

public void setVehicleCost(double vehicleCost)
Sets the vehicle cost constraint. The units must be the same as the edge traversal costs.
Overrides:
setVehicleCost in class VRPBase

setCostConstraint

public void setCostConstraint(double maxCostPerVehicle)
Sets the vehicle cost constraint.
Overrides:
setCostConstraint in class VRPBase

setCapacityConstraint

public void setCapacityConstraint(double maxLoadPerVehicle)
Sets the vehicle capacity constraint.
Overrides:
setCapacityConstraint in class VRPBase

setEdgeKey

public void setEdgeKey(java.lang.Object edgeKey)
Sets the edge key for the construction and improvement algorithms. The default value for 'edgeKey' is null.
Overrides:
setEdgeKey in class ConstructBase

getCost

public double getCost()
               throws SolutionNotFoundException
Returns the total cost of the solution tours.
Throws:
SolutionNotFoundException - if no solution was created.

getLoads

public double[] getLoads()
                  throws SolutionNotFoundException
Returns the load for each solution tour.
Throws:
SolutionNotFoundException - if no solution was created.

getCosts

public double[] getCosts()
                  throws SolutionNotFoundException
Returns the cost of each solution tour.
Throws:
SolutionNotFoundException - if no solution was created.

getTours

public java.util.Vector[] getTours()
                            throws SolutionNotFoundException
Returns the tours in the solution.
Throws:
SolutionNotFoundException - if no solution was created.

constructOutboundTours

public double constructOutboundTours(java.lang.Object depotKey)
                              throws SolutionNotFoundException,
                                     VertexNotFoundException
Construct a solution with open tours that begin at the depot vertex and end at arbitrary vertices.
Specified by:
constructOutboundTours in interface ConstructI
Throws:
SolutionNotFoundException - if a solution can not be constructed.

constructInboundTours

public double constructInboundTours(java.lang.Object depotKey)
                             throws SolutionNotFoundException,
                                    VertexNotFoundException
Construct a solution with open tours that begin at arbitrary vertices and end at the depot vertex.
Specified by:
constructInboundTours in interface ConstructI
Throws:
SolutionNotFoundException - if a solution can not be constructed.

constructClosedTours

public double constructClosedTours(java.lang.Object depotKey)
                            throws SolutionNotFoundException,
                                   VertexNotFoundException
Construct a solution with closed tours that begin and end at the depot vertex.
Specified by:
constructClosedTours in interface ConstructI
Throws:
SolutionNotFoundException - if a solution can not be constructed.

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.
Specified by:
selectVertex in interface ConstructI
Overrides:
selectVertex in class ConstructBase

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.
Specified by:
selectVertex in interface ConstructI
Overrides:
selectVertex in class ConstructBase

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.
Specified by:
selectVertex in interface ConstructI
Overrides:
selectVertex in class ConstructBase


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