As I continue to apply analytics to various aspects of Halloween, I turn my attention to planning my trick-or-treat route ...
Random picture: Here's a shot of my friend Sara's trick-or-treat crew. With tiny legs, and huge loads of candy, having an efficient route is very important! :)
I started by creating a list of all the houses in my neighborhood, and determining the lat/long coordinate for each house. I stored this information in a SAS dataset, and now I can plot & analyze the data. Here's a simple scatter plot of the houses.
Now for the big question - what order should I visit the houses to be most efficient? I turned to SAS/OR's Proc OptNet for the answer. First I pre-processed the data, generating a list of every possible pair of houses, and then used the geodist() function to calculate the distance between each of those pairs. I then used Proc Optnet's TSP statement to utilize the traveling salesman problem algorithm to generate an efficient order in which to visit all the houses. Here is the resulting route:
And now, to put it all into context, I downloaded the nine openstreetmap map tile map images for this area, and annotated them behind the graph:
This produced quite a nice looking Halloween route map, if I do say so myself!
And it's not just a route map. Click the image above to see the interactive version of the map, and you can then click on each house and view the Wake County real estate data. This will let you know things like the owner & value of the house (perhaps more expensive houses give out more expensive candy?!? ... I guess I'll have to collect more data to determine whether that's true!)
How many houses do your kids visit at Halloween, and how do you plan your route? (feel free to leave a comment)