Course:CPSC312-2023/Tire-Strat

From UBC Wiki

What is the Problem?

In motorsports, tire strategy plays a critical role in determining the outcome of a race. Teams need to balance the performance of different tire compounds with the degradation that occurs over time. In this blog post, we will explore a simplified case of optimizing a 6-lap race using three tire compounds (soft, medium, and hard) with a mandatory pit stop that requires a change of tire compound. Our goal is to find the optimal strategy that minimizes the total race time while taking tire degradation into account.

What is the something extra?

To solve this problem, we will use Prolog, a powerful logic programming language well-suited for tasks that involve searching through a solution space and making logical inferences. Prolog's declarative syntax and built-in search capabilities make it a great choice for implementing a race strategy optimization algorithm.

What did we learn?

Through this exercise, we learned the following:

How to represent domain-specific knowledge in Prolog, such as tire degradation rates and lap time differences for each tire compound. How to implement custom predicates for calculating lap times and total race time with degradation taken into account. How to explore the solution space efficiently with Prolog's built-in search capabilities. How to optimize the race strategy by finding the combination of tire compounds and pit stop laps that minimize the total race time. This project has demonstrated the power and flexibility of Prolog in tackling a real-world problem like race strategy optimization. The lessons learned can be applied to other optimization problems, and the techniques used can be adapted for more complex scenarios.

Link to code

https://github.com/alibarisoztekin/strat

To run the program, download the Prolog file and load it into a Prolog interpreter, like SWI-Prolog. Then, query the optimize_race_strategy predicate to find the optimal tire strategy and corresponding minimum time:

?- optimize_race_strategy(Tire1, Laps1, Tire2, Laps2, Time).