Package com.graphhopper.jsprit.core.util
Class FastVehicleRoutingTransportCostsMatrix
java.lang.Object
com.graphhopper.jsprit.core.problem.cost.AbstractForwardVehicleRoutingTransportCosts
com.graphhopper.jsprit.core.util.FastVehicleRoutingTransportCostsMatrix
- All Implemented Interfaces:
BackwardTransportCost,BackwardTransportTime,ForwardTransportCost,ForwardTransportTime,TransportCost,TransportDistance,TransportTime,VehicleRoutingTransportCosts
public class FastVehicleRoutingTransportCostsMatrix
extends AbstractForwardVehicleRoutingTransportCosts
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).
- Author:
- schroeder
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classBuilder that builds the matrix. -
Method Summary
Modifier and TypeMethodDescriptiondoublegetDistance(int fromIndex, int toIndex) Returns the distance from to to.doublegetDistance(Location from, Location to, double departureTime, Vehicle vehicle) double[][][]First dim is from, second to and third indicates whether it is a distance value (index=0) or time value (index=1).intdoublegetTransportCost(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
-
getMatrix
public double[][][] getMatrix()First dim is from, second to and third indicates whether it is a distance value (index=0) or time value (index=1).- Returns:
-
getTransportTime
public double getTransportTime(Location from, Location to, double departureTime, Driver driver, Vehicle vehicle) - Specified by:
getTransportTimein interfaceForwardTransportTime- Specified by:
getTransportTimein classAbstractForwardVehicleRoutingTransportCosts
-
getDistance
public double getDistance(int fromIndex, int toIndex) Returns the distance from to to.- Parameters:
fromIndex- from location indextoIndex- to location index- Returns:
- the distance
-
getDistance
- Specified by:
getDistancein interfaceTransportDistance- Specified by:
getDistancein classAbstractForwardVehicleRoutingTransportCosts
-
getTransportCost
public double getTransportCost(Location from, Location to, double departureTime, Driver driver, Vehicle vehicle) - Specified by:
getTransportCostin interfaceForwardTransportCost- Specified by:
getTransportCostin classAbstractForwardVehicleRoutingTransportCosts
-
getNoLocations
public int getNoLocations()
-