Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

Cooperative Games

Motivating Example: Dividing the loot after a D&D battle

After a climactic boss fight, a party of adventurers must divide a hoard of
1,000 gold coins recovered after fighting a dragon.

The party includes:

  • Ren the fighter, who absorbed the dragon’s attacks.

  • Azel the wizard, who cast a decisive spell at the turning point.

  • Quinn the bard, who provided support and distracted the dragon
    with an improvised limerick.

Each character played a crucial role, but in very different ways. How can they
divide the treasure fairly?

Based on past encounters, the party has a sense of how much gold they might
have secured without the full team:

This is a classic example of a cooperative game, and understanding how to
allocate resources fairly in such settings is the focus of this chapter.

Theory

Definition: characteristic function game

A characteristic function game GG is given by a pair
(N,v)(N, v) where NN is the number of players and
v:2[N]Rv: 2^{[N]} \to \mathbb{R} is a characteristic function which
maps every coalition of players to a payoff.

Example: The characteristic function game of the D&D battle

For the D&D battle, we have N=3N = 3 and the
characteristic function vv is given by:

v(c)={0if c=0if c={Ren}0if c={Azel}0if c={Quinn}900if c={Ren,Azel}400if c={Ren,Quinn}600if c={Azel,Quinn}1000if c={Ren,Azel,Quinn}v(c) = \begin{cases} 0 & \text{if } c = \emptyset \\ 0 & \text{if } c = \{\text{Ren}\} \\ 0 & \text{if } c = \{\text{Azel}\} \\ 0 & \text{if } c = \{\text{Quinn}\} \\ 900 & \text{if } c = \{\text{Ren}, \text{Azel}\} \\ 400 & \text{if } c = \{\text{Ren}, \text{Quinn}\} \\ 600 & \text{if } c = \{\text{Azel}, \text{Quinn}\} \\ 1000 & \text{if } c = \{\text{Ren}, \text{Azel}, \text{Quinn}\} \end{cases}

Definition: Monotone characteristic function game


A characteristic function game G=(N,v)G = (N, v) is called monotone if it satisfies
v(C2)v(C1)v(C_2) \geq v(C_1) for all C1C2C_1 \subseteq C_2.


Example: The D&D battle is a monotone characteristic function game

The function defined in (1) is monotone.
However, the following game is not:

v(c)={0if c=0if c={Ren}0if c={Azel}0if c={Quinn}1100if c={Ren,Azel}400if c={Ren,Quinn}600if c={Azel,Quinn}1000if c={Ren,Azel,Quinn}v(c) = \begin{cases} 0 & \text{if } c = \emptyset \\ 0 & \text{if } c = \{\text{Ren}\} \\ 0 & \text{if } c = \{\text{Azel}\} \\ 0 & \text{if } c = \{\text{Quinn}\} \\ 1100 & \text{if } c = \{\text{Ren}, \text{Azel}\} \\ 400 & \text{if } c = \{\text{Ren}, \text{Quinn}\} \\ 600 & \text{if } c = \{\text{Azel}, \text{Quinn}\} \\ 1000 & \text{if } c = \{\text{Ren}, \text{Azel}, \text{Quinn}\} \end{cases}

Indeed, Ren and Azel receive more without Quinn than with them, violating monotonicity.

Definition: superadditive characteristic function game

A characteristic function game G=(N,v)G = (N, v) is called superadditive if it satisfies
v(C1C2)v(C1)+v(C2)v(C_1 \cup C_2) \geq v(C_1) + v(C_2) for all disjoint coalitions
C1C2=C_1 \cap C_2 = \emptyset.


Example: The D&D battle is not a superadditive characteristic function game

The function defined in (1) is superadditive.
However, the following game is not:

v(c)={0if c=0if c={Ren}700if c={Azel}0if c={Quinn}900if c={Ren,Azel}400if c={Ren,Quinn}600if c={Azel,Quinn}1000if c={Ren,Azel,Quinn}v(c) = \begin{cases} 0 & \text{if } c = \emptyset \\ 0 & \text{if } c = \{\text{Ren}\} \\ 700 & \text{if } c = \{\text{Azel}\} \\ 0 & \text{if } c = \{\text{Quinn}\} \\ 900 & \text{if } c = \{\text{Ren}, \text{Azel}\} \\ 400 & \text{if } c = \{\text{Ren}, \text{Quinn}\} \\ 600 & \text{if } c = \{\text{Azel}, \text{Quinn}\} \\ 1000 & \text{if } c = \{\text{Ren}, \text{Azel}, \text{Quinn}\} \end{cases}

Indeed:

v({Ren,Quinn})+v({Azel})=400+700=1100>1000=v({Ren,Azel,Quinn})v(\{\text{Ren}, \text{Quinn}\}) + v(\{\text{Azel}\}) = 400 + 700 = 1100 > 1000 = v(\{\text{Ren}, \text{Azel}, \text{Quinn}\})

so the game violates superadditivity.

Definition: Payoff vector

When we talk about a solution to a characteristic function game, we mean a
payoff vector λR0N\lambda \in \mathbb{R}_{\geq 0}^N that allocates the value of
the grand coalition among the players. In particular, λ\lambda must satisfy:

i=1Nλi=v(Ω)\sum_{i=1}^N \lambda_i = v(\Omega)

Example: A possible payoff vector:

One possible payoff vector for (1) is:

λ=(200,350,450)\lambda = (200, 350, 450)

This would seem unfair as Quinn gets 450 of the gold. To find a “fair” distribution of the grand coalition we must define what is meant by “fair”. We require four desirable properties:

Definition: Efficiency


Given a game G=(N,v)G = (N, v), a payoff vector λ\lambda is efficient if:

i=1Nλi=v(Ω)\sum_{i=1}^N \lambda_i = v(\Omega)

Example: An efficient Payoff Vector for the D&D Battle

An efficient payoff vector is one that shares all 1,000 gold coins like the one in (6).


Definition: Null Player Property


Given a game G=(N,v)G = (N, v), a payoff vector λ\lambda satisfies the null player property if, for a player ii:

If v(Ci)=v(C)v(C \cup i) = v(C) for all coalitions CΩC \subseteq \Omega, then:

λi=0\lambda_i = 0

Example: The Null Player Property in the D&D Battle

In Motivating Example: Dividing the loot after a D&D battle, Quinn contributes very little, yet still adds value to each coalition he joins. For instance, without Quinn, the grand coalition would only obtain 900 coins. If, however, a member of the party made no difference to the value of any coalition, the null player property dictates that this player should receive a payoff of 0.


Definition: Symmetry Property


Given a game G=(N,v)G = (N, v), a payoff vector λ\lambda satisfies the symmetry property if, for any pair of players i,ji, j:

If v(Ci)=v(Cj)v(C \cup i) = v(C \cup j) for all coalitions CΩ{i,j}C \subseteq \Omega \setminus \{i, j\}, then:

λi=λj\lambda_i = \lambda_j

Example: The Symmetry Property in the D&D Battle

In Motivating Example: Dividing the loot after a D&D battle, no two players contribute equally to every coalition they join. If there were such players, the symmetry property would guarantee that they each receive an equal share of the gold

Definition: Additivity Property


Given two games G1=(N,v1)G_1 = (N, v_1) and G2=(N,v2)G_2 = (N, v_2), define their sum G+=(N,v+)G^+ = (N, v^+) by:

v+(C)=v1(C)+v2(C)for all CΩv^+(C) = v_1(C) + v_2(C) \quad \text{for all } C \subseteq \Omega

A payoff vector λ\lambda satisfies the additivity property if:

λi(G+)=λi(G1)+λi(G2)\lambda_i^{(G^+)} = \lambda_i^{(G_1)} + \lambda_i^{(G_2)}

Example: The Additive Property in the D&D Battle

In Motivating Example: Dividing the loot after a D&D battle, if there were in fact two separate battles, the method for distributing the gold should
yield the same result as treating both battles as a single event with the
combined total reward.

Definition: Predecessors


Given a permutation π\pi of [N][N], the set of predecessors of player ii in π\pi is denoted by Spi(i)S_pi(i) and defined as:

Sπ(i)={j[N]π(j)<π(i)}S_\pi(i)=\{j \in [N] \mid \pi(j)<\pi(i)\}

Example: The predecessors for the D&D Battle

For Motivating Example: Dividing the loot after a D&D battle we have N=3N=3 if we assume the ordering: (Ren,Azel,Quinn)(\text{Ren}, \text{Azel}, \text{Quinn}) Table 1 gives the predecessors of each individual for each of the 3!=63!=6 permutations of [N][N].

Table 1:The predecessors of each individual for each permutation

π\piSπ(1)S_{\pi}(1) (Predecessors of Ren)Sπ(2)S_{\pi}(2) (Predecessors of Azel)Sπ(3)S_{\pi}(3) (Predecessors of Quinn)
(1,2,3)(1, 2, 3)\emptyset{1}\{1\}{1,2}\{1, 2\}
(1,3,2)(1, 3, 2)\emptyset{1,3}\{1, 3\}{1}\{1\}
(2,1,3)(2, 1, 3){2}\{2\}\emptyset{1,2}\{1, 2\}
(2,3,1)(2, 3, 1){2,3}\{2, 3\}\emptyset{2}\{2\}
(3,1,2)(3, 1, 2){3}\{3\}{1,3}\{1, 3\}\emptyset
(3,2,1)(3, 2, 1){2,3}\{2, 3\}{3}\{3\}\emptyset

Definition: Marginal Contribution


Given a permutation π\pi of [N][N], the marginal contribution of player ii with respect to π\pi is defined as:

ΔπG(i)=v(Sπ(i){i})v(Sπ(i))\Delta_\pi^G(i)=v(S_{\pi}(i)\cup \{i\})-v(S_{\pi}(i))

Example: Marginal Contributions in the D&D Battle

For Motivating Example: Dividing the loot after a D&D battle (Ren,Azel,Quinn)(\text{Ren}, \text{Azel}, \text{Quinn}), with N=3N = 3. Table 2 shows the marginal contribution ΔπG(i)\Delta_\pi^G(i) for each player ii in each permutation π\pi using (1).

Table 2:Marginal contributions of each individual for each permutation

π\piΔπG(1)\Delta_\pi^G(1) (Ren)ΔπG(2)\Delta_\pi^G(2) (Azel)ΔπG(3)\Delta_\pi^G(3) (Quinn)
(1,2,3)(1, 2, 3)0900100
(1,3,2)(1, 3, 2)0600400
(2,1,3)(2, 1, 3)9000100
(2,3,1)(2, 3, 1)4000600
(3,1,2)(3, 1, 2)4006000
(3,2,1)(3, 2, 1)4006000

We are now ready to define the Shapley value for any cooperative game G=(N,v)G=(N,v).

Definition: Shapley Value


Given a cooperative game G=(N,v)G=(N,v), the Shapley value of player ii is denoted by ϕi(G)\phi_i(G) and defined as:

ϕi(G)=1N!πΠnΔπG(i)\phi_i(G)=\frac{1}{N!}\sum_{\pi\in\Pi_n}\Delta_\pi^G(i)

Example: The Shapley Value for the D&D Battle

For Motivating Example: Dividing the loot after a D&D battle the Shapley value is the vector with entries corresponding to the average of each of the columnts of Table 2.

ϕ1=0+0+900+400+400+4006=350ϕ2=900+600+0+0+400+6006=450ϕ3=100+400+100+600+0+06=200\begin{align*} \phi_1 &= \frac{0 + 0 + 900 + 400 + 400 + 400}{6} = 350\\ \phi_2 &= \frac{900 + 600 + 0 + 0 + 400 + 600}{6} = 450\\ \phi_3 &= \frac{100 + 400 + 100 + 600 + 0 + 0}{6} = 200\\ \end{align*}

Giving: ϕ=(350,450,200)\phi=(350, 450, 200)

Exercises

Programming

The CoopGT library has functionality to verify properties of a characteristic function game and also compute the Shapley value.

Here let us define a characteristic function and check if it is valid:

import coopgt.characteristic_function_properties


characteristic_function = {
    (): 0,
    (1,): 0,
    (2,): 0,
    (3,): 0,
    (1, 2): 900,
    (1,3): 400,
    (2, 3): 600,
    (1, 2, 3): 1000,
}
coopgt.characteristic_function_properties.is_valid(characteristic_function=characteristic_function)
True

Here we can check if it is monotone:

coopgt.characteristic_function_properties.is_monotone(
    characteristic_function=characteristic_function
)
True

Here we can check if it is supperadditive:

coopgt.characteristic_function_properties.is_superadditive(
    characteristic_function=characteristic_function
)
True

Let us compute the Shapley value:

import coopgt.shapley_value

coopgt.shapley_value.calculate(characteristic_function=characteristic_function)
array([350., 450., 200.])

Notable Research

The Shapley value was first introduced by Shapley in Shapley & others, 1953, a foundational paper in cooperative game theory. Although Shapley is best known for this concept, he was awarded the Nobel Prize in Economics for his later work on matching games.

In large games, the computational cost of calculating the Shapley value can be prohibitive. While not necessarily intractable in the formal sense, as shown in Deng & Papadimitriou, 1994, the number of permutations makes exact computation impractical. One of the earliest practical approaches to this challenge is Castro et al., 2009, which proposes Monte Carlo sampling of permutations as an efficient approximation method.

One of the most impactful application areas of the Shapley value in recent years has been in model explainability. As explored in Exercise 2, the Shapley value provides a principled way to attribute a model’s output to its input features. One of the first papers to formalize this idea was Strumbelj & Kononenko, 2010. This approach has since seen wide application, particularly in healthcare, where a comprehensive overview is provided in Jin et al., 2022.

Conclusion

In this chapter, we introduced the theory of cooperative games, where groups of players can form coalitions and share the resulting value. We focused on characteristic function games, where the value of each coalition is known, and explored how to fairly distribute this value using the Shapley value.

We discussed the key axioms that characterize fairness—efficiency, null player, symmetry, and additivity and saw how they uniquely determine the Shapley value. We also explored computational aspects, applications to machine learning, and interactive programming tools to calculate Shapley values.

Table 3 gives a summary of the concepts of this chapter.

Table 3:Summary of cooperative game concepts

ConceptDescription
Characteristic functionMaps each subset (coalition) of players to a real-valued payoff
MonotonicityAdding players to a coalition cannot decrease its value
SuperadditivityThe value of two disjoint coalitions is at most the value of their union
Payoff vectorA distribution of the total value among all players
Marginal contributionThe added value a player brings to a coalition
Predecessors in permutationPlayers who appear before a given player in a permutation
Shapley valueThe average marginal contribution: a unique, fair payoff satisfying four axioms
References
  1. Shapley, L. S., & others. (1953). A value for n-person games.
  2. Deng, X., & Papadimitriou, C. H. (1994). On the complexity of cooperative solution concepts. Mathematics of Operations Research, 19(2), 257–266.
  3. Castro, J., Gómez, D., & Tejada, J. (2009). Polynomial calculation of the Shapley value based on sampling. Computers & Operations Research, 36(5), 1726–1730.
  4. Strumbelj, E., & Kononenko, I. (2010). An efficient explanation of individual classifications using game theory. The Journal of Machine Learning Research, 11, 1–18.
  5. Jin, D., Sergeeva, E., Weng, W.-H., Chauhan, G., & Szolovits, P. (2022). Explainable deep learning in healthcare: A methodological survey from an attribution view. WIREs Mechanisms of Disease, 14(3), e1548.