Package com.graphhopper.jsprit.core.util
Class VehicleRoutingTransportCostsMatrix
java.lang.Object
com.graphhopper.jsprit.core.problem.cost.AbstractForwardVehicleRoutingTransportCosts
com.graphhopper.jsprit.core.util.VehicleRoutingTransportCostsMatrix
- All Implemented Interfaces:
BackwardTransportCost,BackwardTransportTime,ForwardTransportCost,ForwardTransportTime,TransportCost,TransportDistance,TransportTime,VehicleRoutingTransportCosts
CostMatrix that allows pre-compiled time and distance-matrices to be considered as
VehicleRoutingTransportCosts
in the VehicleRoutingProblem.
Note that you can also use it with distance matrix only (or time matrix). But ones you set a particular distance, this expects distance-entries for all relations. This counts also for a particular time. If the method getTransportCosts(...) is then invoked for a relation, where no distance can be found, an IllegalStateException will be thrown. Thus if you want to only use distances only, do not use addTransportTime(...).
- Author:
- schroeder
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classBuilder that builds the matrix. -
Method Summary
Modifier and TypeMethodDescriptiondoublegetDistance(Location from, Location to, double departureTime, Vehicle vehicle) doublegetDistance(String fromId, String toId) Returns the distance fromId to toId.doublegetTransportCost(Location from, Location to, double departureTime, Driver driver, Vehicle vehicle) doublegetTransportTime(Location from, Location to, double departureTime, Driver driver, Vehicle vehicle) Methods inherited from class com.graphhopper.jsprit.core.problem.cost.AbstractForwardVehicleRoutingTransportCosts
getBackwardTransportCost, getBackwardTransportTime
-
Method Details
-
getTransportTime
public double getTransportTime(Location from, Location to, double departureTime, Driver driver, Vehicle vehicle) - Specified by:
getTransportTimein interfaceForwardTransportTime- Specified by:
getTransportTimein classAbstractForwardVehicleRoutingTransportCosts
-
getDistance
Returns the distance fromId to toId.- Parameters:
fromId- from locationIdtoId- to locationId- Returns:
- the distance from fromId to toId
- Throws:
IllegalStateException- if distance of fromId -> toId is not found
-
getTransportCost
public double getTransportCost(Location from, Location to, double departureTime, Driver driver, Vehicle vehicle) - Specified by:
getTransportCostin interfaceForwardTransportCost- Specified by:
getTransportCostin classAbstractForwardVehicleRoutingTransportCosts
-
getDistance
- Specified by:
getDistancein interfaceTransportDistance- Specified by:
getDistancein classAbstractForwardVehicleRoutingTransportCosts
-