Search

Search papers and lessons

Markov Game

Level 4 · 10 min read

A Markov game is a Markov decision process with several agents, each with its own reward, where the next state depends on everyone's actions together.

On this page

  • Colour = topic mix
  • Probability
  • Discrete math
  • Calculus
  • Linear algebra
  • Microeconomics
  • Reinforcement learning
  • ReadReady to readNot yet

TL;DR

A Markov decision process describes one agent that picks actions in a world whose next state depends only on the current state and action. A Markov game keeps that structure but adds several agents. Each agent picks its own action, the world moves to a next state based on all the actions together, and each agent receives its own reward. Because every agent is also learning or playing a strategy, the game asks what each agent should do given what the others do, which is the question a Nash equilibrium answers.

Builds on: Markov Decision Process, Nash Equilibrium · Leads to: the MADDPG paper, Centralized Training with Decentralized Execution

Where it's used

  • Multi-agent reinforcement learning. Teams of learning agents act in shared environments, such as several robots moving objects, or units in a strategy game. The Lowe and colleagues paper (2017) frames its setting as a multi-agent extension of MDPs called partially observable Markov games, and tests it in both competitive and cooperative scenarios, including environments with explicit communication between agents.
  • Game-playing with several controlled units. A concurrent paper, cited by the MADDPG paper, applied policy gradient methods with a centralized critic to a StarCraft micromanagement task, where many units are controlled at once.
  • Economics. Several firms or bidders act in a market whose state changes over time, and each one's payoff depends on the others' moves. When this repeats over many periods, a stochastic game is the natural model.

How it works

A tiny instance first. There are two agents, Agent 1 and Agent 2. The world has two states, s0s_0 (the start) and s1s_1. Each agent can take action aa or action bb. Use these rules:

  • If both agents choose aa while the world is in s0s_0, both get reward 1 and the world moves to s1s_1.
  • If any other joint action happens in s0s_0, both get reward 0 and the world stays in s0s_0.
  • In s1s_1, whatever the agents do, both get reward 2 and the world stays in s1s_1.
  1. The world starts in s0s_0. Both agents see that state. Check: the starting state is known to both.
  2. Agent 1 chooses aa. Agent 2 chooses bb. This is the joint action (a,b)(a, b). Neither agent knows the other's choice until both are made. Check: the next state depends on both choices together, not on one agent alone.
  3. The rule for (a,b)(a, b) in s0s_0 says both rewards are 0 and the world stays in s0s_0. Check: Agent 1 chose aa but gets nothing, because Agent 2 did not match it.
  4. Both agents now choose aa, giving (a,a)(a, a). The rule gives each reward 1 and moves the world to s1s_1. Check: the same agents, the same state, but a different joint action gives a different next state.
  5. In s1s_1, any joint action gives both agents reward 2 and keeps the world in s1s_1. Check: each agent's reward is its own, and they happen to be equal here.
01234505101520stepsdiscounted return
  • return from s1 over x steps
Agent 1's discounted return from state s1 with reward 2 per step and discount 0.9. The curve climbs toward its limit, 20.

The math

Definition: Markov game

A Markov game for NN agents is a tuple (S,A1,…,AN,T,r1,…,rN,γ)(\mathcal{S}, \mathcal{A}_1, \ldots, \mathcal{A}_N, T, r_1, \ldots, r_N, \gamma). Here S\mathcal{S} is the set of states; Ai\mathcal{A}_i is the set of actions for agent ii; T(s′∣s,a1,…,aN)T(s' \mid s, a_1, \ldots, a_N) is the probability that the next state is s′s' given state ss and the joint action; ri(s,a1,…,aN)r_i(s, a_1, \ldots, a_N) is agent ii's reward; and γ∈[0,1)\gamma \in [0, 1) is the discount factor. Each agent ii follows a policy πi(ai∣s)\pi_i(a_i \mid s), the probability of choosing action aia_i in state ss.

Symbols in words: S\mathcal{S} is "the set of all states"; γ\gamma is the weight on future rewards, so a reward kk steps ahead counts γk\gamma^k times as much. An MDP is the case N=1N = 1.

Step 2 in symbols

The joint action is the tuple (a1,a2)=(a,b)(a_1, a_2) = (a, b). The transition rule is written with the whole tuple: T(s′∣s,a1,a2)T(s' \mid s, a_1, a_2). The next state depends on (a1,a2)(a_1, a_2) jointly, which is why no single agent's choice decides it.

Step 3 and step 4 in symbols

In state s0s_0 the rules say T(s1∣s0,a,a)=1T(s_1 \mid s_0, a, a) = 1 and r1(s0,a,a)=r2(s0,a,a)=1r_1(s_0, a, a) = r_2(s_0, a, a) = 1. For the joint action (a,b)(a, b), T(s0∣s0,a,b)=1T(s_0 \mid s_0, a, b) = 1 and both rewards are 0.

Step 5 in symbols

In s1s_1, T(s1∣s1,a1,a2)=1T(s_1 \mid s_1, a_1, a_2) = 1 for every joint action and ri(s1,⋅)=2r_i(s_1, \cdot) = 2. Agent ii's total discounted return is Ri=∑t=0∞γtrit,R_i = \sum_{t=0}^{\infty} \gamma^t r_i^t, where ritr_i^t is the reward at step tt.

A Markov game is solved by an equilibrium concept. Let π−i\pi_{-i} be the policies of all agents except ii. A profile (π1∗,…,πN∗)(\pi_1^*, \ldots, \pi_N^*) is a Nash equilibrium when, for every ii, agent ii's expected return under πi∗\pi_i^* with the others fixed is at least as large as under any other policy πi\pi_i: Viπi∗,π−i∗(s)≥Viπi,π−i∗(s)for every state s.V_i^{\pi_i^*, \pi_{-i}^*}(s) \ge V_i^{\pi_i, \pi_{-i}^*}(s) \quad \text{for every state } s. Here Viπ(s)V_i^{\pi}(s) is the expected return to agent ii starting from ss. When N=1N = 1 this is simply the MDP's optimal policy.

Worked examples

Example
1. Tiny: two agents, one step

Setup: in s0s_0, joint action (a,a)(a, a) gives rewards (1,1)(1, 1) and moves to s1s_1. Joint action (a,b)(a, b) gives rewards (0,0)(0, 0) and stays in s0s_0.

  1. Agent 1 plays aa and Agent 2 plays aa. Joint action (a,a)(a, a).
  2. The reward to Agent 1 is 1, and to Agent 2 is 1.
  3. The next state is s1s_1.
  4. Now Agent 2 switches to bb, giving (a,b)(a, b).
  5. The reward to Agent 1 is 0, and the next state is s0s_0.
  6. Interpretation: Agent 1 gets a reward only when the two choices match in s0s_0, so its payoff depends on Agent 2's choice.
Example
2. Standard: discounted value with discount 0.9

In s1s_1 both agents keep playing and get reward 2 per step, staying in s1s_1. The discount is γ=0.9\gamma = 0.9. From s0s_0, joint action (a,a)(a, a) gives reward 1 and moves to s1s_1.

  1. The value of s1s_1 satisfies V(s1)=2+0.9 V(s1)V(s_1) = 2 + 0.9\,V(s_1), because the next step is again s1s_1 with reward 2.
  2. Solve: 0.1 V(s1)=20.1\,V(s_1) = 2, so V(s1)=20V(s_1) = 20.
  3. The value of s0s_0 under (a,a)(a, a) is V(s0)=1+0.9 V(s1)V(s_0) = 1 + 0.9\,V(s_1), since the reward is 1 now and the world moves to s1s_1 next step.
  4. Substitute: V(s0)=1+0.9×20=1+18=19V(s_0) = 1 + 0.9 \times 20 = 1 + 18 = 19.
  5. Interpretation: an agent that reaches s1s_1 is worth 20 from there and 19 from the start.
Example
3. Realistic: how big the joint action space gets

A team of three robots, each with 5 possible moves, must coordinate in a warehouse whose layout has 10 states.

  1. Each robot chooses from 5 actions, so a joint action is one choice from each robot.
  2. The number of joint actions is 5×5×5=1255 \times 5 \times 5 = 125.
  3. Each state needs a transition probability for each joint action and each possible next state, so the transition table in one state has 125125 rows.
  4. With 10 states, the full table has 10×125=125010 \times 125 = 1250 rows of transition probabilities.
  5. Interpretation: the table grows fast with the number of agents, which is why learning methods often avoid writing it down and instead learn from samples.

Try it: a team of four robots, each with 5 actions, in 10 states. How many joint actions are there per state? Answer: 54=6255^4 = 625.

Common mistakes and tradeoffs

It is tempting to think another agent is just part of the environment, so each agent can use a plain MDP. In fact, the other agents change as they learn, so the environment each agent sees is not stationary, and the MDP assumption fails. This is why multi-agent methods reason about the other agents' policies.

It is tempting to think a Nash equilibrium maximizes the total reward of all agents. In fact each agent maximizes its own return given the others' policies, and the total can be high or low at equilibrium. In a competitive game, one agent's gain can be another's loss; see minimax games for the special zero-sum case.

It is tempting to think that partial observation is just noise on top of the state. In fact, the partially observable version gives each agent a private observation instead of the state, so each agent must act on what it can see. The partially observable case is covered in partially observable MDPs.

Use a Markov game when several agents act at once, their actions change a shared state, and each agent's return depends on the others. Do not use it for one agent (use an MDP) or for a single round of simultaneous choices with no state (use a normal-form game). When all agents share one reward, a single controller over joint actions can be simpler than modeling each agent separately. The main alternative is to treat other agents as part of a non-stationary environment, which is simpler to code but gives weaker guarantees.

History

Lloyd Shapley described stochastic games in 1953. His early results concerned mainly two-player zero-sum games. Michael Littman brought the framework into reinforcement learning in 1994 with the name Markov games, proposing that agents learn in such games as a model of multi-agent learning.

Multi-agent reinforcement learning grew over the next two decades, and the setting became practical as deep networks made it possible to learn policies from raw observations. The MADDPG paper (2017) gave a widely used method for training agents in these games with centralized critics and decentralized policies, and it uses the partially observable Markov game framework that Littman's 1994 setting led to.

Recap

  • An MDP has one agent; a Markov game has several, with per-agent rewards.
  • The next state depends on the joint action, so no agent controls it alone.
  • Each agent maximizes its own discounted return given the others' policies.
  • A Nash equilibrium is the solution concept: no agent gains by changing its policy alone.
  • Partial observability means agents act on private observations rather than the state.
  • The joint action space grows exponentially with the number of agents.

Read next: the MADDPG paper for a method that learns in these games, and centralized training with decentralized execution for the design it uses.

Check yourself

QuestionRecall: how does a Markov game differ from a Markov decision process?Show answer

A Markov game has several agents, each with its own reward and action, and the next state depends on all their actions together. An MDP has one agent whose transition and reward depend only on its own action and the current state.

QuestionComputation: with discount γ=0.9\gamma = 0.9, an agent receives reward 1 at steps 0, 1 and 2 and nothing after. What is its discounted return? Give a number to two decimal places.Show answer

The return is 1+0.9+0.81=2.711 + 0.9 + 0.81 = 2.71.

QuestionWhy: why is each agent's learning problem not a standard MDP problem when other agents are also learning?Show answer

The other agents change their policies as they learn, so the transition and reward each agent experiences shift over time. An MDP assumes a fixed environment, so the assumption that makes it a standard MDP fails.

QuestionApplied scenario: two delivery drones share a charging station. Their joint choices change how many batteries are free next step. Is this a Markov game, and why?Show answer

Yes. Each drone has its own action and its own reward, and the next state (battery availability) depends on both drones' choices together. Because the outcome depends on the joint action, the situation is a Markov game rather than a single-agent MDP.

Sources