Computational Complexity of Air Travel Planning (2003) [pdf]
demarcken.org
demarcken.org
- AC can take off/land on AP (runway is long enough, runway material is compatible, flight rules are ok)
- P is close enough (by car) to AP
- P is allowed to fly to AC
- P is available during out/inbound flight
- AP opening hours are respected
- AP fees (depending on AC and passengers) are respected
- AC is available during out/inbound flight
- travel time affects many of the above criteria, e.g., faster machines might fly to different airports (more because they're still open, less because they require longer/better runways)
- when changing countries you need to go through an airport with customs
- when travelling long ranges, you need to refuel
- weights of passenger + luggage + fuel don't exceed predefined aircraft weight constraints
- You may need to fly your AC to AP1 to pick up the passengers, then refuel at AP2 and declare your goods there and deliver all at AP3 and then go back efficiently (possible skipping AP1 and/or AP2) or stay there and wait for the passengers to go back using a different AP when declaring your goods upon reentry into your original country.
I'm doing this mostly using application logic (travel planning) and postgres queries (finding travel legs) and it works well for 1k airports and 300 machines but if anyone has suggestions or questions, I'll be happy to share details.
I was once doing research for an optimization task and found out the related term is "integer programming". Compared to linear optimization the difference is that you have integer constraints. Like the plane either flies or it does not, you can't use 0.9 of this plane and 0.1 of the other. It was also revealing to find out the problem is NP-complete, so there's no easy solution or some magical algorithm.
In your case, the proper thing might be mixed-integer programming. Setting some constraints as integers (you need to have 2 pilots, they need to be the same for the whole flights) and others like travel speed as linear.
I was checking these years ago and at least back then there was not too many open source packages for this kind of optimization. Various commercial packages did exist.
The performance of commercial solvers (Gurobi, CPLEX, Xpress) has improved a lot and many are used in things like airline crew scheduling. The best open-source MIP solver is currently CBC (SCIP is better but only free for non-commercial use), but commercial solvers beat these by a mile. Even so large-scale MIPs are still complex beasts. It's worth noting that if the problem doesn't require any optimization (merely constraint satisfaction), MIPs might be overkill. A rules engine would probably be easier to implement and maintain. Even SQL (which is set theory in disguise) will often get you most of the way there. And if optimization was needed, a greedy algorithm would probably work most of the time.
There are many successful commercial applications of MIPs but typically they are in circumscribed areas. MIPs are best deployed when there is a definite need for an optimal result, and when there is expertise available to maintain the resulting complex models. (Note: even ITA software in the linked article didn't attempt to model the problem as an MIP)
[1] https://www.artelys.com/uploads/pdfs/Xpress/mipformref-1.pdf
ITA's code now powers Google Flights.
http://programming-puzzler.blogspot.com/2013/03/logic-progra...
I'm also trying to put as much logic as possible into SQL (because it's declarative and can easily be reordered) but eventually you have too many conditionals to handle it in SQL, especially when high level parameters are involved that change whole queries and you'd have therefore conditional subqueries that can't easily be joined (e.g., flight paths, like ADA, ABDA, ABDBA, ZADAZ) where A/D is source/destination of the passenger.
IANAL and IANAAmerican, so I'm not familiar with the specifics of regulatory stupidity in the US, but from what I see two things don't apply here:
1. We're really the uber and not the ride-sharing uber. 2. We operate in Europe
I wonder why flytenow didn't just move their operations to Europe, or Asia. Are you in any way connected to those guys? Would be interesting to hear how they did it (technically) and why they didn't move to some other continent.
U.S. Federal Aviation Regulations (FAR) — or Title 14 of the Code of Federal Regulations (CFR) — Part [91] covers personal flights, FAR Part [135] charter and cargo operations, and, for completeness, FAR Part [121] commercial air carriers. Under Part 91, pilots may accept pro rata share of direct costs from passengers. Flytenow sought to facilitate ride sharing based on this allowable cost sharing, but the FAA determined that advertising planned flights to the general public would be “holding out,” behavior reserved for commercial operators and therefore a no-no.
As for why they didn’t move, I suspect the sizes of the general aviation markets in the U.S., Europe, and Asia carried at least some weight.
[91]: https://www.ecfr.gov/cgi-bin/text-idx?node=pt14.2.91
[121]: https://www.ecfr.gov/cgi-bin/text-idx?node=pt14.3.121
[135]: https://www.ecfr.gov/cgi-bin/text-idx?node=pt14.3.135