Route

public class Route

Route is a sequence of directed edges with a choice utility.

Author:Milan Lovric

Constructors

Route

public Route(RoadNetwork roadNetwork)

Route

public Route(RoadPath path, RoadNetwork roadNetwork)

Construtor from a given path.

Parameters:
  • path – A path from which to construct a route.
  • roadNetwork – Road network.

Methods

addEdge

public boolean addEdge(DirectedEdge edge)

Adds a directed edge to the end of the current route.

Parameters:
  • edge – Directed edge to be added.
Returns:

true if edge addition was successful, false otherwise.

addEdgeWithoutValidityCheck

public void addEdgeWithoutValidityCheck(DirectedEdge edge)

Adds a directed edge to the end of the current route.

Parameters:
  • edge – Directed edge to be added.

addEdgeWithoutValidityCheck

public void addEdgeWithoutValidityCheck(int edgeID)

Adds a directed edge to the end of the current route.

Parameters:
  • edgeID – Directed edge to be added.

calculateConsumption

public Map<EnergyType, Double> calculateConsumption(VehicleType vht, EngineType et, double[] linkTravelTime, Map<VehicleType, Map<EngineType, Map<WebTAG, Double>>> energyConsumptionParameters, Map<VehicleType, Map<EngineType, Double>> relativeFuelEfficiency)

Calculates energy consumption of the route.

Parameters:
  • vht – Vehicle type.
  • et – Energy type.
  • linkTravelTime – Link travel time.
  • energyConsumptionParameters – Base year energy consumption parameters.
  • relativeFuelEfficiency – Relative fuel efficiency compared to base year.
Returns:

Consumption for each type.

calculateCost

public void calculateCost(VehicleType vht, EngineType et, TimeOfDay tod, double[] linkTravelTime, Map<VehicleType, Map<EngineType, Map<WebTAG, Double>>> energyConsumptionParameters, Map<VehicleType, Map<EngineType, Double>> relativeFuelEfficiency, Map<EnergyType, Double> energyUnitCosts, List<PricingPolicy> congestionCharges)

Calculates the cost of the route.

Parameters:
  • vht – Vehicle type.
  • et – Engine type.
  • tod – Time of day.
  • linkTravelTime – Link travel times.
  • energyConsumptionParameters – Base year energy consumption parameters.
  • relativeFuelEfficiency – Relative fuel efficiency (compared to base year).
  • energyUnitCosts – Energy unit costs.
  • congestionCharges – Congestion charges.

calculateLength

public void calculateLength()

Calculates the length of the route.

calculateTravelTime

public void calculateTravelTime(double[] linkTravelTime, double avgIntersectionDelay)

Calculates the route travel time based on link travel times.

Parameters:
  • linkTravelTime – Link travel times.
  • avgIntersectionDelay – Average intersection delay (in minutes).

calculateUtility

public void calculateUtility(VehicleType vht, EngineType et, TimeOfDay tod, double[] linkTravelTime, Map<VehicleType, Map<EngineType, Map<WebTAG, Double>>> energyConsumptionParameters, Map<VehicleType, Map<EngineType, Double>> relativeFuelEfficiency, Map<EnergyType, Double> energyUnitCosts, List<PricingPolicy> congestionCharges, Map<RouteChoiceParams, Double> params)

Calculates the utility of the route.

Parameters:
  • vht – Vehicle type.
  • et – Engine type.
  • tod – Time of day.
  • linkTravelTime – Link travel times.
  • energyConsumptionParameters – Energy consumption parameters (A, B, C, D) for a combination of vehicle type and engine type.
  • relativeFuelEfficiency – Relative fuel efficiency compared to the base year.
  • energyUnitCosts – Energy unit costs.
  • congestionCharges – Congestion charges.
  • params – Route choice parameters.

contains

public boolean contains(Edge edge)

Checks if route contains the edge.

Parameters:
  • edge – Edge object.
Returns:

True if route contains the edge.

contains

public boolean contains(int edgeID)

Checks if route contains the edge.

Parameters:
  • edgeID – Edge id.
Returns:

True if route contains the edge.

equals

public boolean equals(Object obj)

getCost

public double getCost()

Getter method for route cost.

Returns:Route cost.

getDestinationNode

public DirectedNode getDestinationNode()

Getter method for destination node.

Returns:Destination node.

getEdges

public TIntArrayList getEdges()

Getter method for the list of edges.

Returns:List of edge IDs.

getFormattedString

public String getFormattedString()

Gets formatted string representation of the route.

Returns:Route as a string.

getFormattedStringEdgeIDsOnly

public String getFormattedStringEdgeIDsOnly()

Gets formatted string representation of the route using edge IDs only.

Returns:Route as a string.

getLength

public double getLength()

Getter method for route length.

Returns:Route length.

getNumberOfIntersections

public int getNumberOfIntersections()

Getter method for number of intersections.

Returns:Number of intersections.

getOriginNode

public DirectedNode getOriginNode()

Getter method for route origin node.

Returns:Origin node.

getRoadNetwork

public RoadNetwork getRoadNetwork()

Getter method for the road network.

Returns:Road network.

getTime

public double getTime()

Getter method for route time.

Returns:Route time.

getUtility

public double getUtility()

Getter method for route utility.

Returns:Route utility.

hashCode

public int hashCode()

isEmpty

public boolean isEmpty()

Checks if route is empty or not.

Returns:True if route is empty.

isValid

public boolean isValid()

Checks if route is valid (successive edges in the route are connected in a directional way).

Returns:True if route is valid.

setUtility

public void setUtility(double utility)

Setter method for route utility.

Parameters:
  • utility – Route utility.

toString

public String toString()

trimToSize

public void trimToSize()

Trims edges list to size and calculate length (onetime operation).