A collection of thoughts, ideas, and opinions independently written by members of the MSU community and curated by MSU Libraries

Optimized walking tours of New York City and Philadelphia

In the past couple weeks, I’ve shown you how to use machine learning to improve the efficiency of road trips all over the world, including the U.S., Europe, and South America. In this post, I’d like to show you how we can use the exact same algorithm to optimize walking tours in large cities.

If you’re anything like me whenever you stop in a big city, you have a few main attractions that you’d like to visit and end up haphazardly spending half your day staring at maps and trying to figure out the public transit system.

However, by focusing on a limited few attractions, we’re missing out on dozens of interesting places that we could’ve visited along the way. This is where the route optimization algorithm can come into play again: If we hand the algorithm the list of popular attractions in a city, it can provide us an efficient walking tour around the city that hits all of those attractions.

Below, I’ve mapped out optimized walking tours for New York City and Philadelphia that hit the most popular attractions in each city according to TripAdvisor. These walking tours by no means represent the “definitive” walking tours for the cities, but both tours are guaranteed to give you a great taste of the cities while you’re there.

Optimized walking tour of New York City

If skyscrapers, museums, and large crowds are your gig, then this walking tour is for you. In 4.5 hours of walking, you’ll hit major sights like Central Park, Times Square, the Empire State Building, the Statue of Liberty, and more. This walking tour covers 14 miles of Manhattan, so come prepared with your walking shoes for what will add up to a half marathon.

Of course, if you want to stop and actually enjoy the sights along the way (which I strongly advise!), this tour could easily end up taking several days. Between long lines, hour-long museum tours, and frequent stops for Cronuts, you’ll likely only be able to hit a handful of stops per day before everything closes down. Keep that in mind when dividing this trip up over several days.

If 14 miles of walking sounds like too much, you can easily cut down on walking by taking the subway or bus for some of the longer legs of the trek. Or better yet, the same tour can be followed on a bike instead.

Optimized walking tour of Philadelphia

The Liberty Bell, cheese steaks, and obnoxious sports fans: These are some of the things that Philadelphia is widely known for. But did you know that Philadelphia is home to one of the largest urban park systems in the U.S.? Or that it’s home to America’s first zoo?

This 12-mile, 4-hour walking tour will take you through some of the best that Philadelphia has to offer, from beautiful parks to historic landmarks to breathtaking outdoor art collections. Again, don’t take this tour lightly, and plan to spend at least a few days in total enjoying the sights.

The same disclaimers from the NYC walking tour apply here: If 12 miles of walking sounds like too much, you can easily cut down on walking by taking public transit for some of the longer legs of the trek. Or better yet, the same tour can be followed on a bike instead.

Optimize your own walking tour

Undoubtedly, you’d like to pick your own stops in your own cities and optimize a walking tour around that. Well, you’re in luck!

If you’d like to customize your own walking tour, I’ve released the Python code I used in this project with an open source license and instructions for how to optimize your custom walking tour. If Google Maps can route in the city you want to take walking tour in, then this code will work for you.

Randy Olson is a Computer Science graduate research assistant at Michigan State University in Dr. Chris Adami’s lab specializing in artificial intelligence, artificial life, and evolutionary computation. He runs a research blog where he writes about Python, scientific computing, evolution, and AI. Randy is an ardent advocate of open science and regularly travels the U.S. to teach researchers scientific computing skills at Software Carpentry workshops.