This repository provides a set of tools for solving deterministic Fantasy Premier League (FPL) optimization problems.
The Python code uses pandas for data management, sasoptpy for building the optimization model, and HiGHS via highspy to solve the model.
It allows users to:
- Automatically select the best FPL squad based on the given projection data and solver settings.
- Customize squad constraints, formation rules, transfer strategies, and more.
- Modify data sources and parameters to suit personal models or preferences.
uv handles both Python installation and dependency management, so you do not need to install Python separately.
Windows (PowerShell)
Open PowerShell and run:
powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"macOS / Linux
wget -qO- https://astral.sh/uv/install.sh | shRestart your terminal after installation, then verify:
uv --versionWindows
Download from git-scm.com and accept all default installation options.
macOS
Git is usually pre-installed. If not, run:
brew install gitOpen a terminal (search for Command Prompt in Windows) and run:
cd Documents
git clone https://github.com/solioanalytics/open-fpl-solver.git
cd open-fpl-solveruv syncPlace your projections file (e.g., solio.csv) in the data/ folder.
If you are not using the default data source, update the datasource field in data/user_settings.json to match your CSV file name.
Example: if you are using a file named projections.csv, the settings file should contain:
"datasource": "projections"Edit any desired settings in comprehensive_settings.json or user_settings.json.
- The majority of useful settings for most people will be in
user_settings.json. comprehensive_settings.jsonprovides a wider range of options that will be used as defaults unless altered inuser_settings.json.
Details of what each setting does can be found in the .md file in the /data/ folder.
cd run
uv run python solve.pyThere is a YouTube playlist here by Sertalp, showing the early stages of this tool, explaining how it was built, and discussing ideas around optimization with a focus on FPL.
There is also a browser-based version of the optimizer that doesn't require the download or installation of anything to your device, and works on mobile. It is hosted in a google colab notebook that can be found here. Simply follow the instructions on that page to run the optimizer.
If you have issues, feel free to open an issue on GitHub and I will get back to you as soon as possible. Alternatively, you can email me at chris.musson@hotmail.com.