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.
Windows
Download Python (preferably python3.13 or later) from python.org.
During installation, make sure to check the box that says Add Python to PATH.
macOS
You can install Python via Homebrew if it’s not already installed:
brew install pythonWindows
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/sertalpbilal/FPL-Optimization-Tools
cd FPL-Optimization-ToolsWe use uv for dependency management.
Install uv and then install the necessary dependencies for this project.
Windows
pip install uv
uv syncmacOS
brew install uv
uv 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.