Todd W. Schneider

How Many Paths are Possible in an 18 Hole Round of Match Play Golf?

The Traveling Salesman with Simulated Annealing, R, and Shiny

Make your own tour with the interactive Shiny app

Here’s the Shiny app that lets you pick up to 30 cities on the map, set some parameters of the annealing schedule, then run the actual simulated annealing process (or just click ‘solve’ if you’re lazy). Give it a shot below! Bonus points if you recognize where the default list of cities comes from…

The app is hosted at ShinyApps.io, which is currently in alpha testing, so I’m not entirely sure how reliable it will be. If you want to run the app on your local machine, it’s very easy, all you need to do is paste the following into your R console:

1
2
3
install.packages(c("shiny", "maps", "geosphere"), repos="http://cran.rstudio.com/")
library(shiny)
runGitHub("shiny-salesman", "toddwschneider")

Code on GitHub

The full code is available at https://github.com/toddwschneider/shiny-salesman

Around the World in 80,000 Miles

Here’s another animated gif using a bunch of world capitals. The “solution” here is almost certainly not the global optimum, but it’s still fun to watch!

2014 PGA Championship Final Round Live Odds Visualized: McIlroy, Fowler, Mickelson, and Stenson

The 2014 PGA Championship at Valhalla finally provided some final round drama following anticlimactic finishes at golf’s first 3 majors of the year. Sunday afternoon saw 4 main contenders jockey back and forth for the title: Rory McIlroy, Rickie Fowler, Phil Mickelson, and Henrik Stenson each held at least a share of the lead before McIlroy pulled away for the win.

Gambletron 2000 tracked the betting odds throughout the tournament, which showed that each of those 4 players was considered most likely to win the tournament at some point on Sunday afternoon. Note that is different from saying that each player held the lead. For example, Bernd Wiesberger also held a share of the lead on Sunday, but the betting odds never showed him as the most likely player to win.

Here’s what each player’s real-time betting odds looked like on Sunday afternoon:

McIlroy entered the final round as the 50% betting favorite, but his sluggish start, coupled with strong play from the other 3, led to Fowler taking over at the top of the betting markets a little before 5:30 PM local time. Stenson made some birdies and briefly became the betting favorite around 6:15 PM, then Mickelson made his charge and took over the probabilistic lead around 6:30 PM. Mickelson held the lead as late as 7:30 PM, but a late bogey on the 16th hole ultimately doomed him.

Here’s a graph that shows the betting favorite at each point on Sunday. You can see that McIlroy led for most of the day, including when it mattered most, but the other players, especially Fowler, were all the favorite at some point: