Using Linear Programming to optimise Fantasy Premier League
A key part of doing well in fantasy football is identifying players that present a good investment. In this case, a good investment is a player that costs as little as possible whilst scoring as many points as possible. The creators of the game have tried to price players according to how likely they are at scoring points, meaning more expensive players should score more points than players that cost less than them. Of course, this does not always work out.
Every year there are players that outperform what the game makers expect from them and trying to identify these players early represents a key part of the fantasy game. This is where the metric “points per million” comes in. It is simply the number of points a player gets divided by their cost.
Below is the plot of all players cost vs their points for the 2020/21 season. Note that throughout this article, ‘salary’ is used to indicate the cost of a player (which is in fact their final price for the season). It is easy to see that loosely, the more expensive the player, the more points they achieve.
Given that in fantasy football, you have a fixed budget, it is extremely important to use your finances smartly. It is all about getting a balance between expensive players that will bank you a lot of points, and cheaper players that will still score you a decent amount.
Points per million
We can calculate each player's points per million score and create some visualisations to help identify some high performing players.
First, the plot of points against points per million. This immediately shows us that the highest-scoring players do not immediately present value in terms of points per million. This is just to say that the highest-scoring players were also the most expensive. Also, we can see that two goalkeepers have the only score of over 30 points per million.
Next, we look at the salary against cost per million. This, to me, doesn’t present too much in terms of interesting insights.
High performing players
By simply plotting each player's points per million in the form of a bar chart we can identify players of note.
Goalkeepers
Defenders
Midfielders
Forwards
Linear programming
To me, as a former maths student, this seems like a (linear) programming problem. Trying to maximise something whilst complying with some constraints is a basic linear programming problem. The function to optimise is the number of points you achieve whilst complying with the constraints. The objective function can be simplified as being the sum of points achieved by the players you have selected. Of course, this is a major simplification of the game. In reality, team selection is crucial and you can only use 11 of your 15 players per week whilst also being able to make transfers every game week. This presents its own (much, much more complex) problem, so as an extreme simplification, I will attempt to solve the problem of choosing the 15 players that would achieve the highest total points.
The constraints applied to you as a fantasy manager are simple. You have a finite budget of £100m (I’ve always wondered why they bothered making this a monetary value, let alone in the millions), you can have a maximum of 3 players from each team and finally, you must, at all times, have 2 keepers, 3 strikers and 5 defenders and midfielders.
This problem can be coded in python using PuLP which is a package for linear programming. I won't include any of the code I used but it followed (very closely) the following article that looks to optimise American fantasy football. In order to get this code working, the constraint of having a maximum of 3 players per team had to be omitted.
The program gave out the following team:
This team had 2587 points in total. This is below the winning score of 2680 but did not take into account chips, transfers or captaincy choices. A lot of these players were identified previously with good points per million score. What jumped out to me straight away was the inclusion of Wan-Bissaka. He wasn’t one of the best players in terms of points or points per million. When looking closer it appears that his inclusion was a mistake, with a player like Cresswell scoring more points (153 vs 144) and costing less (5.7 vs 5.8). I have reviewed the code and unfortunately cannot see a reason as to why this occurred.
2021/22
The prices for players in Fantasy Premier League 2021/22 were recently released. Whilst everyone is scrambling to complete their teams and complaining about player prices, it can be useful to try and look at players that present a good value. Predicting exactly how a player will perform is an almost impossible task so anything from here is conjecture.
The analysis from here on out will look at each players points scored last season and look at how their price has changed going into the new season. Some players who overperformed have increased in price and vice versa. This analysis will help to see if players got better or worse in terms of cost per million — if they have the same level of performance this season. This is a large assumption, some players can be expected to play better or worse than the previous season because of multiple factors, so this additional knowledge should be used alongside any of this data.
Also, before anything is stated, some extra limitations should be mentioned. A key one is the lack of context as to a players performance last season. If a player was injured, or had a poor start and finished strongly, they will not have accumulated as many points as players who played a lot and will not be identified as a potential player of note (e.g. De Bruyne who was injured for a lot of the previous season). Secondly, no promoted teams or transfers can be considered as this uses data from last season.
Price changes
The following is the list of players who increased in price the most. This is the difference between their final price last season compared to their starting price in 2021/22.
Some players who presented good points per million value now do not with their new price. On the opposite end, we can see the players who have decreased in price the most compared to last season.
There are some interesting players in here, particularly Digne who had a fairly high points per million value last year and has only increased with his price decrease.
Now, we can check to see whose points per million has changed the most with the new prices. Firstly, the players who now have a better points per million value.
To me, some of these changes are interesting. For example, Reguilon could be an interesting prospect if Tottenham improves next season (it might help to find a manager first though). Now looking at the players that have decreased the most in points per million.
A lot of these players outperformed what was expected of them last season so needed an adjustment in their starting price. many of them remain cheap and could still be a good pick for next season if their performance continues to increase. If Bamford has the same season as last year then in terms of points per million, he would have been the 3rd highest in terms of strikers from last season (with himself being one of the players in front of him).
We can plot this information as a scatterplot. The following is the difference in points per million against total points.
The right-most player is Digne. He, again, seems to be an interesting prospect next season. Though, as mentioned earlier, some context needs to be applied to this as they are still without a manager so the same level of performance is not guaranteed.