An AI race engineer that knows when to pit.
Lap-time, tyre-wear and fuel models feed a race simulator. It searches every sensible pit plan, picks the fastest and explains the choice in plain language, like an engineer on the radio.
Pick a circuit. Get the call.
Real output from the project's optimizer and models, exported from a run on simulated races (driver CHR, track at 35 °C).
Stints: top 3 plans found, then the rule-based plans (gap to best)
Predicted lap time, pit-stop time excluded
Why this strategy
From lap data to a pit call
Five stages, each tested on its own. Strategies are always re-scored on the reference physics, never on the model that chose them.
- Data13,000 laps from a reference simulator, validated against a schema. A FastF1 loader maps real sessions into the same format.
- FeaturesTime-weighted telemetry aggregates, split into before-lap and after-lap features so nothing leaks from the future.
- ModelsLap time (six models compared), tyre degradation and fuel burn, saved in a versioned registry.
- SimulatorA vectorised race simulator applies pit loss, tyre and fuel effects and the rules, such as using two compounds.
- StrategySearches pit plans, makes pit-now-or-stay-out calls, compares rule-based plans and writes the explanation.
How good are the models?
The model is chosen by grouped cross-validation on training seasons, then scored once on a season it never saw.
Lap-time error on the held-out season
Mean absolute error in seconds. Lower is better.
Does it make better decisions?
18 scenarios: 6 circuits, 3 levels of tyre wear. Each chosen plan is re-run on the true physics.
Honest limits
- Trained on simulated races. The FastF1 loader is tested but not yet run on live data.
- No safety cars, traffic, rivals or weather changes yet.
- Tree models don't extrapolate, so unfamiliar circuits or tyre ages are rejected, not guessed.
- Reinforcement learning has an environment and training script; no agent is trained yet.
Run it yourself
Python 3.10 or newer. The dashboard opens in your browser.
git clone https://github.com/gamersusshal-bit/AI-race-engineer.git cd AI-race-engineer python -m venv .venv && . .venv/bin/activate pip install -e ".[dev]" # data → models → strategy evaluation → artifacts/ python -m race_engineer.cli pipeline # engineer dashboard streamlit run race_engineer/dashboard/app.py # a single pit call python -m race_engineer.cli call --circuit Monza --lap 28 --compound MEDIUM --tyre-age 27