How to Schedule Flights in Python

Assign Enough Airplanes while Minimizing the Cost using CVXPY

Khuyen Tran
Towards Data Science
5 min readJul 7, 2021

--

Motivation

Imagine you are an owner of an airline. Your airline needs to assign its airplanes based in New York to cover all the upcoming scheduled flights.

There are 10 flights and 8 sequences of flights. Each sequence of flights consists of multiple flights.

For example, a sequence of flights can consist of flights from New York to Buffalo, from Buffalo to Chicago, and from Chicago to New York.

Image by Author

Each flight sequence has a certain cost. We need to select a subset of flight sequences so that there is at least one airplane for each flight.

There are many possible ways to select a combination of flight sequences so that there is a plane available for each flight. One possible combination is like this:

--

--