Multi-Agent Reinforcement Learning in Congestion Games
When Every Agent Finds the Shortcut
A repeated daily commute through one small highway network.
Every morning, 100,000 commuters enter a small highway network at S and need to reach T, their destination. U and V are junctions. Each commuter chooses one complete route, experiences that day’s travel time, and updates a private estimate of the route it took.
They do not meet afterward or exchange travel times in this experiment. Each learner sees only its own trip. They still affect one another because a road becomes slower when more of them choose it. The network, not communication, links their rewards.
A new link from U to V costs nothing by itself. It looks like an obvious improvement. This is the setting for Braess’s paradox: adding an option can lead travelers acting in their own interest to a stable outcome in which everyone is slower.
With the shortcut closed, an even split gives every commuter a trip lasting 90 minutes. Once the shortcut is open, a profile in which everyone uses it is stable, with every trip lasting 120 minutes. The journey below shows why private learning can find that worse incentive pattern.
I
A route is an action
An action is one complete choice available to a learner. Here, that action is the commuter’s route from source to destination for one simulated day, not a separate turn at each junction.
Upper follows S → U → T, Lower follows S → V → T, and Shortcut follows S → U → V → T.
One simulated day is one episode. Each commuter selects exactly one complete route for that day. No central planner assigns routes, and no learning has started yet.
II
Everyone changes your reward
Edge load is the number of selected routes using an edge. Latency is travel time in this mathematical model. More users on either variable edge make that edge slower.
All physical latencies and route costs are measured in minutes. If xU, xL, and xZ are route counts, Shortcut users raise both variable loads even though the central edge itself has zero latency.
Reward is negative perceived route cost. A shorter trip gives a less negative, therefore higher, reward. The normal view uses one consistent encoding: road width, color, and opacity all increase with the share of commuters using an edge. Thin green roads carry less traffic; thicker, brighter red roads carry more.
III
Each commuter learns alone
A Q value is one commuter’s current estimate of a route’s reward. Every commuter owns a separate row, experiences only the route it selected, and updates only that route in the episode.
An episode is one simulated commuting day in which all 100,000 commuters choose before any reward is evaluated. Their choices are simultaneous. They do not exchange travel times or observe everyone else’s costs.
The learning rate α = 0.15 controls how strongly one reward changes an estimate. Epsilon-greedy exploration usually chooses a route with the highest estimated value, but sometimes samples another. Gamma is zero because this repeated decision has one stage and no next state to value.
The environment is nonstationary from one learner’s perspective because the other commuters are adapting too. Shared congestion couples their private rewards even though the learners do not communicate. Classic theory for convergence of a single agent does not transfer unchanged.
IV
The game has a hidden landscape
A potential function assigns one height to every profile of route counts. A strict best response, one commuter switching to a cheaper route, moves downhill by exactly that commuter’s cost change.
The arrows show an asynchronous sequence of strict improvements. The final point is stable because no individual commuter can switch routes and lower their own private cost. The learners discover the shortcut because it is privately attractive.
Q-learning is not a monotone downhill path. Simultaneous choices and exploration can move its observed count profile in either direction.
V
Stable does not mean efficient
A Nash equilibrium is stable against one traveler switching alone. A social optimum minimizes total travel latency across everyone. Those are different questions.
Remove one Shortcut user before adding that same traveler to Upper. The candidate route is priced after the changed loads, so the deviator’s own traffic is counted exactly once.
Exploitability is the largest amount by which one agent could reduce its own route cost by switching alone.
The displayed profile in which everyone uses Shortcut is stable even though its total delay is not minimal. It is one of exact weak pure equilibria for this finite population: . No uniqueness is claimed.
- selfish equilibrium
- average minutes
- social cost commuter minutes
- an exact social optimum
- average minutes
- social cost commuter minutes
Price of Anarchy compares the worst equilibrium cost with the optimum. Here it is , approximately . Price of Stability compares the best equilibrium with the optimum; here it is , approximately .
VI
Remove a road. Everyone gets faster.
Closing the central shortcut removes one action. No traveler can use that edge, so Upper and Lower carry all 100,000 commuters. Removing the shortcut changes what every commuter can choose.
The closed equilibrium is , with average latency minutes. Relative to the displayed equilibrium in which everyone uses Shortcut, the average falls by 25 percent. This is a result for this Braess instance, not a claim that removing roads generally improves traffic.
VII
Price the externality
An externality is delay imposed on other travelers but not fully felt by the traveler choosing the route. A toll based on marginal cost adds that missing increment to private perceived cost.
The toll changes reward and route incentives. It does not change physical edge latency, and toll payments remain transfers outside the travel time objective. Edge color and thickness still represent traffic share, never payment. A toll changes private cost without changing the physical road itself.
The tolled potential therefore equals physical social cost. Its equilibrium reaches , which is an exact optimum for the selected population.
VIII
Three ways to adapt
Independent Q-learning sees only the reward for the route it selected.
Asynchronous strict best response receives exact switching costs for one agent.
Hedge receives every counterfactual route cost after each round, so it has fuller information.
External regret compares realized cumulative cost with the cost of always using one fixed route. Low regret does not imply that the last iterate, the final profile, is a pure Nash equilibrium.
The comparison below is the fully replicated study with 100 commuters. The 1,000 and 10,000 presets use one audited run across the full population. The 100,000 preset uses one audited sampled proxy and is not assigned the same uncertainty.
| method | final profile | social cost (commuter minutes) | exploitability (minutes) | supported statement |
|---|
A representative medoid is the run whose final count profile has the smallest total distance to the others, with exploitability and seed breaking ties. It is not chosen for visual appeal.
IX
Answer
Individually competent learning can discover an inefficient incentive structure. The agents can learn their private rewards well while the rewards themselves direct everyone toward a socially costly outcome.
Closing the shortcut changes the available actions. Tolls change perceived private cost. Neither intervention makes the learners smarter. Each changes the game they learn.
The agents did not learn badly.
They learned the incentives
they were given.
X
Under the hood
Python owns the game, analysis, experiments, and exports. The browser validates and presents those results, but never trains agents or invents a metric.
Model normalized by population
The variable latency is minutes. The two constant outer edges each take 60 minutes and the central edge takes zero. This preserves the same Braess structure for the hidden comparison with 100 commuters and the selectable views with 1,000, 10,000, and 100,000 commuters. The roads encode traffic share, so normalized populations can produce similar shapes even though exact commuter counts differ by orders of magnitude.
Exact analysis without materializing count states
Social cost and potential separate into two symmetric convex functions of the discrete Upper and Lower counts. Exact floor, ceiling, adjacent tie, and boundary candidates around the proven minimizer are sufficient. For example, the full open game with 1,000,000 commuters has 500,001,500,001 count states. Small and medium populations are checked against exhaustive or linear references, including tied optima.
Independent vectorized learning
NumPy stores one private Q row per simulated commuter. All actions are selected before rewards, only selected entries update, and evaluation at epsilon zero uses an isolated random stream. The study with 100 commuters uses 64 seeds. The 1,000 and 10,000 studies simulate every commuter. For 100,000 commuters, 10,000 independent learners estimate normalized route shares; deterministic largest remainder converts each snapshot to integer counts for the represented population, and all displayed costs are recomputed from those counts. Exact equilibrium and optimum markers always use the full represented population.
Deterministic public data
SeedSequence separates exploration, resolution of ties, initialization, aggregation, playback, and evaluation. Stable ordering and serialization of finite numbers make each manifest and bundle byte reproducible. Elapsed runtime values are excluded.
Sampled surfaces and continuous road flow
The surface for 100 commuters contains all 5,151 count states. Larger surfaces use a fixed deterministic barycentric sample of the same exact potential formula. Equilibrium and optimum markers remain exact integer profiles. No individual commuter markers are rendered. Tube thickness, hue, and opacity all increase monotonically with edge traffic share, from thin green to thick bright red. Layered directional pulses give the roads a fluid appearance and make travel direction easier to read.
Boundaries and limitations
- This is one atomic symmetric routing game, not a general traffic forecast.
- The visual flow is an aggregate encoding, not a microscopic traffic simulation or an empirical transportation dataset.
- Independent learners face a nonstationary environment, so no general convergence theorem is claimed.
- Hedge has full counterfactual information and best response has exact model access.
- Toll payments are transfers, and the toll conclusion belongs to this finite instance.