Flight Gate Assignment API Reference
Data
Data model for Flight Gate Assignment use case.
FlightGateAssignmentData
Bases: UcData
Data for the Flight Gate Assignment (FGA) use case.
The Flight Gate Assignment problem assigns flights to airport gates so that total passenger transit time (to baggage claim and check-in) is minimised while respecting time-overlap constraints.
Attributes:
-
name(Literal['flight_gate_assignment']) –Identifier for this data type.
-
n_flights(int) –Number of flights to assign.
-
n_gates(int) –Number of available gates.
-
arrival_passengers(list[int]) –Number of arriving passengers per flight.
-
departure_passengers(list[int]) –Number of departing passengers per flight.
-
flight_times(list[tuple[float, float]]) –(arrival_time, departure_time)per flight. -
gate_to_terminal(NumPyArray) –Shape
(n_gates, 2)-- distances from each gate to baggage claim (column 0) and check-in (column 1). -
buffer_time(float) –Minimum buffer time between consecutive flights at the same gate.
plot(*, ax: Axes | None = None) -> Axes
Plot the flight schedule as a timeline.
Parameters:
-
ax(Axes | None, default:None) –Matplotlib axes to draw on. Creates a new figure if
None.
Returns:
-
Axes–The axes with the plot.
to_string() -> str
Return a string describing the data.
from_schedule(arrival_passengers: list[int], departure_passengers: list[int], flight_times: list[tuple[float, float]], gate_to_terminal: np.ndarray | list[list[float]], buffer_time: float = 0.5) -> FlightGateAssignmentData
staticmethod
Create FlightGateAssignmentData from a flight schedule.
Parameters:
-
arrival_passengers(list[int]) –Number of arriving passengers per flight.
-
departure_passengers(list[int]) –Number of departing passengers per flight.
-
flight_times(list[tuple[float, float]]) –(arrival_time, departure_time)per flight. -
gate_to_terminal(ndarray | list[list[float]]) –Shape
(n_gates, 2)-- distances from each gate to baggage claim (column 0) and check-in (column 1). -
buffer_time(float, default:0.5) –Minimum buffer time between consecutive flights at the same gate, by default 0.5.
Returns:
-
FlightGateAssignmentData–A data instance with the given schedule.
generate_random(n_flights: int = 4, n_gates: int = 3, seed: int | None = None) -> FlightGateAssignmentData
staticmethod
Generate a random Flight Gate Assignment instance.
Parameters:
-
n_flights(int, default:4) –Number of flights, by default 4.
-
n_gates(int, default:3) –Number of gates, by default 3.
-
seed(int | None, default:None) –Random seed for reproducibility, by default None.
Returns:
-
FlightGateAssignmentData–A randomly generated instance.
Formulation
Formulation for Flight Gate Assignment use case.
FlightGateAssignmentFormulation
Bases: UcFormulation[FlightGateAssignmentData, FlightGateAssignmentSolution]
Constraint-based formulation for Flight Gate Assignment.
Mathematical Formulation
Decision Variables: x[f,g] binary -- flight f assigned to gate g
Objective: minimize sum_{f,g} (arr_pax[f]dist[g,0] + dep_pax[f]dist[g,1]) * x[f,g]
Constraints: 1. Each flight exactly one gate: sum_g x[f,g] == 1 2. Non-overlapping: x[f1,g] + x[f2,g] <= 1 for overlapping pairs
to_string(data: FlightGateAssignmentData) -> str
staticmethod
Return a string describing the formulation.
formulate(data: FlightGateAssignmentData) -> Model
staticmethod
Formulate the Flight Gate Assignment problem.
Parameters:
-
data(FlightGateAssignmentData) –The problem data.
Returns:
-
Model–A Luna Model ready to be solved.
interpret(solution: Solution, data: FlightGateAssignmentData) -> FlightGateAssignmentSolution
staticmethod
Extract solution from solver result.
Parameters:
-
solution(Solution) –The solver solution.
-
data(FlightGateAssignmentData) –The problem data.
Returns:
-
FlightGateAssignmentSolution–Structured solution with assignments and metrics.
Solution
Solution model for Flight Gate Assignment use case.
FlightGateAssignmentSolution
Bases: UcSolution
Solution for the Flight Gate Assignment (FGA) use case.
Attributes:
-
name(Literal['flight_gate_assignment']) –Identifier for this solution type.
-
assignments(dict[int, int]) –Mapping from flight index to gate index.
-
total_transit_time(float) –Total weighted transit time (objective value).
-
is_valid(bool) –Whether the solution satisfies all constraints.
plot(data: FlightGateAssignmentData | None = None, *, ax: Axes | None = None) -> Axes
Plot the gate assignment as a Gantt chart.
Parameters:
-
data(FlightGateAssignmentData | None, default:None) –Problem data for time information.
-
ax(Axes | None, default:None) –Matplotlib axes to draw on. Creates a new figure if
None.
Returns:
-
Axes–The axes with the plot.
to_string() -> str
Return a string describing the solution.
Instance
Instance model for FlightGateAssignment use case.
FlightGateAssignmentInstance
Bases: UcInstance[FlightGateAssignmentData, FlightGateAssignmentFormulation, FlightGateAssignmentSolution]
Instance combining data and formulation for FlightGateAssignment.
Collection
Collection of Flight Gate Assignment instances.
FlightGateAssignmentCollection
Bases: UcInstanceCollection[FlightGateAssignmentInstance]
Collection of Flight Gate Assignment instances.
from_random(min_flights: int, max_flights: int, n_gates: int = 3, num_instances: int = 1, *, seed: int | None = None) -> FlightGateAssignmentCollection
classmethod
Generate random Flight Gate Assignment instances.
Parameters:
-
min_flights(int) –Minimum number of flights.
-
max_flights(int) –Maximum number of flights.
-
n_gates(int, default:3) –Number of gates, by default 3.
-
num_instances(int, default:1) –Number of instances per flight count, by default 1.
-
seed(int | None, default:None) –Random seed for reproducibility, by default None.
Returns:
-
FlightGateAssignmentCollection–Collection containing generated instances.