Solar Race Optimizer
Race strategy optimization system using a genetic algorithm for solar vehicle competitions

The Solar Race Optimizer is part of UBC Solar's race strategy simulation. The simulation models our solar car over a race route, from the solar arrays, battery, motor and regen to the weather and sunlight along the way, and predicts how far and how fast we can go. A genetic algorithm sits on top and searches for the driving speeds that cover the most distance without draining the battery. I worked on it as a Strategy Software Developer alongside the rest of the strategy team.
In a solar car race the speed you pick is a trade-off: drive faster and you cover more ground, but you use more energy than the array puts back. The right speeds depend on the route, the forecast and the battery's state of charge, so guessing them by hand doesn't work. The team needed a simulator that could test a full speed plan for a race like FSGP, and an optimizer that could search those plans for us.
The optimizer uses PyGAD. Each chromosome is a normalized array of driving speeds, one gene per interval, and fitness comes from running the whole simulation on it, counting only the distance covered before state of charge drops below zero. A teammate wrote the first version of the GA. I added a diversity measure, the average standard deviation of each gene across the population, so we could see whether runs were converging or stuck, replaced the Perlin-noise starting population with Gaussian noise, and logged diversity and the stopping generation with every run. Around that I moved the GIS and weather API calls out of the simulation into a separate caching CLI, loaded FSGP track coordinates from a KML file, and added low-voltage system energy loss to the energy model.
My changes went in over 5 merged pull requests between late 2023 and May 2024, and the team used the simulator and optimizer to plan race speeds for FSGP 2024. Together with an Electron/React visualization app and a data analysis notebook I built for the team, it fed into UBC Solar's highest-ever Formula Sun Grand Prix placement that year.

