Flight Optimizer

build_graph(aircraft, flight_lines, airports)[source]

Build a directed graph connecting airports and flight line endpoints.

Nodes:
  • Airport nodes keyed by ICAO code

  • Flight line endpoint nodes keyed by “{site_name}_start” and “{site_name}_end”

Edges:
  • flight_line: along each flight line (both directions)

  • departure: airport -> flight line endpoint

  • transit: between flight line endpoints (via Dubins path)

  • return: flight line endpoint -> airport

All edge weights are transit time in hours.

Parameters:
  • aircraft (Aircraft) – Aircraft to use for performance calculations.

  • flight_lines (list) – List of FlightLine objects.

  • airports (list) – List of Airport objects (potential departure/return/refuel points).

Return type:

DiGraph

Returns:

nx.DiGraph with time-weighted edges.

greedy_optimize(aircraft, flight_lines, airports, takeoff_airport, return_airport=None, max_endurance=None, refuel_time=0.5, max_daily_flight_time=None, takeoff_landing_overhead=0.25, max_days=1)[source]

Greedy nearest-neighbor optimization of flight line ordering.

Builds a graph of all flight lines and airports, then iteratively selects the closest feasible unvisited flight line, inserting refuel stops when endurance limits would be exceeded. Supports multi-day missions where daily flight time resets each day.

Parameters:
  • aircraft (Aircraft) – Aircraft performing the mission.

  • flight_lines (list) – List of FlightLine objects to cover.

  • airports (list) – List of Airport objects available for refueling.

  • takeoff_airport (Airport) – Departure airport.

  • return_airport (Airport) – Return airport (defaults to takeoff_airport).

  • max_endurance (float) – Maximum flight time in hours before refueling. Defaults to aircraft.endurance.

  • refuel_time (float) – Time in hours for refueling stop (default 0.5).

  • max_daily_flight_time (float) – Maximum flying hours per day. Defaults to aircraft.endurance (no daily limit beyond endurance).

  • takeoff_landing_overhead (float) – Time in hours for takeoff/landing procedures not captured in route calculations (default 0.25).

  • max_days (int) – Maximum number of flight days (default 1).

Returns:

  • “flight_sequence”: list of FlightLine objects in order flown

  • ”route”: list of node names traversed

  • ”total_time”: total mission time in hours (across all days)

  • ”daily_times”: list of flight time per day

  • ”lines_covered”: number of flight lines flown

  • ”lines_skipped”: list of line keys that were infeasible

  • ”refuel_stops”: list of airport ICAO codes where refueling occurred

  • ”days_used”: number of days used

  • ”takeoff_airport”: Airport object

  • ”return_airport”: Airport object

  • ”graph”: the constructed DiGraph

Return type:

dict with