Comments on: The Computational Complexity of Air Travel Planning
http://www.metafilter.com/22185/The-Computational-Complexity-of-Air-Travel-Planning/
Comments on MetaFilter post The Computational Complexity of Air Travel PlanningMon, 09 Dec 2002 14:06:07 -0800Mon, 09 Dec 2002 14:06:07 -0800en-ushttp://blogs.law.harvard.edu/tech/rss60The Computational Complexity of Air Travel Planning
http://www.metafilter.com/22185/The-Computational-Complexity-of-Air-Travel-Planning
<a href="http://www.itasoftware.com/news/pr/siam.php">Do you have problems finding the cheapest flight? </a> <a href="http://www.maa.org/devlin/devlin_09_02.html">Well so do computers.</a><br />
<a href="http://www.demarcken.org/carl/">Carl de Marcken</a>, the man who created the engine behind <a href="http://www.orbitz.com">Orbitz</a> and other travel search engines <a href="http://mailman.cs.uchicago.edu/pipermail/visitors/2002-March/000063.html">posits</a> that finding the cheapest fare from one point to another is a <a href="http://www.nist.gov/dads/HTML/nphard.html">NP-Hard</a> problem. Even if you fix the specific route between destinations there can be as many as 10<sup>36</sup> combinations.post:www.metafilter.com,2002:site.22185Mon, 09 Dec 2002 13:39:26 -0800patrickjeCarlDeMarckendeMarckenflightsairlinestravelcheapmathematicscomputerscomplexityNPHardbrokenlinkBy: abez
http://www.metafilter.com/22185/The-Computational-Complexity-of-Air-Travel-Planning#400426
I'm surprised non of the articles mentioned that the problem is called the <a href="http://www.math.princeton.edu/tsp/">travelling salesman problem</a> or TSP. TSP is quite studied and suffers from combinatorial explosions in route finding.
TSP applies to routes like this because instead of using distance you use price so you want to find the minimum priced route not the minimum distance route. Now I'm assuming this is a TSP problem because you want to come back home. It's very easy to come up with a shortest path from A to B.comment:www.metafilter.com,2002:site.22185-400426Mon, 09 Dec 2002 14:06:07 -0800abezBy: vbfg
http://www.metafilter.com/22185/The-Computational-Complexity-of-Air-Travel-Planning#400435
It is TSP, but it's TSP with an extra layer. With TSP you want to make the journey as short as possible without passing through the same place twice. That isn't necessarily true with this problem. You don't want to go somewhere and come back to where you started, but then you don't necessarily want the shortest number of hops. Sometimes you'll want to get there as quickly as possible. Some people will want to get there as cheaply as possible. The two may have completely different solutions.comment:www.metafilter.com,2002:site.22185-400435Mon, 09 Dec 2002 14:13:30 -0800vbfgBy: Hjorth
http://www.metafilter.com/22185/The-Computational-Complexity-of-Air-Travel-Planning#400436
<i>I'm surprised non of the articles mentioned that the problem is called the travelling salesman problem or TSP ... </i>
In fact, the last link does in the third line of the definition. Other than that an interesting comment abez.comment:www.metafilter.com,2002:site.22185-400436Mon, 09 Dec 2002 14:13:48 -0800HjorthBy: patrickje
http://www.metafilter.com/22185/The-Computational-Complexity-of-Air-Travel-Planning#400475
The traveling salesman problem only solves part of it, and in fact is a trivial problem in regard to the overall solution. Most destination-to-destination routes have 'preferred routes' stored in a lookup somewhere rather than run through the TSP every time. The difficult problem is that sometimes the cheapest flight from Boston to New York involves a stop in London or Vegas. TSP doesn't really take into account multi-dimensional routes (i.e. this path is 10 miles long and costs $50). Overall it's a fascinating problem.comment:www.metafilter.com,2002:site.22185-400475Mon, 09 Dec 2002 15:01:43 -0800patrickjeBy: abez
http://www.metafilter.com/22185/The-Computational-Complexity-of-Air-Travel-Planning#400486
TSP doesn't have to take "multi-dimensional" routes into account. What should've been said is that this problem is easily reducable to a TSP. Such that if you want a balance between hops/distance/time you simply weight your edges differently. It's up to you to come up with a good encoding which best describes your situation and your goals.comment:www.metafilter.com,2002:site.22185-400486Mon, 09 Dec 2002 15:22:43 -0800abezBy: smrtsch
http://www.metafilter.com/22185/The-Computational-Complexity-of-Air-Travel-Planning#400506
Thanks for the great links, patrickje. They answered many of my questions about why I have such strange experiences when searching for the cheapest flights. Inexplicably, I find it reassuring that the intricacies of airfare-pricing result more from the complexity of the problem than from some vast conspiracy on the part of the airlines to confuse their customers. I'm not sure I can say the same for unfathomable long-distance calling plans.comment:www.metafilter.com,2002:site.22185-400506Mon, 09 Dec 2002 15:49:26 -0800smrtschBy: cameldrv
http://www.metafilter.com/22185/The-Computational-Complexity-of-Air-Travel-Planning#400517
I don't think that this is a TSP issue per se. It's been known for some time that if you say "I want to visit cities A, B, C, D, and I don't care what order I visit them", then the problem is NP-complete. If you say "I want to visit A, then B, then C, then D", then the problem is in P. If they are trying to solve TSP problems, then it is no surprise that it's NP.
The article is a bit weak on details, but I think that a couple of the issues that make this NP are time constraints, and weird airline rules. If you say "I must be back by 6:00pm Thursday", you can't just address this by reweighting the graph. Even if you factor in time with price for the weights, you might get a really cheap flight that gets you in after the deadline, or you might find a really fast flight that gets you in way early, but costs a lot. The question is not a tradeoff between time and price, but a constraint on time while minimizing price.
The other issue is weird airline rules. For example, you get a better deal if you have a Saturday night stay. Now suppose you want to go A->B->C->A, and you are planning on spending saturday in C. The obvious routing is 3 one-way tickets. However, it might be cheaper to get a round-trip ticket from A->B, and a round-trip ticket from B->C. Thus on the way home, you backtrack to B. This allows you to have two round-trips with Saturday night stays, which is probably cheaper than 3 one-way tickets even though it's 4 flights instead of 3. The key issue though is that the best way to get from B->C is conditional on how you got from A->B. This is a SAT type problem, as was mentioned in the article.comment:www.metafilter.com,2002:site.22185-400517Mon, 09 Dec 2002 16:05:37 -0800cameldrvBy: NGnerd
http://www.metafilter.com/22185/The-Computational-Complexity-of-Air-Travel-Planning#400523
My question is at what point does this all become diminishing returns. Yes, it's cheaper to travel from boston to london to new york, but at 18 hours it's cheaper to take the bus. I can see the value of adding complexity for more arcane flights, but really, how many people travel from white plains to minnesota (sheesh, just take the train in to kennedy). Is this a problem of mathematical prowess or actual usefulness?comment:www.metafilter.com,2002:site.22185-400523Mon, 09 Dec 2002 16:11:42 -0800NGnerdBy: KettleBlack
http://www.metafilter.com/22185/The-Computational-Complexity-of-Air-Travel-Planning#400547
While there is no solution to the travelling salesman problem, it should be noted that 1. nobody has yet proved that there is no way to find the shortest route and 2. there are ways of findiing very short routes consistantly. I hear that quantum computers may be the key to this problem, since matter at the quantum level has a tendency to do odd things (like exist in two places at the same time). o<comment:www.metafilter.com,2002:site.22185-400547Mon, 09 Dec 2002 16:45:09 -0800KettleBlackBy: dhartung
http://www.metafilter.com/22185/The-Computational-Complexity-of-Air-Travel-Planning#400552
One can also see that this has commonalities with chess computation methods, where you need to look multiple "hops" in advance. But those are usually made easier not by an elegant algorithm, but by a brute-force elimination of unlikely possibilities. (This is how Deep Blue got so good, essentially.) For instance, booking a flight from Chicago to Miami (as my Dad just did last night with my help, via Orbitz!) can presumably skip all the flights that involve stopovers in Kinshasa.
Savvy travelers, too, know that cultural imperatives outside of simple economics make Las Vegas a terrific place to fly through for a low fare. It can be cheaper to fly from Chicago to Las Vegas to Miami than just Chicago to Miami (if travel time is no object). The airlines know this, too, so they probably have systems like Orbitz avoid suggesting such fares.comment:www.metafilter.com,2002:site.22185-400552Mon, 09 Dec 2002 16:48:55 -0800dhartungBy: mfli
http://www.metafilter.com/22185/The-Computational-Complexity-of-Air-Travel-Planning#400556
<i>While there is no solution to the travelling salesman problem</i>
There is a solution to the TSP problem. In fact, there are many ways of finding a solution to the TSP problem. They are just not polynomial in running time with respect to the input.
I think what you meant to say is that there are many "simple" or polynomial algorithms that approximate the solution, but may not be the <i>actual</i> shortest path.comment:www.metafilter.com,2002:site.22185-400556Mon, 09 Dec 2002 16:52:46 -0800mfliBy: Shane
http://www.metafilter.com/22185/The-Computational-Complexity-of-Air-Travel-Planning#400583
Airline pricing formula attempts to say,
"How much does this seat cost?" = "How much is the customer willing to pay for it?"
-or-
How much can we squeeze out of the customer? (I know, it's actually a matter of varying optimal prices, etc. Basically the same deal.)
If you need to fly at the last minute and you <i>must</i> have the seat, then surely you're willing to shell out...
Big travel agent joke = <a href="http://fly-for-less.net/airline_joke/whatifairlines.htm">"What if the Airlines Sold Paint?" </a><small>(Scroll down aprox. half way.)</small> It's soooo true... Great joke, really, and it applies to some hotel pricing systems now too. It's a trend...comment:www.metafilter.com,2002:site.22185-400583Mon, 09 Dec 2002 17:45:15 -0800ShaneBy: rhyax
http://www.metafilter.com/22185/The-Computational-Complexity-of-Air-Travel-Planning#400632
There was a really neat nucleic acid computer used to solve a version of the TSP in science, <a href="http://www.princeton.edu/~lfl/Seife.html">here</a> is something I found about it. They added a bunch of nucleic acids together that were created to represent the possible paths, then as they anneal in all combinations an enzyme will come and cull the longer ones, the result is the shortest path. This is brute force I guess, but it's not slow.comment:www.metafilter.com,2002:site.22185-400632Mon, 09 Dec 2002 20:33:23 -0800rhyaxBy: walrus
http://www.metafilter.com/22185/The-Computational-Complexity-of-Air-Travel-Planning#400722
It is easily reducible to the TSP, and is therefore NP-Complete, not NP-Hard. Heuristic solutions exist: it's all a question of balancing your tolerance for error against your need for speed. I've used the <a href="http://www.ee.surrey.ac.uk/SCRIBA/ndf/kirkpatrick.html">Simulated Annealing (Kirkpatrick, Gelatt, Vecchi) </a> heuristic to good effect for some classes of TSP, but this is certainly going to be a big tour, with lots of interesting constraints, as pointed out. Moore's law only goes so far, KettleBlack: you can keep throwing computing power at it, but you had better hope your computing power increases at a faster rate than the size of the problem ...comment:www.metafilter.com,2002:site.22185-400722Tue, 10 Dec 2002 02:56:35 -0800walrusBy: mfli
http://www.metafilter.com/22185/The-Computational-Complexity-of-Air-Travel-Planning#400779
Actually, combinatorial problems like the TSP have two different problems associated with them.
There is the decision problem: does there exist a Hamiltonian cycle (a cycle that includes all vertices/cities) of length <= k in the graph?
And the optimization problem: what is the shortest Hamiltonian cycle?
If you follow the definition of NP-hard given by the poster, then the decision problem is NP-complete, and the optimization problem is NP-hard.
This mainly because it's difficult to verify the optimization problem. For example, if I gave you a cycle, and claimed that it's the shortest one, how would you verify that what I gave you is indeed the shortest one (can you do it polynomial time)? On the other hand, if I gave you a cycle, and claimed that it's of size <= k, it's very easy to verify (just go through the cycle and add up the weights, which can be done in polynomial time). And that's the difference between NP-complete and NP-hard. NP-complete problems are also in NP, whereas NP-hard ones may not be.comment:www.metafilter.com,2002:site.22185-400779Tue, 10 Dec 2002 05:21:29 -0800mfliBy: walrus
http://www.metafilter.com/22185/The-Computational-Complexity-of-Air-Travel-Planning#400817
Thanks for the correction, mfli. I should know that.comment:www.metafilter.com,2002:site.22185-400817Tue, 10 Dec 2002 06:22:00 -0800walrusBy: stuart_s
http://www.metafilter.com/22185/The-Computational-Complexity-of-Air-Travel-Planning#401223
mfli spoke the truth, but I had to read it a couple times to sort it all out. I'm surprised that no one has pointed to formal definitions. Yet.
<a href="http://mathworld.wolfram.com/P-Problem.html">P</a> = polynomial. Such a problem can be solved in polynomial time. That is, the time amount of work required to solve the problem is roughly proportional to the size of the input raised to some power.
<a href="http://mathworld.wolfram.com/NP-Problem.html">NP</a> = nondeterministic polynomial. An NP problem can be checked in polynomial time. That is, given a solution, checking the accuracy of the solution is a P problem.
Obviously, a P problem is an NP problem. <i>It is an important unsolved problem to determine if all apparently NP problems are actually P. </i>
<a href="http://mathworld.wolfram.com/NP-HardProblem.html">NP-Hard </a>: <i>A problem is NP-hard if an algorithm for solving it can be translated into one for solving any other NP-problem (nondeterministic polynomial-time) problem.</i>
<a href="http://mathworld.wolfram.com/NP-CompleteProblem.html">NP-Complete</a>: A problem which is both NP and NP-Hard.
Trivially, this implies that any NP-Complete problem is NP-Hard which contradicts a previous comment. Also finding a polynomial time algorithm for a single NP-Complete problem is much like finding an algorithm for all NP problems. Such an algorithm would answer (affirmatively) the question of whether NP and P are equivalent.comment:www.metafilter.com,2002:site.22185-401223Tue, 10 Dec 2002 14:10:47 -0800stuart_sBy: KettleBlack
http://www.metafilter.com/22185/The-Computational-Complexity-of-Air-Travel-Planning#401234
Oh come on surely a beowulf cluster and linux can handle this!!!!!!!!! am i rite??!?!/1 This sort of problem is noethng gnu 2 me!comment:www.metafilter.com,2002:site.22185-401234Tue, 10 Dec 2002 14:20:20 -0800KettleBlack