Sunday, October 27, 2013

Linear Programming and an Optimization Model

I finally taught myself how to create a linear optimization model in Excel (it's excessively easy with an Add-In I just learned about). This is pretty cool because it allows my fantasy football predictive model to evolve from a series of gut-feelings and potentially fruitful lineups to a solitary optimized lineup. Obviously an optimized lineup does not guarantee success, but over the (infinitely) long term, consensus rankings should be approximately accurate and optimizing those rankings should result in success.

How it works:

Linear programming and optimization models in general attempt to maximize (or minimize) a calculated value given a set of constraints. For fantasy football this translates very simply: we want to maximize the projected points in a starting lineup given that the players in the lineup meet all relevant salary cap and player-position restrictions.

I've already discussed how the projected points are calculated (from FantasyPros consensus rankings), and the player salary cap data comes directly from the different daily/weekly fantasy sites. The one somewhat tricky piece of this puzzle was to figure out how to tell the model that certain players can only play in certain positions and that there are restrictions on how many players of each position can be drafted into the starting lineup.

This turned out to be relatively easy; I created a list of all available players with their position, projected points and salary. The model makes a binary choice with respect to each player as to whether or not to draft them. I then added certain position constraints depending on the format of the website. For example, DraftKings requires a lineup be composed of 1 QB, 2 RBs, 2 WRs, 1 TE, 1 FLEX, 1 K,  and 1 D/ST. The FLEX spot can be either a runningback, receiver or tight end.

Thus, I added the following constraints: QB = 1, RB ≥ 2, WR ≥ 2, TE ≥ 1, K = 1, and D/ST = 1. Then, to satisfy the FLEX requirements the following constraint needed to be added as well: RB + WR + TE = 6.


These constraints are easy to adjust depending on the format of the various websites, and the results were fantastic. The following lineup is the optimized projections for DraftKings, and even some of the professional Fantasy pundits seem to think it's got potential. My plan is to update my optimization model each Saturday or Sunday in preparation for the week's games. At the end of the season I'll try to aggregate all my optimal lineups and see how well the performed and whether or not it is feasible to consistently win money in the weekly/daily fantasy pools using this strategy.
















No comments:

Post a Comment