The domain masaqat.com is for sale. Make an offer →
From one robot to a whole road · study path for a PhD seminar

Multi-Agent Reinforcement Learning, built up from a single robot

Each chapter runs the same way: what it does in practice, then the technical machinery, then the theory and equations. Every chapter has a lab you can drive. Nothing here needs more than grade-12 algebra, probability and a little calculus to start. By the end you'll be at research level.

~45 min · Ch 1–5Single-agent RL coreMDPs, returns, Bellman, Monte Carlo, TD, Q-learning
~50 min · Ch 6–9Deep RL → MARLPPO, Markov games, Dec-POMDPs, CTDE, QMIX, MAPPO, MADDPG
~30 min · Ch 10–11Robots, cars & your talkAV/robot formulations, open problems, likely questions, quiz
Listen first, then play. Each chapter has a ~5-minute narrated summary (11 episodes, about 55 minutes in total). Good for the commute; then come back for the labs.
Chapter 1Foundations

The agent–environment loop

In practice

Picture a warehouse robot. Ten times a second it reads its sensors, picks a motor command, and the world responds: it moves, maybe bumps a shelf, maybe reaches the pick-up point. Nobody tells it the right command. It only gets a number, the reward, saying how good that moment was. Reinforcement learning (RL) is the engineering of turning those numbers into good behaviour.

# the loop every RL library implements (Gymnasium API)
obs, info = env.reset()
for t in range(T):
    action = policy(obs)                       # agent decides
    obs, reward, terminated, truncated, info = env.step(action)  # world responds
    if terminated or truncated:
        break
Technical vocabulary
TermSymbolWarehouse robotSelf-driving car
State\(s_t\)pose, battery, shelf mapego pose/speed, all nearby vehicles, lights
Observation\(o_t\)LiDAR scan, wheel odometrycamera + LiDAR + radar, what sensors actually see
Action\(a_t\){forward, left, right, stop}steering angle, acceleration (continuous)
Reward\(r_{t+1}\)+10 at pick-up, −1 per second+progress, −collision, −jerk
Policy\(\pi(a\mid s)\)the controller we are learning: a map from situation to (a distribution over) actions
Episodeone delivery tripone drive through an intersection

Drive the robot yourself

Lab 1 · you are the policy

Use the pad or arrow keys (click the lab first). Reach the green goal (+10); red cells are pits (−10); every step costs −1. Turn on slippery floor and your commands sometimes go sideways. That randomness is the transition probability \(P\) you'll meet in Chapter 3.

Check yourself: why is a camera image an observation and not the state?
Chapter 2Foundations

Return and discounting: what the agent actually maximises

In practice

A car that only maximises this second's reward would floor the accelerator into a queue. We want it to care about the whole trip, but care a bit less about the far future, which is uncertain anyway. We get that with a discount factor \(\gamma\in[0,1)\).

Technical

The return from time \(t\) is the discounted sum of future rewards:

\[ G_t = r_{t+1} + \gamma r_{t+2} + \gamma^2 r_{t+3} + \dots = \sum_{k=0}^{\infty} \gamma^k\, r_{t+k+1} \]

It satisfies a recursion that the rest of RL is built on:

\[ G_t = r_{t+1} + \gamma\, G_{t+1} \]
Theory

If rewards are bounded, \(|r|\le R_{\max}\), the geometric series gives \(|G_t|\le R_{\max}/(1-\gamma)\), so the sum is finite. The effective horizon is about \(1/(1-\gamma)\) steps. Rule of thumb for robotics: horizon in seconds ≈ \(\frac{1}{1-\gamma}\cdot \Delta t\). Choose \(\gamma\) from the control frequency and how far ahead the task needs you to look. Don't pick it at random.

How far ahead does your car look?

Lab 2 · discount weights

Bars show the weight \(\gamma^k\) given to a reward \(k\) steps ahead. Move γ and the control rate, and read off the planning horizon.

Chapter 3Core RL

Markov Decision Processes and the Bellman equation

In practice

To reason about a robot mathematically, we describe its world as five objects: which situations exist, which actions exist, how actions change situations (with noise), what each outcome is worth, and how much we discount. That package is an MDP.

Technical definition
\[ \mathcal{M} = (\mathcal{S}, \mathcal{A}, P, R, \gamma),\qquad P(s'\mid s,a) = \Pr(s_{t+1}=s' \mid s_t=s, a_t=a) \]

Markov property: the future depends only on the present state, not on how you got there: \(\Pr(s_{t+1}\mid s_t,a_t) = \Pr(s_{t+1}\mid s_0,a_0,\dots,s_t,a_t)\). For a car, position and velocity together are Markov; position alone is not.

Two value functions score how good things are under a policy \(\pi\):

\[ V^\pi(s) = \mathbb{E}_\pi\left[G_t \mid s_t = s\right], \qquad Q^\pi(s,a) = \mathbb{E}_\pi\left[G_t \mid s_t=s, a_t=a\right] \]

\(V\) answers "how good is it to be here?" and \(Q\) answers "how good is it to do this here?". Once you know \(Q\), acting is easy: pick \(\arg\max_a Q(s,a)\).

Theory: Bellman equations

Plug \(G_t = r_{t+1}+\gamma G_{t+1}\) into the definition and take expectations. You get a one-step consistency condition:

\[ V^\pi(s) = \sum_a \pi(a\mid s) \sum_{s'} P(s'\mid s,a)\big[R(s,a,s') + \gamma V^\pi(s')\big] \]

The optimal value replaces "average over the policy" with "take the best action":

\[ V^*(s) = \max_a \sum_{s'} P(s'\mid s,a)\big[R(s,a,s') + \gamma V^*(s')\big], \qquad Q^*(s,a) = \sum_{s'}P(s'\mid s,a)\big[R + \gamma \max_{a'} Q^*(s',a')\big] \]

Define the Bellman optimality operator \(\mathcal{T}\) as the right-hand side. It is a \(\gamma\)-contraction in the max-norm: \(\|\mathcal{T}V - \mathcal{T}U\|_\infty \le \gamma \|V-U\|_\infty\). By the Banach fixed-point theorem it has exactly one fixed point \(V^*\), and repeatedly applying it (value iteration) converges from any start. Each sweep shrinks the error by at least a factor \(\gamma\).

Watch value propagate backwards from the goal

Lab 3 · value iteration

Press One sweep and watch value spread outward from the goal. Arrows show the greedy policy. Click a cell to see its Bellman backup worked out. Switch to Edit map and click cells to cycle empty → wall → pit, then see the policy re-route. Raise slip and the robot starts keeping clear of the pits.

Check yourself: value iteration needs \(P\) and \(R\). What if we don't have a model of the world (like real traffic)?
Chapter 4Core RL

Learning from experience: Monte Carlo and Temporal Difference

In practice

Monte Carlo (MC): drive the whole route, note the total reward, and average it over many trips. Temporal Difference (TD): after every single step, update your guess using the reward you just got plus your current guess for where you landed. TD learns while driving and doesn't need the trip to finish.

Technical update rules
\[ \text{MC:}\quad V(s_t) \leftarrow V(s_t) + \alpha\big[\,G_t - V(s_t)\,\big] \]
\[ \text{TD(0):}\quad V(s_t) \leftarrow V(s_t) + \alpha\big[\,\underbrace{r_{t+1} + \gamma V(s_{t+1})}_{\text{TD target}} - V(s_t)\,\big],\qquad \delta_t = r_{t+1}+\gamma V(s_{t+1}) - V(s_t) \]

Both are "move the estimate a fraction \(\alpha\) toward a target". The difference is the target.

Theory: bias vs variance
Monte CarloTD(0)
Target\(G_t\): real sampled return\(r+\gamma V(s')\): uses own estimate (bootstrapping)
BiasUnbiased: \(\mathbb{E}[G_t]=V^\pi(s_t)\)Biased while \(V\) is wrong
VarianceHigh: sums many random rewardsLow: one random reward and one transition
Needs episode end?YesNo, learns online
Markov assumptionNot neededExploits it (better in Markov worlds)

Between them sit n-step returns and TD(λ), which blend targets of every length. PPO's GAE (Chapter 6) is exactly this idea applied to advantages. Convergence: tabular TD(0) converges to \(V^\pi\) under Robbins–Monro step sizes (\(\sum\alpha_t=\infty,\ \sum\alpha_t^2<\infty\)).

MC vs TD on a 5-state random walk

Lab 4 · Sutton & Barto's classic

A robot starts in C and moves left or right at random. Exiting right pays 1, exiting left pays 0. True values are A=1/6 … E=5/6. Run episodes and compare how quickly each estimator locks on. Average 100 runs removes the luck and shows the typical learning curve.

Chapter 5Core RL

Control: Q-learning, SARSA and exploration

In practice

Evaluating a fixed policy isn't enough. We want the robot to improve. Keep a table \(Q(s,a)\), usually act greedily, and sometimes try a random action (ε-greedy). If the robot never tries the unfamiliar route, it can never find out the route is better.

Technical
\[ \text{Q-learning:}\quad Q(s,a) \leftarrow Q(s,a) + \alpha\big[r + \gamma \max_{a'}Q(s',a') - Q(s,a)\big] \]
\[ \text{SARSA:}\quad Q(s,a) \leftarrow Q(s,a) + \alpha\big[r + \gamma\, Q(s',a'_{\text{actually taken}}) - Q(s,a)\big] \]

Q-learning is off-policy: it learns the value of the greedy policy while behaving ε-greedily, because of the \(\max\). SARSA is on-policy: it learns the value of what it actually does, exploration included, so near cliffs and pits it learns safer paths. That distinction comes up often in robot-safety discussions.

Theory

Tabular Q-learning converges to \(Q^*\) with probability 1 (Watkins & Dayan, 1992) if every state–action pair is visited infinitely often and step sizes satisfy Robbins–Monro. It is stochastic approximation of the Bellman optimality fixed point from Chapter 3. Keep this in mind: the proof assumes a stationary environment. In MARL, other learning agents are part of the environment, so this assumption breaks. That is the root problem of Chapter 7.

Train a Q-learning robot

Lab 5 · tabular Q-learning

Train in batches and watch the greedy arrows settle. Try ε = 0: the robot often gets stuck on its first mediocre route. Then press Watch greedy run.

Chapter 6Deep RL

Deep RL: DQN, policy gradients, actor–critic, PPO

In practice

A car's state is continuous and high-dimensional, so no table can hold it. We replace the table with a neural network, \(Q_\theta(s,a)\) or \(\pi_\theta(a\mid s)\). Steering and throttle are continuous, which makes "max over actions" awkward, so we often learn the policy directly.

Technical: value-based (DQN)
\[ \mathcal{L}(\theta) = \mathbb{E}_{(s,a,r,s')\sim\mathcal{D}}\Big[\big(r + \gamma \max_{a'} Q_{\bar\theta}(s',a') - Q_\theta(s,a)\big)^2\Big] \]

There are two stabilisers. A replay buffer \(\mathcal{D}\) breaks the correlation between consecutive samples. A target network \(\bar\theta\), a slowly updated copy, stops the target from chasing itself. Double DQN fixes max-overestimation. Instability comes from the deadly triad: function approximation + bootstrapping + off-policy data.

Technical: policy gradient

Maximise \(J(\theta)=\mathbb{E}_{\pi_\theta}[G_0]\) directly. The policy gradient theorem (Sutton et al., 2000) says:

\[ \nabla_\theta J(\theta) = \mathbb{E}_{\pi_\theta}\big[\nabla_\theta \log \pi_\theta(a_t\mid s_t)\; A^{\pi}(s_t,a_t)\big],\qquad A^\pi(s,a)=Q^\pi(s,a)-V^\pi(s) \]

In words: make actions that turned out better than average (\(A>0\)) more likely. REINFORCE uses \(G_t\) in place of \(A\), which is the MC idea and has high variance. Actor–critic learns a critic \(V_\phi\) and uses the TD error \(\delta_t\) as the advantage estimate, which is the TD idea. GAE blends them: \(\hat A_t=\sum_l (\gamma\lambda)^l \delta_{t+l}\).

Theory: PPO's clipped objective

Big policy steps can wreck performance. PPO (Schulman et al., 2017) limits how far the new policy moves from the one that collected the data, using the probability ratio \(\rho_t(\theta) = \pi_\theta(a_t\mid s_t)/\pi_{\text{old}}(a_t\mid s_t)\):

\[ L^{\text{CLIP}}(\theta)=\mathbb{E}_t\Big[\min\big(\rho_t\hat A_t,\ \operatorname{clip}(\rho_t,1-\epsilon,1+\epsilon)\hat A_t\big)\Big] \]

It's a cheap first-order approximation of TRPO's trust region (a KL constraint). PPO matters here because MAPPO, the strongest simple MARL baseline, is PPO with a centralised critic.

See what the clip does

Lab 6 · PPO surrogate

Dashed line: unclipped \(\rho\hat A\). Solid: PPO's objective. Where the solid line goes flat, the gradient is zero, so the optimiser has no reason to push the ratio further.

Continuous-control workhorses: DDPG → TD3 (twin critics, delayed actor) → SAC (maximum-entropy, very sample-efficient off-policy). On-policy PPO dominates massively parallel simulation (Isaac Gym-style legged robots). Off-policy SAC/TD3 is common when samples are expensive.

Chapter 7MARL

From one agent to many: Markov games, Dec-POMDPs and equilibria

In practice

Put two self-driving cars at an unsignalised intersection. What's optimal for car 1 now depends on what car 2 does, and car 2 is also learning. From car 1's point of view the environment keeps changing its rules. A fleet of warehouse robots, a platoon of trucks and a drone swarm all have this structure.

Technical: the models

Markov (stochastic) game (Shapley 1953; Littman 1994) with \(N\) agents:

\[ \mathcal{G}=\big(\mathcal{N}, \mathcal{S}, \{\mathcal{A}_i\}_{i=1}^N, P, \{R_i\}_{i=1}^N, \gamma\big),\quad P(s'\mid s,\mathbf{a}),\ \ \mathbf{a}=(a_1,\dots,a_N)\in \mathcal{A}_1\times\dots\times\mathcal{A}_N \]

Each agent's value depends on the joint policy \(\boldsymbol\pi=(\pi_1,\dots,\pi_N)\): \(V_i^{\boldsymbol\pi}(s)=\mathbb{E}_{\boldsymbol\pi}[\sum_k\gamma^k r_{i,t+k+1}\mid s_t=s]\). Robots and cars only see locally, and in cooperative tasks they share one team reward, so the standard model is the Dec-POMDP:

\[ \big(\mathcal{N},\mathcal{S},\{\mathcal{A}_i\},P,R,\{\Omega_i\},O,\gamma\big),\qquad o_i \sim O_i(\cdot\mid s),\qquad \pi_i(a_i\mid \tau_i) \]

Here \(\tau_i\) is agent \(i\)'s own action–observation history. Finding an optimal finite-horizon Dec-POMDP policy is NEXP-complete (Bernstein et al., 2002), much harder than a single-agent MDP (P-complete). That's why practical MARL uses approximations and learning.

The five core challenges
ChallengeWhat goes wrongDriving / robot exampleTypical remedy
Non-stationarityOthers' policies change, so \(P\) and \(R\) seen by agent \(i\) drift and single-agent convergence proofs failCar A learns to be aggressive; car B's "yield" habit suddenly stops paying offCentralised critics (CTDE), opponent modelling, slow/trust-region updates
Credit assignmentWith a shared reward, who caused the success?Platoon saves fuel: was it the lead truck or the 3rd?Value decomposition (VDN/QMIX), counterfactual baselines (COMA), difference rewards
Joint-action explosion\(|\mathcal{A}|^N\) grows exponentially20 robots × 5 actions = \(5^{20}\approx 10^{14}\) joint actionsDecentralised actors, parameter sharing, mean-field, GNNs
Partial observabilityLocal sensors onlyOccluded pedestrian behind a truckRNN policies, communication, belief states
Equilibrium selectionMany equilibria, agents may pick incompatible onesBoth cars wait politely forever, or both goConventions, communication, centralised training
Theory: solution concepts

In general-sum games there's no single "optimal" policy. The central concept is the Nash equilibrium: no agent can do better by changing only its own policy.

\[ V_i^{(\pi_i^*,\,\boldsymbol\pi_{-i}^*)}(s) \;\ge\; V_i^{(\pi_i,\,\boldsymbol\pi_{-i}^*)}(s)\quad \forall i,\ \forall \pi_i,\ \forall s \]

Related concepts: best response \(\pi_i\in \arg\max V_i^{(\pi_i,\boldsymbol\pi_{-i})}\); Pareto optimality (no one can gain without someone losing); correlated equilibrium (a shared signal, like a traffic light, coordinates the agents). Nash exists in mixed strategies for finite games (Nash 1950), but can be Pareto-inefficient. The Prisoner's-dilemma preset below shows this. For zero-sum games there's minimax-Q (Littman 1994); for general-sum, Nash-Q (Hu & Wellman 2003), which needs strong assumptions to converge.

Two cars, one intersection: learning dynamics in policy space

Lab 7 · game theory meets learning

Each car independently runs gradient ascent on its own payoff. Click anywhere in the square to start both cars at those probabilities and watch where independent learning ends up. Green cells in the table are pure Nash equilibria. Payoffs are editable (row car first, column car second).

Chapter 8MARL

How to train many agents: CL, DL and CTDE

In practice

In simulation you can see everything: every car's position, every action. On the real road each car only has its own sensors and maybe a patchy V2V link. The dominant paradigm uses that asymmetry: train with global information, execute with local information.

Centralised learning (CL)

One "super-agent" picks the joint action \(\mathbf a\) from the global state. It reduces to a single-agent MDP, but the action space is \(|\mathcal{A}|^N\) and it needs perfect communication at run time. That's rarely deployable on cars.

Decentralised / independent learning (DL)

Each agent treats the others as part of the environment: IQL, IPPO. It's simple and scales, but has no convergence guarantee because of non-stationarity. Even so, IPPO is a surprisingly strong baseline (de Witt et al., 2020).

Centralised Training, Decentralised Execution (CTDE)

Actors \(\pi_i(a_i\mid\tau_i)\) use only local observations, so they are deployable. During training, a critic or mixer gets the global state \(s\) and all actions \(\mathbf a\). From the critic's view the environment is stationary again, since it conditions on what others did. MAPPO, MADDPG, COMA, QMIX and VDN are all CTDE.

CTDE architecture

Diagram
EXECUTION: on each vehicle, local only Actor π₁(a₁ | τ₁)car 1 sensors Actor π₂(a₂ | τ₂)car 2 sensors Actor πₙ(aₙ | τₙ)car N sensors TRAINING ONLY: in the simulator, global info Centralised critic / mixer V(s) · Q(s, a₁…aₙ) · Q_tot = f(Q₁…Qₙ, s) aᵢ, oᵢ + global state s gradients
Reward structure taxonomy
SettingRewardExamplesTypical algorithms
Fully cooperative\(R_1=\dots=R_N\)Warehouse fleet, truck platoon, drone mapping, multi-arm assemblyVDN, QMIX, MAPPO, COMA
Fully competitiveZero-sum \(\sum_i R_i = 0\)Autonomous racing, pursuit–evasion, adversarial testingMinimax-Q, self-play, PSRO
Mixed / general-sumArbitrary \(R_i\)Real traffic: each driver has own goals, but everyone wants no crashMADDPG, independent PPO, social-preference methods

Two robots must swap ends of a corridor

Lab 8 · independent vs centralised learners

Robot A (teal) must reach the right end and robot B (amber) the left. There's one passing bay. Team reward: −1 per step, −5 per collision. Train each learner type, then watch. Independent: each robot has its own Q-table over the joint state but only picks its own action. Centralised: one Q-table over joint actions (25 here, but \(5^N\) in general).

Chapter 9Advanced

The algorithm families you must be able to explain

1 · Value decomposition (cooperative, discrete actions)

Learn a team value \(Q_{tot}\) but factor it into per-agent utilities \(Q_i(\tau_i,a_i)\), so each agent can act greedily on its own and still pick the team's best joint action. This requirement is the IGM principle (Individual-Global-Max):

\[ \arg\max_{\mathbf a} Q_{tot}(\boldsymbol\tau,\mathbf a) = \Big(\arg\max_{a_1}Q_1(\tau_1,a_1),\ \dots,\ \arg\max_{a_N}Q_N(\tau_N,a_N)\Big) \]
  • VDN (Sunehag et al., 2018): \(Q_{tot}=\sum_i Q_i\). Simple, but can only represent additive team values.
  • QMIX (Rashid et al., 2018): \(Q_{tot}=f_{mix}(Q_1,\dots,Q_N; s)\) with \(\frac{\partial Q_{tot}}{\partial Q_i}\ge 0\). Monotonicity is sufficient for IGM. The mixer's weights are generated from the global state by hypernetworks and kept non-negative (absolute value), so the state can shape the mixing while monotonicity holds.
  • QTRAN, QPLEX, Weighted QMIX: relax monotonicity to represent richer (non-monotonic) coordination while keeping IGM.

Why QMIX forces non-negative mixing weights

Lab 9 · IGM consistency

Two robots each choose action 0 or 1. Set their individual utilities and the mixing weights (a linear mixer \(Q_{tot}=w_1Q_1+w_2Q_2\); VDN is \(w_1=w_2=1\)). Shaded cell: the team's best joint action. Dashed cell: what each robot picks by looking only at its own \(Q_i\). Make a weight negative and watch them disagree.

2 · Centralised-critic policy gradients (any reward structure, continuous OK)

MADDPG (Lowe et al., 2017): each agent has a deterministic actor \(\mu_i(o_i)\) and a centralised critic \(Q_i(\mathbf{x}, a_1,\dots,a_N)\) that sees everyone's observations and actions. It works for cooperative, competitive and mixed settings, and handles continuous control such as steering.

\[ \nabla_{\theta_i}J = \mathbb{E}\big[\nabla_{\theta_i}\mu_i(o_i)\,\nabla_{a_i}Q_i(\mathbf x,a_1,\dots,a_N)\big|_{a_i=\mu_i(o_i)}\big] \]

COMA (Foerster et al., 2018) targets credit assignment. It asks "how much better was my action than what I'd typically do, holding everyone else fixed?", using a counterfactual baseline:

\[ A_i(s,\mathbf a) = Q(s,\mathbf a) - \sum_{a_i'}\pi_i(a_i'\mid\tau_i)\,Q\big(s,(\mathbf a_{-i},a_i')\big) \]

MAPPO (Yu et al., 2022, "The Surprising Effectiveness of PPO in Cooperative Multi-Agent Games"): PPO actors with parameter sharing plus a centralised value function \(V_\phi(s)\). It matches or beats more complex methods on SMAC, MPE and Google Research Football, and is the default strong baseline for robotics MARL. HAPPO/HATRPO (Kuba et al., 2022) update agents sequentially and come with a monotonic improvement guarantee for heterogeneous agents.

# MAPPO: the loop you should be able to sketch on a whiteboard
for iteration in range(K):
    for t in range(T):                            # rollout in parallel sims
        a_i, logp_i = actor_θ(o_i)  for each agent i     # shared weights + agent-ID
        s', o', r, done = env.step(a_1..a_N)
        buffer.add(o_i, a_i, logp_i, s, r, done)
    A_i  = GAE(r, V_φ(s), γ, λ)                   # centralised critic sees global state
    for epoch in range(E):
        θ ← θ + ∇ L_CLIP(θ; A_i)                   # PPO clip per agent sample
        φ ← φ − ∇ (V_φ(s) − R̂)²
# deploy: only actor_θ(o_i) runs on each robot
3 · Scaling and communication
  • Parameter sharing: one network for all homogeneous agents, with an agent-ID in the input. Sample-efficient, and the standard choice for fleets.
  • Mean-field MARL (Yang et al., 2018): approximate the others by their average action, \(Q_i(s,a_i,\bar a_{-i})\). This scales to hundreds of agents (dense traffic, swarms).
  • Graph neural networks / attention: agents are nodes, neighbours within sensing range are edges. They handle a variable number of cars and are permutation-invariant.
  • Learned communication: CommNet (Sukhbaatar et al., 2016), DIAL (Foerster et al., 2016), TarMAC (Das et al., 2019, targeted attention messages). The V2V analogue.
AlgorithmFamilyCritic / mixer inputActionsRewardsUse it when
IQL / IPPOIndependentlocaldisc. / bothanyBaseline, huge N
VDNValue decomp.sum of \(Q_i\)discretesharedSimple cooperative
QMIXValue decomp.monotone mix + \(s\)discretesharedCoop. with state-dependent coordination
COMAActor–critic\(Q(s,\mathbf a)\) counterfactualdiscretesharedCredit assignment matters
MADDPGActor–critic\(Q_i(\mathbf x,\mathbf a)\)continuousanyMixed motives, continuous control
MAPPOActor–critic\(V(s)\)bothshared (mostly)Default strong baseline
Mean-field Q/ACApproximation\(\bar a\) of neighboursdiscreteanyVery many similar agents
Chapter 10Research

MARL for robotics and self-driving cars

A full worked formulation

This is what a strong seminar slide on "how I'd formulate the problem" looks like. Scenario: N connected AVs negotiating an unsignalised intersection with human-driven traffic.

ComponentChoiceWhy
ModelDec-POMDP (cooperative among AVs), humans as part of environment → mixed autonomyAVs share a fleet objective; humans are not controlled
Observation \(o_i\)Ego speed, heading, lane, distance-to-conflict-point; relative pose & velocity of k=5 nearest vehicles; route intent; optional V2V messagesFixed size for MLPs; use a GNN or attention for variable k
Action \(a_i\)Continuous accel. \(\in[-4,2]\ \text{m/s}^2\) along a planned path, or discrete {yield, creep, go}Hierarchical: RL decides behaviour, a classical controller (MPC/PID) tracks it, which is safer and easier to transfer
Reward \(r\)\(w_1\,\text{progress} - w_2\,\mathbb{1}[\text{collision}] - w_3\,|\text{jerk}| - w_4\,\mathbb{1}[\text{TTC}<\tau]\)Efficiency, safety, comfort. Watch for reward hacking (e.g. never entering the intersection)
AlgorithmMAPPO with parameter sharing + centralised critic on global stateStable, scales, CTDE-deployable
Safety layerConstrained MDP (Lagrangian PPO) or a safety shield / control-barrier-function filter on actionsReward penalties alone don't guarantee safety
MetricsSuccess rate, collision rate, mean travel time, throughput, jerk, generalisation to unseen traffic densityReport mean ± std over ≥ 5 seeds
Where MARL is applied
  • Highway merging and lane changing: negotiation with cooperative and human vehicles. Shalev-Shwartz et al. (2016) framed safe multi-agent driving as RL plus hard safety constraints.
  • Intersections and roundabouts: signal-free coordination; also traffic-signal control, where each light is an agent.
  • Platooning / cooperative adaptive cruise control: string stability, fuel savings.
  • Mixed autonomy: a few AVs smoothing stop-and-go waves for the human traffic (Wu et al., Flow framework on SUMO).
  • Social driving: Social Value Orientation, estimating how selfish or altruistic other drivers are (Schwarting et al., PNAS 2019).
  • Multi-robot navigation: decentralised collision avoidance from raw LiDAR with PPO and a shared policy (Long et al., ICRA 2018); warehouse fleets; multi-drone coverage; multi-arm manipulation.
Simulators and benchmarks to name-drop correctly
ToolWhat it is
SMARTS (Huawei, 2020)Multi-agent driving simulation built for MARL, with realistic interaction scenarios
MetaDriveLightweight, procedurally generated driving scenes with multi-agent maps (roundabout, intersection, bottleneck, parking lot)
highway-envSimple 2-D highway/merge/intersection envs, Gymnasium API, great for quick prototypes
CARLA / SUMO + FlowHigh-fidelity 3-D sim / microscopic traffic simulation for mixed autonomy
VMAS, MPE, PettingZooVectorised multi-robot sims (VMAS, GPU-batched); particle environments; standard multi-agent API
SMAC / SMACv2StarCraft micromanagement: the standard cooperative MARL benchmark (not robotics, but reviewers expect it)
LibrariesEPyMARL, BenchMARL (TorchRL), MARLlib, RLlib multi-agent
Open problems: good PhD directions
  • Safety with guarantees: constrained MARL, shielding, CBFs in multi-agent settings; verification of learned policies.
  • Sim-to-real: domain randomisation, system identification, robustness to sensor noise and latency. The multi-agent gap is bigger, because other agents' behaviour also shifts.
  • Human interaction: modelling heterogeneous human drivers, zero-shot coordination / ad hoc teamwork with unknown partners.
  • Scalability and variable N: graph/attention policies that generalise from 5 cars in training to 50 in testing.
  • Communication under constraints: bandwidth, delay and dropouts in V2V; what to communicate.
  • Robustness and adversaries: adversarial agents for stress-testing AV stacks (a competitive MARL use).
  • Offline MARL: learning from logged fleet data without risky online exploration.
  • Evaluation: seeds, scenario diversity, standardised metrics. The field has real reproducibility issues.
Chapter 11Your talk

Seminar kit: cheat sheet, tough questions, self-test

A 6-slide spine for your talk
  • Motivation: driving is inherently multi-agent; single-agent RL treats other cars as noise.
  • Formalism: MDP → Markov game → Dec-POMDP (one slide, three tuples).
  • Why it's hard: non-stationarity, credit assignment, \(|\mathcal A|^N\), partial observability.
  • CTDE and the key families: value decomposition (QMIX, IGM) vs centralised critics (MAPPO, MADDPG).
  • Application: the intersection formulation table from Chapter 10.
  • Open problems and your angle: safety, sim-to-real, human interaction, scalability.
Equation cheat sheet
IdeaEquation
Return\(G_t=\sum_k\gamma^k r_{t+k+1}=r_{t+1}+\gamma G_{t+1}\)
Bellman optimality\(Q^*(s,a)=\mathbb E[r+\gamma\max_{a'}Q^*(s',a')]\)
MC / TD\(V\leftarrow V+\alpha(G-V)\) · \(V\leftarrow V+\alpha(r+\gamma V'-V)\)
Q-learning\(Q\leftarrow Q+\alpha(r+\gamma\max_{a'}Q'-Q)\)
Policy gradient\(\nabla J=\mathbb E[\nabla\log\pi(a\mid s)A(s,a)]\)
PPO\(\min(\rho\hat A,\ \mathrm{clip}(\rho,1\pm\epsilon)\hat A)\)
Nash\(V_i(\pi_i^*,\pi_{-i}^*)\ge V_i(\pi_i,\pi_{-i}^*)\ \forall i,\pi_i\)
IGM / QMIX\(\arg\max_{\mathbf a}Q_{tot}=(\arg\max_{a_i}Q_i)_i\) · \(\partial Q_{tot}/\partial Q_i\ge0\)
COMA baseline\(Q(s,\mathbf a)-\sum_{a_i'}\pi_i(a_i')Q(s,(\mathbf a_{-i},a_i'))\)
Questions a committee is likely to ask
"Why not just train one single-agent RL car and treat others as environment?"

That's independent learning. It works when the others' behaviour is fixed (scripted traffic). Once they adapt, the transition dynamics seen by each car are non-stationary: \(P(s'\mid s,a_i)=\sum_{\mathbf a_{-i}}\boldsymbol\pi_{-i}(\mathbf a_{-i}\mid s)P(s'\mid s,a_i,\mathbf a_{-i})\) changes as \(\boldsymbol\pi_{-i}\) changes. Q-learning's convergence proof no longer applies, and you get oscillation or miscoordination (Lab 8). It also ignores coordination opportunities such as cooperative merging.

"Does CTDE assume communication at test time?"

No. That's the point. Only the decentralised actors run on the vehicle, using local observations. Centralised information is used only in training, inside the critic or mixer, which is thrown away at deployment. If V2V exists you can add it as part of \(o_i\) or as learned communication.

"What's the limitation of QMIX?"

Monotonicity is sufficient but not necessary for IGM, so QMIX can't represent joint values where one agent's best action depends non-monotonically on the others' (e.g. "go only if the other yields, otherwise the payoff flips"). QTRAN, QPLEX and Weighted QMIX address this. It is also discrete-action and cooperative-only.

"How do you handle safety? RL can crash."

Layered: (1) CMDP formulation, maximise reward subject to \(\mathbb E[\sum\gamma^t c_t]\le d\), solved with Lagrangian methods; (2) a runtime shield or control-barrier-function filter that overrides unsafe actions; (3) hierarchical design where RL picks behaviours and a verified low-level controller executes; (4) adversarial and scenario-based testing. Reward penalties alone give no guarantee.

"Why does MAPPO work so well when it's 'just PPO'?"

Yu et al. identified implementation details that matter: value normalisation, a global-state critic input with agent-specific features, parameter sharing, few PPO epochs, and small clip ε to limit non-stationarity from simultaneous updates. The trust region implicitly limits how fast the other agents' policies drift.

"How do you evaluate generalisation?"

Train and test on different traffic densities, road geometries and human-driver models; vary N; report success and collision rates with confidence intervals over several seeds; include rule-based baselines (IDM + MOBIL for highways) and single-agent RL baselines.

"What's the difference between a Markov game and a Dec-POMDP?"

A Markov game gives each agent its own reward and (usually) full state observation; it covers competitive and mixed settings. A Dec-POMDP is cooperative (one shared reward) and partially observable (each agent has its own observation function). A POSG (partially observable stochastic game) generalises both.

Self-test

Score: 0 / 0

Recommended references: Sutton & Barto, Reinforcement Learning: An Introduction (2nd ed., free online); Albrecht, Christianos & Schäfer, Multi-Agent Reinforcement Learning: Foundations and Modern Approaches (MIT Press, 2024, free PDF); Zhang, Yang & Başar, "Multi-Agent RL: A Selective Overview of Theories and Algorithms" (2021).