Energy is the critical resource in any Time Trial. As cyclists and engineers we wanted to know if there is an optimal way to expend our energy in a TT to achieve the best time for our fitness level. When do we pedal hard and when do we free-wheel? We knew there was a way to do this but solving the problem wouldn’t be as simple as solving an equation. We have approached this problem using genetic algorithms.
What it does
Our program, GeneTTic, takes a given route, the weather on the day and measures of your fitness and outputs personalised power targets for each segment of the course that will give you your best time. We also simulated our optimal solution vs an average power case which acted as a control in Unity Game Engine.
How I built it
The genetic algorithm works in the standard way: a starting population is initialised with members that power values that range from 1W to the maximum instantaneous power that an average person can produce.
Our “Scoring function” is as follows: each member in the population is run through our physics simulation which carefully models the real world. Conditions like altitude, acceleration, drag and even wind direction are taken into account to directly translate how the user’s power translates into saving time and energy in the time trial.
Challenges I ran into
The physics simulation was one aspect which took a particularly significant bit of time as we really wanted to model the real world as closely as we could such that our recommendations were optimal but also feasible.
Accomplishments that I'm proud of
Modelling complex physics of a bike, including weather effects and the effect of the terrain. The genetic algorithm successfully optimises for the cyclist’s fitness.
What I learned
How to implement a genetic algorithm. Use of API’s in Python.
What's next for geneTTic
GeneTTic could be improved by using more accurate measures of human fitness to estimate what you’re capable of. At present the athlete inputs their Functional Threshold Power, a 20 minute average power and the estimated time over the route. This gives a total energy expenditure over the course which we then optimise time for. In reality, humans don’t work like this so this leads to slight inaccuracies in our model which could be improved through a more realistic energy expenditure model.