My Projects
Back to projects
Optimization of the racing line of a car with PSO
This is my TIPE project for the 2023/2024 academic year, based on the theme "Sport and Games".
You can find the code of this project on my GitHub.
Introduction
I'm really fond of motorsport, which is why I decided to optimize the trajectory of a car on a track. To achieve this, I used a Particle Swarm Optimization (PSO) algorithm, a metaheuristic inspired by the behavior of bird flocks.
Soon after, I realized that the algorithm relies on many parameters that weren't detailed in the papers. Therefore, I had to conduct extensive research to find the best parameters for my problem, which became the focus of my TIPE.
The parameters of the algorithm I'm going to estimate are :
- The number of Particle
- The number of iterations
- The inertia weight
- The cognitive coefficients
- The social coefficients
I'm going to use the French Grand Prix track, named Paul Ricard :
The papers provide the formula to update the velocity of the particles, which is:
Where
The inertia weight parameter
The first parameter we are going to estimate is
Here are the results :
We can see that the best value for
The number of iterations and particles
The second and third parameters we are going to estimate are the number of iterations and particles. Since these are both variables of nested loops, they will have the same effect on the computation time. So we're going to study there effect on the laptime.
Here are the results :
We can clearly see that after 50 iterations, the lap time stabilizes. Therefore, we can set the number of iterations to 50. As for the number of particles, we can see that it tends to reach a limit. This means that if you want better results, you can use a higher number of particles, but if you want faster results, you might opt for a lower number of particles
The social and cognitive coefficients (gbest and pbest)
The final parameters we are going to estimate are the social and cognitive coefficients. To do this, we're going to search a minimum on a plane with the simulated annealing algorithm. I ran this on a computing farm on 64 processes each time.
Here are the results :
We can see that the values for
As for
Here are the results :
The papers provide the formula to update the velocity of the particles, which is:
The final result of the analysis
After all these analyses, we've determined that the best parameters for the PSO algorithm are:
- The number of particles : 80-400+ (can be chosen based on the desired computation time or the precision of the results)
- The number of iterations : 50
- The inertia weight w : 0.8
- The cognitive coefficient c1 : >0
- The social coefficient c2 : 0.225
The racing line
After all these analyses, we've found the optimal parameters for the PSO algorithm. We can now proceed to compute the racing lines.
Here is one of the computed racing lines:
This concludes my TIPE project. I hope you enjoyed reading it as much as I enjoyed working on it.
If you have any questions or would like to know more about my project, feel free to contact me via email or social media.
References
Back to projects