AGAI-L02: Game Theory and Population Dynamics

In short

How do we describe interacting agents formally, predict what they will do, and judge whether the result is any good? Games model the interaction, from a one-shot payoff matrix up to partially observable stochastic games with states and private observations. The Nash equilibrium, a mutual best response, predicts play; Pareto optimality, welfare and fairness say which outcomes are desirable. The two often disagree, which is what makes the Prisoner’s Dilemma and the Stag Hunt social dilemmas.

Equilibria are static: they do not say how agents get there. Evolutionary game theory adds the dynamics. In a population where better-earning strategies spread (the replicator equation), the Prisoner’s Dilemma ends in full defection, the Stag Hunt tips to one of two pure states, and the Hawk-Dove game settles in a stable mix.

The exam format is not announced yet; expect the game models and solution concepts, and computations: the Nash equilibria and optimal outcomes of a payoff matrix, and the rest points and stability of a replicator equation.

Simple rules, surprising group behaviour

The course starts with simple reflex agents (agents that pick an action from the current percept alone, with no memory or planning; see Agent Program). Even these teach three lessons that carry over to LLM agents: emergence (group behaviour that no single agent was programmed to produce), communication, and dilemmas.

Two classic examples of emergence:

  • Boids (Reynolds, 1987: “bird-oid” agents) produce a realistic flock from three local rules. Separation: move away from nearby agents to avoid crowding or collisions. Alignment: steer towards the average direction of nearby agents. Cohesion: move towards the average position of nearby agents to stay with the group. No rule mentions a flock.
  • Conway’s Game of Life is a grid of cells, each alive or dead, updated in steps. A live cell with fewer than 2 live neighbours dies (underpopulation); with 2 or 3 it survives; with more than 3 it dies (overpopulation). A dead cell with exactly 3 live neighbours becomes alive (birth); otherwise it stays dead. From these rules come stable shapes, shapes that cycle, and shapes that travel across the grid (the glider).

Game theory, the mathematics of interactions where each agent’s outcome depends on what the others do, gives the tools to analyse such dynamics.

Games as models of multi-agent interaction

A game formally defines a multi-agent interaction: who the agents are, what they can do, and what each gets. The course uses a hierarchy of four models, each containing the previous one as a special case:

  1. One-shot normal-form game: agents act once, at the same time.
  2. Repeated normal-form game: the same normal-form game played over many time steps; still one state.
  3. Stochastic game: agents, states, fully observable.
  4. Partially observable stochastic game (POSG): agents, states, each agent sees only part of what happens.

Normal-form games: actions and rewards only

A normal-form game has no time and no state, only actions and rewards.

Normal-form game

A 3-tuple :

  • : a finite set of agents,
  • : the finite set of actions of agent
  • : the reward function of agent , where is the set of joint actions (one action per agent)

Each reward depends on the joint action, so on what everyone else did too. With two agents the game is a matrix: rows are agent 1’s actions, columns agent 2’s, and each cell gives (row agent’s reward, column agent’s reward). The two games from Lecture 1:

Prisoner’s Dilemma (C = cooperate, D = defect):

CD
C3, 30, 5
D5, 01, 1

What is special: D pays more whatever the other agent does (5 > 3 against C, 1 > 0 against D), yet both prefer (C, C) to the (D, D) they end up in.

Stag Hunt, for example two coding agents that can coordinate changes to a shared repository (C) or each do a small, safe task alone (D):

CD
C4, 40, 3
D3, 02, 2

What is special: the best action copies the other agent’s. (C, C) is best for both, but cooperating alone earns 0, so C is risky.

Three classes of games, by how the rewards relate:

  • Zero-sum: the rewards in every cell sum to zero, so one agent’s gain is the other’s loss. Matching Pennies: both show a coin; the row agent wins (1, ) if the coins match, the column agent wins (, 1) if they differ.
  • Common-reward: all agents get the same reward in every cell, so their interests coincide. Example: (A, A) gives 4, 4; (A, B) gives 0, 0; (B, A) gives 3, 3; (B, B) gives 2, 2.
  • General-sum: any other relation, such as the Prisoner’s Dilemma and the Stag Hunt, where interests partly align and partly conflict.

How agents choose. Each agent follows a policy , a probability distribution over its actions, and samples action with probability . A policy that always picks the same action is pure; one that randomises is mixed.

Repeating the game: policies with memory

Interactions are often sequential. In a repeated normal-form game the same game is played at time steps and a policy can condition on the history:

where is agent ‘s action at step and is the sequence of joint actions played so far. Two strategies from Lab 1:

  • Tit-for-Tat (TFT): start by cooperating; then repeat the opponent’s last action.
  • Win-Stay Lose-Shift (WSLS): start by cooperating; keep your action if it earned one of the top payoffs (3 or 5 in the Prisoner’s Dilemma), switch otherwise.

The number of steps is crucial. In the Prisoner’s Dilemma, always-defect gains once by exploiting TFT in round 1, which counts for a lot in a short game; in a long one, reciprocators earning 3 per round with each other pull ahead. Lab 1 finds that against TFT and WSLS, always-defect wins for 1 to 3 rounds and TFT from 4.

Adding states: stochastic games

A stochastic game adds states: the environment changes in response to the joint action, and each state can have its own game.

Stochastic game

A 6-tuple :

  • : a finite set of agents
  • : a finite set of states
  • : the finite set of actions of agent
  • : the reward function of agent
  • : the transition function
  • : the initial state distribution

Outside the course material, the usual signatures are (reward for moving from one state to the next under a joint action), (the probability of reaching from under joint action ) and (the probability of starting in each state).

A three-state game

Two agents, each with actions 1 and 2, and three states , each with its own payoff matrix:

(1, 1)1, 11, 31, 1
(1, 2)0, 10, 40, 0
(2, 1)2, 24, 04, 1
(2, 2)1, 13, 13, 2

Some transitions: in , joint action (2, 2) pays (1, 1) and leads back to with probability 0.5 or to with 0.5. In , (1, 2) pays (0, 4) and leads to with probability 0.8 or with 0.2. In , (2, 1) pays (4, 1) and returns to for sure. So this game has 2 agents, 2 actions each and 3 states. An action now matters twice: for today’s reward and for which game is played tomorrow.

Two more examples. The two-square vacuum world of Lecture 1 is a stochastic game with one agent: 3 actions (Left, Right, Suck) and 8 states (2 robot positions times dirty or clean for each square; counts worked out here, since the course material leaves them open). A grid world where two agents walk around collecting apples (level-based foraging) has 2 agents and a state for every arrangement of agents and remaining apples. Outside the course material: a stochastic game with one agent is a Markov Decision Process, and a repeated normal-form game is a stochastic game with one state.

Hiding the state: partially observable stochastic games

A POSG models decision processes with incomplete information: agents receive observations that give incomplete information about the state and about other agents’ actions. It applies wherever sensing is limited: autonomous driving (a car cannot see behind a truck), or strategic games with private, hidden information such as card games.

Partially observable stochastic game (POSG)

An 8-tuple : a stochastic game plus, for each agent ,

  • : a finite set of observations
  • : the observation function, giving the probability that agent observes when joint action led to state

The agent no longer sees the state, so its policy conditions on its own observation history:

In the foraging grid, each agent sees only a small square of cells around itself. Outside the course material: a POSG with one agent is a POMDP, and a stochastic game is a POSG in which every agent’s observation reveals the full state.

Solution concepts: what will agents do, and what is good?

The models describe interactions without saying what happens. Solution concepts answer four questions: Which actions will agents play? Which combinations of actions are desirable? What does it mean for an agent to act optimally? How desirable is the joint policy of all agents?

All the definitions use , the expected return of agent under joint policy . In a normal-form game, with agents choosing independently, it is the reward averaged over joint actions (the formula is standard notation from outside the course material):

where is the probability of joint action .

Best response

“Optimal” only makes sense relative to what the others do. In the Stag Hunt, C is the best action against a partner who plays C, and D against a partner who plays D. So optimality is defined against fixed policies of the others.

Best response

A best-response policy maximises the expected return for agent against a given set of policies for all other agents, : where is the complete joint policy.

is a set, since several policies can tie. See Best Response.

Nash equilibrium: everyone best-responds at once

Nash equilibrium (NE)

The Nash equilibrium applies the idea of a mutual best response to general-sum games with two or more agents. A joint policy is a Nash equilibrium if no agent can improve its expected return by changing its policy, assuming the other agents’ policies remain fixed: In a NE, each agent’s policy is a best response to all other agents’ policies.

John Nash (1950) proved that every finite general-sum normal-form game has at least one such equilibrium once mixed policies are allowed, using a fixed-point theorem: some joint strategy is a best response to itself.

Finding pure equilibria in a matrix. For each column, mark the row agent’s best reward; for each row, mark the column agent’s best reward. A cell marked twice is a pure NE.

Finding a mixed equilibrium. An agent only mixes between actions that earn the same against the other’s policy; if one earned more, it would drop the other. So in a symmetric two-action game, find the probability of the partner playing C at which C and D earn the same.

Prisoner's Dilemma, Stag Hunt, Rock-Paper-Scissors

Prisoner’s Dilemma with (C, C) = 4, 4; (C, D) = , 6; (D, C) = 6, ; (D, D) = 0, 0. Against C the row agent prefers D (6 > 4), against D it prefers D (0 > ); the column agent likewise. Only (D, D) is marked twice: the unique NE.

Stag Hunt (4, 4; 0, 3; 3, 0; 2, 2). Against C the best response is C (4 > 3), against D it is D (2 > 0). (C, C) and (D, D) are both NE, plus a mixed one: against a partner playing C with probability , C earns and D earns , equal at , so each plays C with probability 2/3.

Rock-Paper-Scissors, zero-sum: win 1, lose , tie 0.

RPS
R0, 0, 11,
P1, 0, 0, 1
S, 11, 0, 0

No cell is marked twice: whatever pure pair is played, someone could switch to the action that beats the other’s. The equilibrium is mixed: each agent plays each action with probability 1/3. Against that policy every action earns , so no change of policy can earn more than 0, and neither agent can gain by deviating.

What a Nash equilibrium does not tell you

  • Sub-optimality. Nash equilibria do not always maximise expected returns. In the Prisoner’s Dilemma (D, D) is the NE, but (C, C) gives both agents more.
  • Non-uniqueness. There can be multiple, even infinitely many, equilibria, each with different expected returns. The Stag Hunt has three; the concept does not say which one agents will play.
  • Incompleteness. An equilibrium says where no one wants to move. In sequential games it does not specify what agents do off the equilibrium path (after someone deviates), and it does not say how agents reach the equilibrium in the first place.

The first two lead to refinements that pick out desirable outcomes (next section); the third leads to the population dynamics of evolutionary game theory.

Desirable outcomes: Pareto optimality, welfare and fairness

To narrow down the solutions, we can add requirements that describe what is desirable for the group.

Pareto optimality

A joint policy is Pareto-dominated by another joint policy if A joint policy is Pareto-optimal if it is not Pareto-dominated by any other joint policy. Intuition: no other joint policy improves the expected return for at least one agent without reducing it for any other agent.

In the Stag Hunt, (C, C) = (4, 4) dominates every other cell, so it is the only Pareto-optimal outcome. In the Prisoner’s Dilemma, (C, C), (C, D) and (D, C) are all Pareto optimal: any move away from (D, C) hurts the defector. Pareto optimality rules out waste and says nothing about fairness. See Pareto Optimality. Welfare and fairness constrain the space further:

Welfare and fairness

A joint policy is welfare-optimal if and fairness-optimal if .

The sum ignores how the total is split; the product rewards equal splits. Two outcomes with payoffs (5, 5) and (9, 1) have the same welfare, 10, but fairness 25 against 9. Outside the course material: a welfare-optimal outcome is always Pareto optimal (a Pareto improvement would raise the sum), and the product only works as a fairness measure for positive payoffs.

Social dilemmas

Side by side, the two kinds of solution concept show why the games of Lecture 1 are social dilemmas: situations where agents who each pursue their own interest reach an outcome that is worse for the group than one they could have reached together.

  • Prisoner’s Dilemma, a dilemma of cooperation: the only NE, (D, D), is the only outcome that is not Pareto optimal.
  • Stag Hunt, a dilemma of coordination or trust: the welfare-optimal (C, C) is an equilibrium, but so is the worse (D, D), and nothing in the NE concept favours the good one.

From rational players to adapting populations

The solution concepts so far assume rational agents who compute best responses, and leave open how agents would ever reach an equilibrium. John von Neumann and Oskar Morgenstern said it of their own theory in Theory of Games and Economic Behavior:

“We repeat most emphatically that our theory is thoroughly static. A dynamic theory would unquestionably be more complete and therefore preferable.”

They added that building a dynamic theory is futile as long as the static side is not thoroughly understood.

Real agents are often not so rational: they resort to trial and error, have incomplete information, and imitate others. So the question becomes how agents in a population change their behaviour over time, depending on what others are doing. Concretely: in a large Stag Hunt population, half C and half D, meeting at random, does the number of C agents increase, decrease or stay the same? Both pure outcomes are Nash equilibria, so the static theory cannot answer.

Evolutionary game theory

Evolutionary game theory combines evolutionary biology with game theory. In natural selection the genotype of fit individuals spreads in a population. But fitness cannot be measured in isolation: it depends on the frequency of other types, just as in game theory a payoff depends on the strategies of others. A cooperator does well among cooperators and badly among defectors. In the 1970s the biologists John Maynard Smith and George R. Price proposed applying game theory to understand evolution. The agents need no rationality: what earns more becomes more common.

The replicator equation

Take a large population where a fraction uses strategy C and uses D, and agents are paired at random. The replicator equation (Taylor and Jonker, 1978) describes how evolves:

Replicator equation

  • : the fraction of individuals using strategy C
  • : the average payoff (fitness) of C when a fraction adopts C
  • : the average fitness in the population, with the fitness of D

C replicates if the fitness of C is higher than the average. The factor makes growth proportional to how common C already is: a strategy nobody uses cannot spread.

The same equation describes the dynamics of strategy evolution in three fields:

  • Biology: replication and natural selection; fitter types have more offspring.
  • Economics: social learning and imitation; agents copy those who do better.
  • Computer science: reinforcement learning dynamics. The link is Börgers and Sarin, “Learning through reinforcement and replicator dynamics” (their result, from outside the course material: a simple reinforcement learner follows the replicator equation on average).

The two-strategy form. Substitute :

so

Replicator equation, two strategies

is zero when either strategy is absent and positive in between, so the sign of alone decides whether C grows. With random pairing a partner plays C with probability , so for payoffs (C meets C), (C meets D), (D meets C), (D meets D):

Reading the dynamics: rest points and stability

A rest point is a state where : , , and any where . A rest point is stable if the population returns to it after a small push in either direction, and unstable if a push sends it away. You read this off the sign of on either side: if just below and just above, the population is pushed back from both sides.

The Stag Hunt population

With , , , : Rest points: , , . For , so ; for , .

 x = 0 ●  <<<<<<<<<<<<<<<<<<  ○  >>>>>>>  ● x = 1
       stable    x falls    2/3  x rises   stable
                          unstable

and are stable; is unstable, a tipping point. Answer to the 50/50 question: at , , so the number of C agents decreases, all the way to zero. A C agent earns on average, a D agent : cooperation pays only once more than two thirds of the population cooperates.

The interior rest point is the Stag Hunt’s mixed Nash equilibrium, but no adapting population ends there: the slightest push tips it. The two coincide because, with random pairing, the share plays the role of a rational agent’s belief that its partner cooperates (Lab 1 works this out).

A quick stability check (derived in Lab 1): write . Then and , and a rest point is stable when there. So all-D is stable when (a lone cooperator among defectors earns less than they do), and all-C is stable when (a lone defector among cooperators earns less than they do).

The Prisoner’s Dilemma in a population

Write the Prisoner’s Dilemma as a donation game: cooperating means paying a cost to give the partner a benefit , with (pulling someone out of the water costs you effort and saves them).

CD
C, ,
D, 0, 0

This is a Prisoner’s Dilemma since . The Nash equilibrium is (D, D): D earns more than C whatever the partner does. The social optimum (the outcome with the largest sum of payoffs) is (C, C), with total .

What can we expect from evolution?

Cooperating always costs exactly relative to defecting, whoever you meet, so for every . The population ends fully composed of D, from any start. is a rest point, but unstable: one defector among cooperators earns against their and spreads. Evolution here reproduces the Nash prediction and its sub-optimality.

Hawk-Dove: coexistence

The Hawk-Dove or Chicken game, with C = conventional and D = dangerous (outside the course material, the story: two drivers race towards each other; the conventional one swerves, the dangerous one keeps going):

CD
C3, 32, 8
D8, 2,

Here the best response is the opposite of the partner’s action: against C, D earns more (8 > 3); against D, C earns more (2 > ). The symmetric Nash equilibrium is mixed. If the partner plays C with probability , C earns and D earns ; these are equal at , so each agent plays C with probability 4/9. Outside the course material, but it follows from the best responses: the game also has two asymmetric pure equilibria, (C, D) and (D, C), where one agent yields and the other does not.

In a population:

Rest points: , , . Below , ; above, . So and are unstable (, ) and is stable: the population converges to a coexistence of C and D. Each strategy earns more when it is rare: among mostly conventional drivers the dangerous one gets 8, among mostly dangerous ones the conventional one gets 2 against their .

The interior rest point is again the mixed equilibrium, but here the population ends there. Whether adaptation reaches a mixed equilibrium depends on the game.

Equilibria against population outcomes

GameNash equilibriaWelfare optimumReplicator outcome
Prisoner’s Dilemma(D, D)(C, C)all D, from any start
Stag Hunt(C, C), (D, D), mixed at 2/3(C, C)all C above 2/3, all D below
Hawk-Dovemixed at 4/9 (plus (C, D), (D, C))(C, D) or (D, C), total 10stable mix, 4/9 C

What to be able to write

  • The four game models, their tuples and what each adds, with examples; zero-sum, common-reward and general-sum games.
  • Best response and Nash equilibrium in words and formulas, Nash’s existence result, and the three limitations.
  • Pure and mixed equilibria, Pareto optima, welfare and fairness optima of a given matrix.
  • Why static solution concepts lead to evolutionary game theory; the replicator equation, its two-strategy form and its three readings.
  • Rest points and stability for the Stag Hunt (and the 50/50 question), the donation game and Hawk-Dove.

Model answers are in the exam questions below.

Exam questions

Flashcards

  • Course: Course overview
  • Previous lecture: AGAI-L01 - Agents, Multiagent Systems and Agentic AI (agent types, the dilemmas introduced)
  • Lab: AGAI-Lab01 - Simple Agents, Complex Dynamics for worked analyses of best responses, belief thresholds, repeated-game tournaments, the replicator dynamics of the Prisoner’s Dilemma and Stag Hunt, and the stability check
  • Background reading: Albrecht, Christianos and Schäfer, Multi-Agent Reinforcement Learning: Foundations and Modern Approaches (MIT Press, 2024), Chapter 3 (Games: models of multi-agent interaction) and Chapter 4 (Solution concepts for games)
  • Source: Agentic Artificial Intelligence, Lecture 2, “Game Theory and Population Dynamics”, Fernando P. Santos, MSc AI, UvA, 29 October 2026
  • Papers and books cited: C. W. Reynolds, “Flocks, herds and schools: A distributed behavioral model”, ACM SIGGRAPH Computer Graphics (1987). J. F. Nash, “Equilibrium points in -person games”, PNAS 36(1), 48-49 (1950). J. von Neumann and O. Morgenstern, Theory of Games and Economic Behavior (1944), section 4.8.2. P. D. Taylor and L. B. Jonker, “Evolutionary stable strategies and game dynamics”, Mathematical Biosciences (1978). T. Börgers and R. Sarin, “Learning through reinforcement and replicator dynamics”, Journal of Economic Theory (1997).