Last week in one of my analytics courses we focused on linear programming and using Excel’s solver tool for optimization. We discussed many practical scenarios for optimization, such as production and finance. In optimization we look to create the best possible outcome given a set of constraints. For example, in order to maximize profit for our company, how many units of product x and product y should we produce? We have constraints such as projected demand, the cost to make each item, profit on each item, production capacity etc. Whenever I learn material like this, I want to relate it to sports.
My goal was to create the optimal NBA roster. I looked to maximize the cumulative win shares of the roster. As I discussed in my first post, win shares is an estimate of the number of wins created by a player. I consider it the best stat to compare all players with each other. The higher a player’s win shares, the more wins they create for the team. It’s not realistic to build a roster of the best 12 players, mainly because there are salary constraints. You can’t have 12 max contract players on a team. The total salaries for my roster had to be under $109.14 million, which represents the 2019-20 salary cap. Then, I wanted to have at least 2 players from each position (PG, SG, SF, PF, C). I know that many players have become positionless in a sense, but I needed to assign everyone a position for this roster. I also added the constraint of not having more than 3 players from one position on the roster.
To collect the data, I downloaded .csv files of win shares and player contracts from basketball reference. I used SQL to join sets of data together to create a master table where I would have the player name, position, age, team, win shares and 2019-20 salary. I then copied that table over to excel where I could create my constraints for solver. Recap:
Objective- Maximize win shares
- 12 players
- Cumulative salary under $109.14 million
- 2-3 players from each position
Here is my optimal NBA roster from the 2019-20 season:
This optimal roster would cost $109.13 million and generate 94.6 wins. The roster doesn’t take into account the interaction between players, of course if they were all on the same team their individual win shares would be lower, and they couldn’t possibly win more games than they play. The team is headlined by two of the best players in the NBA- Giannis Antetokounmpo and James Harden. The roster is then filled out by young stars who are performing above their value on rookie contracts. The only other veteran is Montrezl Harrell who is on his second contract. These results also make sense given my first article where I looked at which players offered the most salary cap value. Mitchell Robinson, OG Anunoby, Bam Adebayo, and Jarrett Allen were all in my top 10. Ben Simmons and Jaylen Brown signed extensions starting next season that will pay them much more, so they will in turn lose some value. 9/12 of these players on their rookie contracts, and 10/12 of the players are 25 years old or younger. This is the optimal NBA roster, but the result was predictable.
Given the incredible value that a player can offer if they are a superstar on a rookie contract, I wanted to weed them out by looking to create an optimal roster of veteran players. To do this, I used the same constraints as above, but included that they player had to be 26 or older.
This roster of veteran players costs $106.65 million and generates 74.3 wins, more than 20 less than the original optimal roster. Montrezl Harrell is the lone holdover from the original team. The Damian Lillard/Anthony Davis combo would be lethal. Royce O’Neale provides tremendous value at his under $2 million contract. While most of these players were still 30 or under, George Hill and Dwight Howard are 33 and 34 respectively, and played significant roles and winning teams. One thing to notice is that many of these players were on teams that made deep runs in the playoffs. The most successful teams are able to find valuable veterans in addition to good players on rookie deals.
Lastly, I wanted to take a look at the young guys, and create an optimal roster using the constraints from above except that player had to be 25 or younger.
This roster costs $95.54 million and creates 89.7 wins. They cost $10 million less and generate about 15 more wins than the veteran team. The roster is similar to the first one, but Donavan Mitchell replaces James Harden and Nikola Jokic would replace Montrezl Harrell.
While using solver to create these optimal NBA lineups in this sense may not be too practical, one popular use of the tool is to create optimal lineups for daily fantasy. Daily fantasy is just one big optimization problem. The goal is to create the lineup that generates the most points, given a set of constraints. The constraints are you have to have a certain number of players per position, and you only have a certain salary to spend. Using solver to create an optimal lineup on DraftKings or Fanduel is well known strategy, so I’m definitely looking forward to playing around with it a bit to see what success I can have. As always if you have any thoughts please share them in the comments, and I look forward to posting again soon.