Skip to content

Evolutionary F1 Race Strategy [GECCO 2023] - Genetic Algorithms applied to F1 race strategy using the F1 2021 game data and real data from Pirelli F1.

License

Notifications You must be signed in to change notification settings

bonom/Evolutionary-F1-Race-Strategy

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation


Evolutionary F1 Race Strategy [GECCO 2023]

Official implementation of GECCO 2023 paper "Evolutionary F1 Race Strategy", it has been presented at the 8th Workshop on Industrial Applications of Metaheuristic (IAM 2023).


📄 Paper


Introduction

Formula 1 is a highly competitive and ever-evolving sport, with teams constantly searching for ways to gain an edge over the competition. In order to meet this challenge, we propose a custom Genetic Algorithm that can simulate a race strategy given data from free practices and compute an optimal strategy for a specific circuit. The algorithm takes into account a variety of factors that can affect race performance, including weather conditions as well as tire choice, pit-stops, fuel weight, and tire wear. By simulating and computing multiple race strategies, the algorithm provides valuable insights and can help make informed strategic decisions, in order to optimize the performance on the track. The algorithm has been evaluated on both a video-game simulation and with real data on tire consumption provided by the tire manufacturer Pirelli. With the help of the race strategy engineers from Pirelli, we have been able to prove the real applicability of the proposed algorithm.


Requirements

Needed packages to run the project:

  • Python 3.11
  • numpy
  • pandas
  • plotly
  • tqdm

To create the environment use conda (better):

conda create -n <environment_name> python=3.11 pandas numpy tqdm plotly

or pip:

python -m venv <environment_name> 
pip install -U pandas numpy tqdm plotly

Or you can use the requirements file (inside the environment):

pip install -r requirements.txt

There should not be any problems with the packages versions, in case you have some troubles please use the requirements.txt file for the versions we used.


Usage

The script can be used with several flags in different ways, it starts with the default one:

python main.py

Then flags are:

  • --d: is a modality for retrieving more runs of the simulation
python main.py --d
  • --c <circuit>: better if specified, otherwise the script will run the script for all the circuits available. The circuits available are the folders names in the Data folder
python main.py --c Monza
  • --pop <int>: is the population size of the genetic algorithm
python main.py --pop 100
  • --mut <float>: is the mutation rate of the genetic algorithm
python main.py --mut 0.1
  • --cross <float>: is the crossover rate of the genetic algorithm
python main.py --cross 0.1
  • --i <int>: is the number of iterations of the genetic algorithm
python main.py --i 100
  • --w <weather file>: is the weather file to use in the simulation, if not specified the script will ask for the weather file to use. Notice that only the weather txts in every circuit data folder are considered
python main.py --w Sunny.txt

It is possible to use more than one flag, for example:

python main.py --c Monza --pop 100 --mut 0.1 --cross 0.1 --i 100 --w Sunny.txt --d

Citing our work

Please cite the following paper if you use our code:

@inproceedings{10.1145/3583133.3596349,
author = {Bonomi, Andrea and Turri, Evelyn and Iacca, Giovanni},
title = {Evolutionary F1 Race Strategy},
year = {2023},
isbn = {9798400701207},
publisher = {Association for Computing Machinery},
address = {New York, NY, USA},
url = {https://doi.org/10.1145/3583133.3596349},
doi = {10.1145/3583133.3596349},
abstract = {Formula 1 is a highly competitive and ever-evolving sport, with teams constantly searching for ways to gain an edge over the competition. In order to meet this challenge, we propose a custom Genetic Algorithm that can simulate a race strategy given data from free practices and compute an optimal strategy for a specific circuit. The algorithm takes into account a variety of factors that can affect race performance, including weather conditions as well as tire choice, pit-stops, fuel weight, and tire wear. By simulating and computing multiple race strategies, the algorithm provides valuable insights and can help make informed strategic decisions, in order to optimize the performance on the track. The algorithm has been evaluated on both a video-game simulation and with real data on tire consumption provided by the tire manufacturer Pirelli. With the help of the race strategy engineers from Pirelli, we have been able to prove the real applicability of the proposed algorithm.},
booktitle = {Proceedings of the Companion Conference on Genetic and Evolutionary Computation},
pages = {1925–1932},
numpages = {8},
keywords = {race strategy, evolutionary computation, formula 1},
location = {Lisbon, Portugal},
series = {GECCO '23 Companion}
}

Acknowledgements

We would like to thank Simone Berra and Fernando Osuna from Pirelli for providing us the real data and giving us feedback on the numerical results.

About

Evolutionary F1 Race Strategy [GECCO 2023] - Genetic Algorithms applied to F1 race strategy using the F1 2021 game data and real data from Pirelli F1.

Topics

Resources

License

Stars

Watchers

Forks