P/PitStopRLSTRATEGY LAB
LOCAL INFERENCE
REINFORCEMENT LEARNING, IN MOTION

Inside the pit wall.

One car. Four choices. A neural network calling the stops.

✳
Double DQNTrained model · frozen weights
SAME RACE. THREE STRATEGIES.

Race finish times

Separate full-race totals. Every strategy stays below 100% tyre wear.

MINUTES : SECONDS
YOUR AGENT

Double DQN

—

Learned pit decisions

BASELINE 01

Planned + safety stops

—

Medium → hard at 40% distance, plus tyre-safety stops.

BASELINE 02

Wear-based strategy

—

Pits above 80% wear or for a late compound change

Each strategy runs its own race with identical safety-car events and random noise. Extra stops prevent wear reaching 100%. Totals include all pit losses and any compound-rule penalty. They stay fixed during playback and recalculate when you load a race.

01

The race

GREEN FLAG
LAP
01/ 57
Ready on the grid
ELAPSED RACE TIME00:00.00Awaiting lights out
PIT LANESTART / FINISHPITSTOPRLSTRATEGY CIRCUITT01T05T08
DQN agent Pit laneIllustrative circuit
LAP 0157 LAPS
02

The decision

LIVE ACTIVATIONS27 → 128 → 128 → 4
Race inputsHidden layersQ-values

Four choices. One call.

Highest allowed Q wins
↳
THE AGENT'S CALLStay outContinue on the current tyres.

Actual Q-values, not probabilities. Crossed-out actions could exceed 100% tyre wear and are unavailable.

CURRENT COMPOUND
MMedium0 laps old
SOFTMEDIUMHARD
TYRE WEAR
0%Fresh rubber
FUEL REMAINING
102.6kg57 laps to go
RACE STRATEGY
0stopsSecond compound needed
○Use at least two compounds
03

The bigger picture

SoftMediumHardSafety car
Tyre strategyEvery stop leaves a mark.
STARTLAP 29LAP 57
Your race story starts at lights out.
A WINDOW INTO THE AGENT

Race state in.
Strategy out.

This preview runs the project's trained Double DQN weights directly in your browser. No server, account or internet connection is needed after loading.

01Observe

The simulator supplies 27 features: distance remaining, tyre wear, fuel, safety-car status and the race settings.

02Evaluate

Two hidden layers of 128 neurons produce four Q-values. Brighter neurons have larger activations; visible connections are a subset of the actual learned weights.

03Act

The agent chooses the highest Q-value among actions that keep wear below 100%. The next lap changes the state, and the process repeats. Its weights stay fixed throughout playback.

The car animation illustrates a lap-based strategy simulator. It does not model steering, overtaking or vehicle physics. Browser races use a deterministic browser RNG; the Python CLI uses NumPy's RNG, so an identical seed does not produce an identical race across the two implementations. The simulator equations and trained weights are the same.

Tyre wear must stay below 100% through every lap. Unsafe actions are unavailable for the agent and both baselines. The planned strategy adds tyre-safety stops as needed; the DQN was trained with this same rule.

THE NETWORK, UNPACKED

Not a black box. A closer look.

Actual activations for the selected lap. Play to watch the network respond, or step through one decision at a time. Hover over a neuron to inspect its value.

LAP 01Selected learned connections · fixed weights
27 race inputs128 neurons · ReLU128 neurons · ReLU4 action values
Activation intensityViolet / cyan edges: positive / negative weightWeights remain fixed
WHAT THE AGENT SEES

The current observation.

These are the exact normalized features passed to the trained network before the selected lap.