Friday, February 18, 2011

Frivolous Friday, 02.18.2011: The traveling programmer problem

In computer science, there is a class of real-life situations--no, really--that can't actually be modeled with mathematical and/or logical formulas. The shorthand for them is "NP-complete cases," and after brief exposure to the high-level concepts, it's pretty easy to believe that their real existence is to separate the "software architects" from the folks who chunk out working code for a living.

One such is the "traveling salesman problem." The salesman has to visit multiple cities on the map one--and only one--time each. Which sounds simple enough until you stipulate that you want him to minimize the distance traveled (and thus the cost) and also not cover any leg of the trip (i.e. the line between two cities) more than once.

To date, there is no "formula" to generate that route. Thia leaves two options:

  1. Approximation--i.e. the "close enough" approach, or
  2. Calculating all possible combinations--i.e. the "brute force" approach.

Even with today's computing Clydesdale-power, at a certain point, brute force isn't feasible. (Hint: Simply thumb through your old Algebra textbook until you find the section on factorials, if that helps.) Despite the misleading article title, approximation is currently the most viable option, and kudos, epic props, and a side of "w00t!" to Dr. Zhang for his coup.

That being said, it neither explains--much less excuses--the unadulterated ridiculousness on parade yesterday when I had to book tickets for a business-related trip. La Crosse, WI to Los Angeles, CA--how complex could this be?

Well, one option for the outgoing part of the trip that was surely calculated by the ghost of Christopher Columbus. On acid. Because the first leg went from La Crosse to Detroit, then backtracked from Detroit to Minneapolis, and then headed to Los Angeles.

Now, the funny thing I discovered about the travel-booking software that my firm uses is that, in this presumably more environmentally-conscious era, each leg of the trip now lists its estimated C02 emissions. As metrics go, I think that one was...ummmm...counterproductive...for recommending this particular route.

But wait! It gets better.

I had second thoughts about my departure time, so I bumped the homebound time out by all of one hour later. Sorting by the least expensive to most expensive fares, the least expensive fare--which, by the bye, was nearly $500 more than for one palty hour previous--had my route thus: Los Angeles to Boston to Chicago to La Crosse. And if all went according to plan--Oh, puh-leeeze: As if...--I would be home a day later than if I'd left an hour earlier.

I sooooo wish that I'd taken screenshots along the way so my gentle reader could see that I'm not exaggerating, much less making any of this up. Fortunately, one of my co-workers was on hand to help me navigate the web app., so I at least had the comfort of camaradarie in my freakitude.

Yet I couldn't help but notice multiple airline options for the exact same departure times--for the initial flight and the connecting flight. Okay, maybe for the initial flight--given how flights are staggered among multiple runways, that's not outside the realm of possibility. But the connecting flights departing at the same time? Really?! Is there some sort of race going on? Are the pilots planning to cruise the planes side by side so they can while away the time playing charades at 30,000 feet?

[insert much banging of forehead on desk--otherwise known as Left Brain Oxycontin]

Ahhhh... That's better. Sorta-kinda. As Bull Durham's Annie Savoy observed, "The world wasn't made for those of us cursed with self-awareness." Or those of us cursed with a rudimentary capacity for logic, I might add.

Sigh...

- - - - -

A friend emailed me something like this in the very late 1990s. In 2011, it's not nearly so funny. If you want to know why I call B.S. on the supposed "efficiencies" of oligopolies (and their alleged economies of scale), this is a good part of the reason.

(And to think I used to look forward to air travel...)