Route Map#

class airlift.envs.route_map.RouteMap(map: Map, airports: List[Airport], plane_types: Optional[Collection[PlaneType]] = None, drop_off_area=None, pick_up_area=None)#

Defines the graph network between the Airports for each airplane model. Creates and controls all the edges as well as any malfunctions that may occur.

add_plane_models() None#

Creates a DiGraph for all airplane models and stores them in the self._graph dictionary

add_route(plane: PlaneType, start: Airport, end: Airport, time: int, cost: float, malfunction_generator: EventIntervalGenerator, bidirectional=True) None#

Adds an edge between two nodes. Populates the edge with airplane model, time, cost and adds a malfunction object to it.

Parameters:
  • plane_model – Airplane Model

  • airport1 – From Airport

  • airport2 – To Airport

  • time – Time to traverse the edge

  • cost – Cost of traversing the edge

  • malfunction_generator – Parameters for creating route malfunctions

  • bidirectional – Boolean, True if route is bidirectional.

add_vertices() None#

Add nodes to a graph based on coordinate position

get_available_routes(source: Airport, plane_type: PlaneType) Collection#

Gets all available routes from an Airport Node to ones it can directly travel to.

Parameters:
  • source – Source Airport

  • plane_model – Airplane Model

Returns:

frozenset : a frozenset that contains what routes are disabled/malfunctioning

get_flight_cost(start: Airport, end: Airport, plane: PlaneType) float#

Gets the flight cost associated with traversing from start to end airport.

Parameters:
  • start – Starting Airport

  • end – Ending Airport

  • plane – Airplane Model

Returns:

flight_distance : Returns the distance (cost) associated with traversing from start to end node

get_flight_time(start: Airport, end: Airport, plane: PlaneType) int#

Gets the flight time associated with traversing from start to end Airport.

Parameters:
  • start – Starting Airport

  • end – Ending Airport

  • plane – Airplane Model

Returns:

flight_time : Flight Time associated with traversing from start to end node

get_malfunction_time(source: int, destination: int, plane_type: PlaneType) int#

Returns the time remaining on a route being offline.

Parameters:
  • source – Starting Airport

  • destination – Destination Airport

  • plane_type – Airplane Model

Returns:

int: An integer that contains how long (in steps) an edge is malfunctioning for

get_total_malfunctions() int#

Returns total malfunctions in episode.

Returns:

int : An integer containing how many malfunctions have occurred

reachable(source: Airport, destination: Airport, plane_type: PlaneType) bool#

Checks to see if an airport is reachable from the current airport.

Parameters:
  • destination – Destination Airport

  • source – Starting Airport

  • plane_type – Airplane Model

Returns:

boolean : Returns True if an airplane can travel directly from source to destination

step()#

At each time step the routes are checked for malfunctions. If they are in a malfunction the route will become unavailable