I was recently explaining to someone the vagaries of my airline schedule, and the fact that my preferred overnights were not as available because of the way the trips had been changed. This led to a series of questions about the hows and whys of schedule construction.

Every airline tweaks its schedule from month to month and season to season. What is little realized is just how complex this process is. Even at an airline like Southwest or Spirit that only flies one fleet type, there are multiple models of the same airplane with varying seat capacities. At airlines that fly multiple fleet types, things get even more complicated. A flight that does well with an Airbus 319 (the smaller version of the Airbus 319/320 line) in the summer might need another 100 seats in the winter. This could mean a jump to 757-300 or even a 767. Other city pairs might be more predictable, or may be able to support multiple models of the 737 with various seating configurations.

Decisions about schedule changes are based on a combination of historical sales and demand data, as well as current and future demand, which is collected from surveys, website browsing data, and other sources. But it’s never as simple as just swapping out one airplane for another. If the fleet type is changed, this will drive analysis of pilot and flight attendant staffing and availability, which in turn drives training and hiring requirements.

Behind the scenes, there are other pieces that need to fall into place. For example, gate space is a major part of the puzzle. Every airline has optimized the schedule for turning an airplane at the gate, and the turn time is based on the size of the airplane. Between flights, they need to be cleaned, fueled, possibly attended to for maintenance, and stocked with food and drinks. The minimum time is driven not only by these items, but by brake cooling. But not every gate can service every airplane. Wide-body jets need higher jet bridges, and sometimes use more than one jet bridge to board and deplane. Most airports only have a handful of jetways for the wide bodies, and most of the wide body flights are those that take place during international departure banks, typically in the evenings. As if that isn’t enough, it’s possible that parking a wide body at a certain gate will render the adjoining gate or gates unusable. In addition, someone has to make sure that the staffing on the ground is adequate. Baggage handlers, gate agents, even wheelchair personnel need to be optimized.

There are also situations that the airlines can’t control. For example, in almost every city, hotel check-out time is around noon, and check-in time is around 3 p.m. This is so the hotel can get the rooms cleaned and turned over before new guests arrive. In relatively remote locations, the flight schedule reflects this. Likewise, cruise ships operate on a schedule, and airlines flying into Ft. Lauderdale, Miami, etc. will adjust their schedules accordingly. (That being said, anyone who books a flight to arrive on the same day that a cruise sets sail is playing with fire.)

On the flight operations side, not only do the pilots and flight attendants need to be available and scheduled, but it’s also important to take care of crewmember hotel rooms, transportation to and from the hotel, and where appropriate, crew meals on the flight. Remember, the crew that might have been scheduled to overnight in New Orleans last month may now be doing a turn and finishing up in Chicago.

Schedules are incredibly dynamic, and the changes never really stop. Every airline has to deal with minor updates and tweaks even after the monthly schedules for pilots are published. Some flights get canceled, others removed for training, and new ones added. An example of flights getting added at the last minute are common during the college football and basketball post-seasons, as well as the Super Bowl, when extra segments are added for fans to travel to the games. The flights can’t be scheduled or tickets sold until the participants are determined.

So, the next time you are sitting on an airplane on the ramp and waiting for a gate, try to remember that it isn’t as simple as “that gate I can see is open, why can’t we park there?” Last-minute gate changes are a last resort, and doing so can trigger delays further down the line. Likewise, when your favorite layovers are suddenly not so desirable for some reason, keep in mind that before you ever see the schedule, there are teams of people that have already done everything they can to optimize it, even if it might be to your detriment.