RouteSetGenerator¶
-
public class
RouteSetGenerator
¶ RouteSetGenerator can generate, save and read route sets for the route choice.
Author: Milan Lovric
Fields¶
Constructors¶
RouteSetGenerator¶
-
public
RouteSetGenerator
(RoadNetwork roadNetwork, Properties props)¶ Constructor for the route set generator.
Parameters: - roadNetwork – Road network.
- props – Parameters from the config file.
Methods¶
addRoute¶
addRouteWithoutValidityCheck¶
calculateAllPathsizes¶
-
public void
calculateAllPathsizes
()¶ Calculates all pathsizes for all the route sets (expensive operation).
generateRouteSetBetweenFreightZones¶
-
public void
generateRouteSetBetweenFreightZones
(int originFreightZone, int destinationFreightZone)¶ Generates routes between two freight zones. A freight zone can be either an LAD (<= 1032) or a point. Zone ID ranges from the BYFM DfT model:
- England: 1 - 867
- Wales: 901 - 922
- Scotland: 1001 - 1032
- Freight airports: 1111 - 1115
- Major distribution centres: 1201 - 1256
- Freight ports: 1301 - 1388
Parameters: - originFreightZone – Origin freight zone.
- destinationFreightZone – Destination freight zone.
generateRouteSetBetweenFreightZones¶
-
public void
generateRouteSetBetweenFreightZones
(int originFreightZone, int destinationFreightZone, int topNodes)¶ Generates routes between two freight zones. A freight zone can be either an LAD (<= 1032) or a point. Zone ID ranges from the BYFM DfT model:
- England: 1 - 867
- Wales: 901 - 922
- Scotland: 1001 - 1032
- Freight airports: 1111 - 1115
- Major distribution centres: 1201 - 1256
- Freight ports: 1301 - 1388
Parameters: - originFreightZone – Origin freight zone.
- destinationFreightZone – Destination freight zone.
- topNodes – Number of topNodes to consider for inter-zonal routes.
generateRouteSetForFreightMatrix¶
-
public void
generateRouteSetForFreightMatrix
(FreightMatrix freightMatrix, int topNodes)¶ Generates routes for all non-zero OD flows in the freight OD matrix. Zone ID ranges from the BYFM DfT model:
Parameters: - freightMatrix – Freight matrix.
- topNodes – Number of topNodes to consider for inter-zonal routes.
generateRouteSetForFreightMatrix¶
-
public void
generateRouteSetForFreightMatrix
(FreightMatrix freightMatrix, int sliceIndex, int sliceNumber)¶ Generates routes for a slice of the OD matrix (useful for cluster computing), for topNodes only. There might still be some overlap between the slices as some nodes (to which point freight zones are assigned appear again in LAD freight zones).
Parameters: - freightMatrix – Freight matrix.
- sliceIndex – Index of the OD matrix slice for which to generate routes [1..N].
- sliceNumber – Number of slices to divide matrix into (N).
generateRouteSetForFreightMatrix¶
-
public void
generateRouteSetForFreightMatrix
(FreightMatrix freightMatrix, int sliceIndex, int sliceNumber, int topNodes)¶ Generates routes for a slice of the OD matrix (useful for cluster computing), for topNodes only. There might still be some overlap between the slices as some nodes (to which point freight zones are assigned appear again in LAD freight zones).
Parameters: - freightMatrix – Freight matrix.
- sliceIndex – Index of the OD matrix slice for which to generate routes [1..N].
- sliceNumber – Number of slices to divide matrix into (N).
- topNodes – Number of topNodes to consider for inter-zonal routes.
generateRouteSetForODMatrix¶
-
public void
generateRouteSetForODMatrix
(ODMatrixMultiKey matrix, int topNodes)¶ Generates routes for all non-zero OD flows in the OD matrix. For inter-zonal flows generates routes only between top N nodes.
Parameters: - matrix – Origin-destination matrix.
- topNodes – Number of topNodes to consider for inter-zonal routes.
generateRouteSetForODMatrix¶
-
public void
generateRouteSetForODMatrix
(ODMatrixMultiKey matrix)¶ Generates routes for all non-zero OD flows in the OD matrix.
Parameters: - matrix – Origin-destination matrix.
generateRouteSetForODMatrix¶
-
public void
generateRouteSetForODMatrix
(ODMatrixMultiKey matrix, int sliceIndex, int sliceNumber, int topNodes)¶ Generates routes for a slice of the OD matrix (useful for cluster computing), for topNodes only
Parameters: - matrix – Origin-destination matrix.
- sliceIndex – Index of the OD matrix slice for which to generate routes [1..N].
- sliceNumber – Number of slices to divide matrix into (N).
- topNodes – Number of topNodes to consider for inter-zonal routes.
generateRouteSetForODMatrix¶
-
public void
generateRouteSetForODMatrix
(ODMatrixMultiKey matrix, int sliceIndex, int sliceNumber)¶ Generates routes for a slice of the Tempro OD matrix (useful for cluster computing).
Parameters: - matrix – Origin-destination matrix.
- sliceIndex – Index of the OD matrix slice for which to generate routes [1..N].
- sliceNumber – Number of slices to divide matrix into (N).
generateRouteSetForODMatrixTempro¶
-
public void
generateRouteSetForODMatrixTempro
(ODMatrixMultiKey matrix, Zoning zoning)¶ Generates routes for all non-zero OD flows in the OD matrix.
Parameters: - matrix – Origin-destination matrix.
- zoning – Tempro zoning system.
generateRouteSetForODMatrixTempro¶
-
public void
generateRouteSetForODMatrixTempro
(RealODMatrixTempro matrix, Zoning zoning, int sliceIndex, int sliceNumber)¶ Generates routes for a slice of the OD matrix (useful for cluster computing).
Parameters: - matrix – Origin-destination matrix.
- zoning – Tempro zoning system.
- sliceIndex – Index of the OD matrix slice for which to generate routes [1..N].
- sliceNumber – Number of slices to divide matrix into (N).
generateRouteSetForODMatrixTemproDistanceBased¶
-
public void
generateRouteSetForODMatrixTemproDistanceBased
(RealODMatrixTempro matrix, Zoning zoning, int sliceIndex, int sliceNumber)¶ Generates routes for a slice of the OD matrix (useful for cluster computing). The number of routes increases the smaller the distance between two Tempro zones.
Parameters: - matrix – Origin-destination matrix.
- zoning – Tempro zoning system.
- sliceIndex – Index of the OD matrix slice for which to generate routes [1..N].
- sliceNumber – Number of slices to divide matrix into (N).
generateRouteSetNodeToNode¶
-
public void
generateRouteSetNodeToNode
(int origin, int destination)¶ Generates a route set between two nodes (if it does not already exist in the route set).
Parameters: - origin – Origin node ID.
- destination – Destination node ID.
generateRouteSetWithLinkElimination¶
-
public void
generateRouteSetWithLinkElimination
(int origin, int destination)¶ Generates a route set between two nodes using the link elimination method - It first finds the fastest path and then blocks each of its links and tries to find an alternative path.
Parameters: - origin – Origin node ID.
- destination – Destination node ID.
generateRouteSetWithRandomLinkEliminationRestricted¶
-
public void
generateRouteSetWithRandomLinkEliminationRestricted
(int origin, int destination)¶ Generates a route set between two nodes using the random link elimination method - It first finds the fastest path and then blocks random links within the fastest path and tries to find an alternative path. The search is limited by the total number of path finding calls and the required number of generated paths.
Parameters: - origin – Origin node ID.
- destination – Destination node ID.
generateRouteSetWithRandomLinkEliminationRestricted¶
-
public void
generateRouteSetWithRandomLinkEliminationRestricted
(int origin, int destination, int routeLimit, int generationLimit)¶ Generates a route set between two nodes using the random link elimination method - It first finds the fastest path and then blocks random links within the fastest path and tries to find an alternative path. The search is limited by the total number of path finding calls and the required number of generated paths.
Parameters: - origin – Origin node ID.
- destination – Destination node ID.
- routeLimit – Maximum allowed number of generated routes.
- generationLimit – Number of generation trials to get a potentially new route.
generateRouteSetZoneToZone¶
generateRouteSetZoneToZone¶
-
public void
generateRouteSetZoneToZone
(String originLAD, String destinationLAD, int topNodes)¶ Generates routes between top N nodes (sorted by gravitating population) from two LAD zones. If origin and destination LAD are the same (i.e., intra-zonal), then use all the nodes
Parameters: - originLAD – Origin LAD.
- destinationLAD – Destination LAD.
- topNodes – Number of top nodes within LAD to consider.
generateRouteSetZoneToZoneTempro¶
generateRouteSetZoneToZoneTemproDistanceBased¶
getNumberOfRouteSets¶
-
public int
getNumberOfRouteSets
()¶ Gets the numbers of route sets (OD pairs).
Returns: Number of route sets.
getNumberOfRoutes¶
-
public int
getNumberOfRoutes
()¶ Gets the total number of routes.
Returns: Number of routes.
getRoadNetwork¶
-
public RoadNetwork
getRoadNetwork
()¶ Getter method for the road network.
Returns: Road network.
getRouteSet¶
getStatistics¶
readRoutes¶
readRoutesBinary¶
readRoutesBinaryGZIPpedWithoutValidityCheck¶
readRoutesBinaryShortWithoutValidityCheck¶
readRoutesBinaryWithoutValidityCheck¶
readRoutesWithoutValidityCheck¶
removeRoutesWithEdge¶
-
public void
removeRoutesWithEdge
(int edgeID)¶ Removes all the routes that contain a given edge (used for disruption).
Parameters: - edgeID – Edge ID.