nrel.hive.model.roadnetwork.routetraversal

Module Contents

Classes

RouteTraversal

A tuple that represents the result of traversing a route.

Functions

traverse(→ Tuple[Optional[Exception], ...)

step through the route from the current agent position

class nrel.hive.model.roadnetwork.routetraversal.RouteTraversal[source]

Bases: NamedTuple

A tuple that represents the result of traversing a route.

Parameters:
  • remaining_time – The (estimated) time remaining in the route.

  • travel_distance (kilometers) – The distance of the experienced route.

  • experienced_route (Route) – The route that was traversed during a traversal.

  • remaining_route (Route) – The route that remains after a traversal.

remaining_time_seconds: nrel.hive.util.units.Seconds = 0
traversal_distance_km: nrel.hive.util.units.Kilometers = 0
experienced_route: nrel.hive.model.roadnetwork.route.Route = ()
remaining_route: nrel.hive.model.roadnetwork.route.Route = ()
no_time_left()[source]

if we have no more time, then end the traversal

Returns:

True if the agent is out of time

add_traversal(t: nrel.hive.model.roadnetwork.linktraversal.LinkTraversalResult) RouteTraversal[source]

take the result of a link traversal and update the route traversal

Parameters:

t – a link traversal

Returns:

the updated route traversal

if a link wasn’t traversed, be sure to add it to the remaining route

Parameters:

link – a link traversal for the remaining route

Returns:

the updated RouteTraversal

nrel.hive.model.roadnetwork.routetraversal.traverse(route_estimate: nrel.hive.model.roadnetwork.route.Route, duration_seconds: nrel.hive.util.units.Seconds, road_network: nrel.hive.model.roadnetwork.roadnetwork.RoadNetwork) Tuple[Exception | None, RouteTraversal | None][source]

step through the route from the current agent position (assumed to be start.link_id) toward the destination

Parameters:
  • route_estimate – the current route estimate

  • duration_seconds – size of the time step for this traversal, in seconds

  • road_network – the road network; used to get current travel times

Returns:

a route experience and updated route estimate; or, nothing (None, Empty RouteTraversal) if the route is consumed. an exception is possible if the current step is not found on the link or the route is malformed.