Skip to content

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 Type Description
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:

Name Type Description Default
ax Axes | None

Matplotlib axes to draw on. Creates a new figure if None.

None

Returns:

Type Description
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:

Name Type Description Default
arrival_passengers list[int]

Number of arriving passengers per flight.

required
departure_passengers list[int]

Number of departing passengers per flight.

required
flight_times list[tuple[float, float]]

(arrival_time, departure_time) per flight.

required
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).

required
buffer_time float

Minimum buffer time between consecutive flights at the same gate, by default 0.5.

0.5

Returns:

Type Description
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:

Name Type Description Default
n_flights int

Number of flights, by default 4.

4
n_gates int

Number of gates, by default 3.

3
seed int | None

Random seed for reproducibility, by default None.

None

Returns:

Type Description
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:

Name Type Description Default
data FlightGateAssignmentData

The problem data.

required

Returns:

Type Description
Model

A Luna Model ready to be solved.

interpret(solution: Solution, data: FlightGateAssignmentData) -> FlightGateAssignmentSolution staticmethod

Extract solution from solver result.

Parameters:

Name Type Description Default
solution Solution

The solver solution.

required
data FlightGateAssignmentData

The problem data.

required

Returns:

Type Description
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 Type Description
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:

Name Type Description Default
data FlightGateAssignmentData | None

Problem data for time information.

None
ax Axes | None

Matplotlib axes to draw on. Creates a new figure if None.

None

Returns:

Type Description
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:

Name Type Description Default
min_flights int

Minimum number of flights.

required
max_flights int

Maximum number of flights.

required
n_gates int

Number of gates, by default 3.

3
num_instances int

Number of instances per flight count, by default 1.

1
seed int | None

Random seed for reproducibility, by default None.

None

Returns:

Type Description
FlightGateAssignmentCollection

Collection containing generated instances.