Keywords

1 Introduction

The theory of cooperative games with transferable utility Chakravarty et al. (2015) deals with the outcomes and benefits which players can gain by forming coalitions. A large number of different approaches to distribute the payoff of the grand coalition have been studied in the literature, with the Shapley value Shapley (1953) being the most widely known solution concept. This article focusses on the Public Good index (abbreviated PGI, also known as Holler index or as Holler–Packel index) which was formally proposed by Manfred Holler (1982) and axiomatized by Holler and Packel (1983) as a solution concept for the special class of simple games, i.e. for games in which coalitions are either winning with value 1 or losing with value 0. The PGI assumes that only minimal winning coalitions are relevant for measuring the relative power of players. Holler and Li (1995) propose a non-normalized version of the PGI measuring absolute power which they call Public Value and present as a solution concept for general cooperative games with transferable utility.

Ideological proximity or common economic interests are just two of many reasons why certain coalitions are more likely than others. Hence, transferable utility games with a partition of the player set into disjoint precoalitions (also known as a priori unions) have become an important branch of cooperative game theory, with the generalization of the Shapley value by Owen (1977) being the most widely known solution concept. As pointed out in the book by Owen (1995), pp. 303, the players in such a precoalition have agreed to keep together, but, even though they will do so in most cases, they are not forced to comply. Therefore, the influence of a player needs to be evaluated in a two-stage process. In the external stage, the power of the precoalition is determined, and in the internal stage, the results for the members of the precoalition are computed. In the terminology of cooperative game theory, this two-stage process translates into an external game (also known as the quotient game) between the precoalitions and an internal game within each precoalition. Together with various coauthors Manfred Holler proposed and investigated a total of six different variations of the PGI with precoalitions in the articles Alonso-Meijide et al. (2010b, 2010a), Holler and Nohn (2009).

This article discusses the efficient computation of the PGI as well as its six variants with precoalitions for weighted voting games, a very important subclass of simple games. Weighted voting games (also known as weighted majority games or weighted games) are an established model for decision-making and voting in committees, panels or boards. There are n players and each player i is allocated a positive weight \(w_{i}\), which, in some situations, can be interpreted as the number of votes of a voting bloc. A measure or motion gets passed if and only if a certain quota q, normally more than 50 percent of the sum of all weights, is reached or exceeded. Weighted voting games are relevant well beyond classical voting situations in politics, described  in Algaba et al. (2007); Kóczy (2021); Kurz (2016). For example, Holler and Rupp employ the PGI and weighted voting games for analysing social networks in a series of recent papers Holler and Rupp (2019, 2020, 2021) whereas the contemporary paper Staudacher et al. (2021) discusses these tools in the context of indirect control power in corporate shareholding structures. These social and economic network applications may involve large numbers of players as well as precoalitions making the need for fast methods for computing the PGI and its variants with precoalitions (expressed in the final paragraph of the paper by Alonso-Meijide et al. (2010b)) a very relevant subject of research.

Power indices for simple games are frequently computed using generating functions, see, e.g. Algaba et al. (2007); Bilbao et al. (2000); Alonso-Meijide et al. (2008), and the paper by Alonso-Meijide and Bowles Alonso-Meijide and Bowles (2005) for the case of precoalitions. If the subsets of players attain only a small number of different weight sums, this method profits Kurz (2016) and fast-access data structures for polynomials with few coefficients in computer algebra systems like Mathematica Tanenbaum (1997) can be employed. In this paper, we use the strongly related, though mathematically less sophisticated, paradigm of dynamic programming for power index computation Staudacher et al. (2021, 2022), Uno (2012). The recent article Staudacher et al. (2021) proposes a new method for computing the PGI for weighted voting games efficiently. Our goal is to extend the algorithm for the PGI to its six variants with precoalitions.

In Sect. 2, we introduce the basic concepts from cooperative game theory, including simple games, the Public Good index (PGI) and its six variants with precoalitions along the lines of Alonso-Meijide et al. (2009, 2010b); Holler and Nohn (2009); Alonso-Meijide et al. (2010a). Section 3 explains how dynamic programming is used to count coalitions efficiently for weighted voting games and discusses the state-of-the-art algorithms for computing the Public Good index from Staudacher et al. (2021) in detail. Section 4 forms the centrepiece of this paper and presents the new algorithms for the six Public Good indices with precoalitions. We point out how our algorithms reflect both the definitions of the indices as well as the different internal division procedures and present a sophisticated new approach for computing the Owen Extended Public Good Index. Section 5 discusses implementations of our new algorithms in C++ including numerical experiments and reports supportive computing times. We end with some concluding remarks and an outlook to open problems in Sect. 6.

2 Preliminaries

In this section, we briefly review some terminology for cooperative games and precoalitions along the lines of the paper by Alonso-Meijide et al. (2009) and define the Public Good index (PGI) and its variants with precoalitions following the articles Alonso-Meijide et al. (2010b, 2010a), Holler and Nohn (2009).

2.1 Cooperative Games, Simple Games and Precoalitions

Let \(N = \{1, ..., n\}\) denote a finite set of n players. A group of players \(S \subseteq N\) is called a coalition, whereas \(2^{N}\) symbolizes the set of all subsets of N. \(\emptyset \) stands for the empty coalition and N is referred to as the grand coalition. By \(\vert S \vert \) we denote the cardinality of a coalition S, i.e. the number of its members, hence \(\vert N \vert =n\). An n-person cooperative game with transferable utility can be characterized as a pair (Nv) where \(v: 2^{N} \rightarrow \mathbb {R}\) is referred to as the characteristic function assigning a real value to all coalitions \(S \in 2^{N}\), with \(v(\emptyset ) = 0\), i.e. in a cooperative game the value of the empty coalition is always zero, see, e.g. one of the books Chakravarty et al. (2015), p. 20, or Owen (1995), p. 213. A cooperative game is monotone if for all coalitions \(S,T \in 2^{N}\) the relation \(S \subseteq T\) implies \(v(S) \le v(T)\).

We call a cooperative game simple if it is monotone and there holds \(v(N)=1\) and \(v(S) = 0\) or \(v(S) = 1\) for each coalition \( S \subset N\). Coalitions for which \(v(S) = 1\) are called winning coalitions in simple games, whereas coalitions for which \(v(S) = 0\) are termed losing coalitions. A player i is a critical player (also known as a decisive player or swing player) in a winning coalition S if \(v(S \backslash \{ i \})=0\), i.e. the winning coalition S becomes a losing one if player i leaves S. We call a winning coalition S minimal winning if it contains only critical players, i.e. if every proper subset of S is a losing coalition.

Weighted voting games (also known as weighted majority games or weighted games) are probably the most important subclass of simple games. They are employed as models in a large number of practical applications Algaba et al. (2007); Kóczy (2021); Kurz (2016); Holler and Rupp (2019, 2020, 2021); Staudacher et al. (2021). An n-player weighted voting game is specified by n non-negative real weights \(w_{i}, i=1, \dots , n,\) and a non-negative real quota q, normally \(q > \frac{1}{2} \sum _{i=1}^{n} w_{i}\). Its characteristic function \(v: 2^{N} \rightarrow \{0,1\}\) takes the value \(v(S)=1\) for every winning coalition S, i.e. \(w(S)=\sum _{i \in S} w_{i} \ge q\), and \(v(S)=0\) otherwise, implying that coalition S is losing.

Let us create an external division of our set of players \(N = \{1, ..., n\}\) into precoalitions (also known as a priori unions). Let \(\mathcal {P}(N)\) denote for the set of all partitions of N, with a partition being a set of non-empty subsets of N satisfying the constraint that N is a disjoint union of these subsets. We call an element \(P \in \mathcal {P}(N)\) a coalition structure (also known as a system of unions) of the set N. A simple game with a coalition structure can be written as a triplet (NvP). Following Alonso-Meijide et al. (2009), we write our coalition structure in the form \(P= \{ P_{1}, \dots , P_{l} \}\), i.e. we have l precoalitions \(P_{1}, \dots , P_{l}\) and the set \(L= \{ 1, \dots , l \}\) serves as the index set of the partition P. For a weighted voting game with a coalition structure P, the external game (also known as the quotient game) is defined as the weighted voting game \(v^{P}\) played between the l precoalitions Alonso-Meijide et al. (2009); Malawski (2004). The external game is formally defined as the weighted voting game \([q; w(P_{1}), \dots , w(P_{l})]\), i.e. it is characterized by the (unmodified) quota q and the weights \(w(P_{1}), \dots , w(P_{l})\) of the l precoalitions, where \(w(P_{k}) = \sum _{i \in P_{k}} w_{i}\) with \(k \in L\), \(L= \{ 1, \dots , l \}\).

2.2 The Public Good Index and Its Variants with Precoalitions

A function f that receives an n-person simple game (Nv) specified by its player set N and its characteristic function v as its input, and passes a unique vector \(f(N,v) = (f_{1}(N,v), \dots , f_{n}(N,v))\) as its output is called a power index. The literature offers an array of power indices, including the Shapley–Shubik index Shapley and Shubik (1954), the Banzhaf index Banzhaf III (1964), the Johnston index Johnston (1978) and the Deegan–Packel index Deegan and Packel (1978). In this paper, we focus entirely on the Public Good Index (PGI) formally defined by Manfred Holler (1982) and refer the reader to the overview article by Bertini et al. (2013) for a deeper discussion of power indices.

Given a simple game (Nv) with n players, let M denote the set of its minimal winning coalitions and \(M_{i}\) the set of minimal winning coalitions containing player \(i \in \{ 1, \dots , n \}\). The Public Good index (PGI) \(\delta _{i}\) of player i is given as

$$\begin{aligned} \delta _{i} (N,v) = \frac{\vert M_{i} \vert }{\sum _{j=1}^{n} \vert M_{j} \vert }. \end{aligned}$$
(1)

A coalitional power index g is a function which gets an n-person simple game with a coalition structure (NvP) specified by its player set N, its characteristic function v and a partition P as its input and delivers a unique vector \(g(N,v,P) = (g_{1}(N,v,P), \dots , g_{n}(N,v,P))\) as its output.

Taking up the idea of the external game \(v^{P}\) played between the precoalitions introduced at the end of Sect. 2.1, we can measure the power of a union \(Q \in P = \{ P_{1}, \dots , P_{l} \}\) in terms of the PGI. We denote the set of minimal winning coalitions in the external game by \(M^{P}\) and by \(M_{Q}^{P}\) the set of those minimal winning coalitions in the external game containing precoalition \(Q \in P\). Following Alonso-Meijide et al. (2010a), we can write

$$\begin{aligned} \delta _{Q} (P,v^{P}) = \frac{\vert M_{Q}^{P} \vert }{\sum _{k} \vert M_{P_{k}}^{P} \vert }. \end{aligned}$$
(2)

With the definitions of the PGI on the levels of individual players (1) and precoalitions (2) in place, we can define the six variants of the PGI with precoalitions.

The Solidarity PGI Alonso-Meijide et al. (2010b) assigns power to each precoalition according to its PGI in the external game (2) in the first step. In the second step, the Solidarity PGI stresses the public good property and attributes equal power to each member of the same precoalition. We can formally define the Solidarity PGI \(\Upsilon _{i}\) of player \(i \in P(i)\), i.e. player i contained in union P(i), as follows:

$$\begin{aligned} \Upsilon _{i}(N,v,P) = \delta _{P(i)}(P,v^{P}) \frac{1}{\vert P(i) \vert }. \end{aligned}$$
(3)

The Union PGI Holler and Nohn (2009) reflects the spirit of the original PGI by assuming that the coalitional value is a public good and only minimal winning coalitions (with respect to the coalition structure P) are relevant. The power of an individual player \(i \in P(i)\), i.e. player i contained in union P(i), is thus proportional to the number of minimal winning coalitions her precoalition belongs to in the external game. We can formally define the Union PGI \(\Lambda _{i}\) of player \(i \in P(i)\), as follows:

$$\begin{aligned} \Lambda _{i}(N,v,P) = \frac{\vert M_{P(i)}^{P} \vert }{\sum _{k} \vert P_{k} \vert \vert M_{P_{k}}^{P} \vert }. \end{aligned}$$
(4)

As for the Solidarity PGI, players within the same precoalition obtain the identical Union PGI. We note that among the six extensions of the PGI for precoalitions, the Union PGI is the only solution concept that does not attribute power to precoalitions based on the PGI in the external game (2).

Holler and Nohn (2009) propose three different approaches for reflecting an individual player’s threat power to leave the union. In all three cases, the total power attributed to a precoalition Q is given by its external PGI (2). That power is then distributed internally among individual members of unions in threat games.

For the Threat PGI 1 (TPGI 1) Holler and Nohn (2009), only a minimal degree of stability of the precoalition structure P is assumed. As soon as a single player i leaves her coalition P(i), then not only that union P(i), but the complete precoalition structure P breaks apart. In terms of intra-union allocation of power, this model implies that subsets of a union are not only able to cooperate with other precoalitions, but also with subsets of these precoalitions. Hence, we define the Threat PGI 1 \(T^{1}_{i}\) of player \(i \in P(i)\) as follows:

$$\begin{aligned} T_{i}^{1}(N,v,P) = \delta _{P(i)}(P,v^{P}) \frac{\delta _{i}(N,v)}{\sum _{j \in P(i)} \delta _{j}(N,v)}, \end{aligned}$$
(5)

whenever \(\sum _{j \in P(i)} \delta _{j}(N,v) > 0\) and \(T_{i}^{1}(N,v,P) = 0\) otherwise.

The Threat PGI 2 (TPGI 2) Holler and Nohn (2009) assumes a greater degree of stability of the precoalition structure P. As soon as a single player i leaves her coalition P(i), then only that union P(i) breaks apart into singletons, but the rest of the precoalition structure remains intact. In terms of intra-union allocation of power, this model implies that subsets of a union are only allowed to cooperate with other precoalitions, but not with subsets of these precoalitions. Following Holler and Nohn (2009), for union \(Q \in P\), let \(P / Q = P \backslash \{ Q \} \cup \{ \{ i \} \} \vert i \in Q \}\) stand for the precoalition structure after Q breaks up into singletons \(\{ i \}\), \(i \in Q\). We define the Threat PGI 2 \(T^{2}_{i}\) of player \(i \in P(i)\) as follows:

$$\begin{aligned} T_{i}^{2}(N,v,P) = \delta _{P(i)}(P,v^{P}) \frac{\delta _{i}(P / P(i),v^{P / P(i)})}{\sum _{j \in P(i)} \delta _{j}(P / P(i),v^{P / P(i)})}, \end{aligned}$$
(6)

whenever \(\sum _{j \in P(i)} \delta _{j}(P / P(i),v^{P / P(i)}) > 0\) and \(T_{i}^{2}(N,v,P) = 0\) otherwise.

The Threat PGI 3 (TPGI 3) Holler and Nohn (2009) assumes a maximal degree of stability of the precoalition structure P. In case a single player i leaves her coalition P(i), then the rest of that union P(i) remains intact as do all the other precoalitions. Following Holler and Nohn (2009), let \(P / i = P \backslash \{ P(i) \} \cup \{ \{ i \} , P(i) \backslash \{ \{ i \} \} \) stand for the precoalition structure after player i breaks away from her union P(i) and plays on her own. We define the Threat PGI 3 \(T^{3}_{i}\) of player \(i \in P(i)\) as follows:

$$\begin{aligned} T_{i}^{3}(N,v,P) = \delta _{P(i)}(P,v^{P}) \frac{\delta _{i}(P / i,v^{P / i})}{\sum _{j \in P(i)} \delta _{j}(P / j,v^{P /j})}, \end{aligned}$$
(7)

whenever \(\sum _{j \in P(i)} \delta _{j}(P / j,v^{P / j}) > 0\) and \(T_{i}^{3}(N,v,P) = \frac{\delta _{P(i)}(P,v^{P})}{\vert P(i) \vert } \) otherwise.

The Owen Extended PGI Alonso-Meijide et al. (2010a, b), Holler and Nohn (2009), distributes power within precoalitions according to the possibilities which the subsets of this precoalitions possess to form winning coalitions with other precoalitions. We call a subset \(S \subseteq Q\) of a precoalition Q an essential part with respect to a minimal winning coalition \(R \in M^{P}_{Q}\) (on the external level) if \(S \cup \bigcup _{Q'\in R \backslash \{ Q \}} Q' \) is a winning coalition in (Nv) and \(T \cup \bigcup _{Q'\in R \backslash \{ Q \}} Q' \) is a losing coalition for all true subsets \(T \subset S\). We denote the set of essential parts with respect to a minimal winning coalition \(R \in M^{P}\) (on the external level) containing player i by \(E_{i}^{R}(N,v,P)\). The Owen Extended PGI \(\Gamma _{i}\) of player \(i \in P(i)\) is defined as follows:

$$\begin{aligned} \Gamma _{i}(N,v,P) = \delta _{P(i)}(P,v^{P}) \sum _{R \in M^{P}_{P(i)}} \frac{1}{\vert M^{P}_{P(i)} \vert } \frac{\vert E_{i}^{R}(N,v,P) \vert }{\sum _{j \in P(i)} \vert E_{j}^{R}(N,v,P) \vert }. \end{aligned}$$
(8)

We note that the definition (8) coincides with the “counting PGI” from the work by Malawski (2004) and stress that the Owen Extended PGI manages to be as close as possible in spirit to the extension of the Shapley value to games with a coalition structure proposed by Owen (1977). For the coalition structures \(P^{n} = \{ \{ 1 \}, \{ 2\} ,\dots , \{ n \} \}\) and \(P^{N} = \{ N \}\), the Owen Extended PGI reduces to the PGI in both cases (just as the Owen value Owen (1977) reduces to the Shapley value in both cases).

3 Dynamic Programming for Computing the Public Good Index

In this section, we introduce the technique of dynamic programming for counting coalitions in weighted voting games efficiently and present the state-of-the-art algorithms for computing the PGI for weighted voting games from the paper Staudacher et al. (2021). Given that Staudacher et al. (2021) is partly a survey paper, the discussion of the PGI in Staudacher et al. (2021) is rather brief and thus the new algorithm merits a more detailed presentation in this section of our article. In other words, we are not computing any PGIs with precoalitions in this section, but prepare the groundwork for doing so in Sect. 4.

3.1 Counting Winning and Losing Coalitions via Dynamic Programming

Every weighted voting game allows for an integer representation Kurz (2016). Therefore, we assume that the weights \(w_{i}\) of the n players in our weighted voting game as well as the quota q are positive integers for the rest of the article. We set \(\tilde{w} = w(N) = \sum _{i=1}^{n} w_{i}\) and assume \(q \le \tilde{w}\). We stress that the algorithms presented in this and the next section are valid for any integer quota with \(1 \le q \le \tilde{w}\).

Dynamic programming is an algorithmic paradigm based on two pillars. We aim to solve a problem algorithmically by dividing it into subproblems and storing intermediate results efficiently. We employ this paradigm to find out how many subsets \(S \subseteq \{1, 2, \dots , n \}\) there are with weight x, i.e. \(w(S) = \sum _{i \in S} w_{i} = x\), for \(x \in \{0, 1, \dots , \tilde{w} \}\).

Theorem 1

(see Chakravarty et al. (2015), p. 229). Let T(ix) be the number of possibilities to write the integer x as a sum of the first i weights \(w_{1}, \dots , w_{i}\). For all \(i \in \{0, \dots , n\}\) and all \(x \in \{0, 1, \dots , \tilde{w} \}\), the following recursion delivers T(ix):

$$\begin{aligned} \begin{aligned} T(i,0)&= 1&\quad \text {for} \quad 0 \le i \le n \\ T(0,x)&= 0&\quad \text {for} \quad x > 0 \\ T(i,x)&= T(i-1, x) + T(i-1, x-w_{i})&\quad \text {otherwise}. \end{aligned} \end{aligned}$$

Note that the above equations can be interpreted as a boundary condition stating that we can obtain the sum 0 in exactly one way, i.e. via the empty set, as another boundary condition stating that we cannot obtain any sum \(x>0\) without any term and an actual recursion mirroring that the first i weights can deliver a sum \(x>0\) either with or without player i. In practice, T is normally not stored as a two-dimensional table, but efficiently as a vector updated from \(T(i-1,x)\) to T(ix). In our discussion of memory space requirements, we follow the convention by Uno (2012) throughout our paper and omit the need to store the n weights and the corresponding n values of the power indices. This facilitates a clearer and more concise presentation. According to this convention, Theorem 1 enables us to compute the vector T(nx) for \(x \in \{0, 1, \dots , \tilde{w} \}\) in \(O(n \tilde{w})\) time and \(O(\tilde{w})\) memory space. We finally note that it is as simple to update from \(T(i-1,x)\) to T(ix) in Theorem 1 as it is to “downdate” the vector \(T(i+1,x)\) to T(ix) via

$$\begin{aligned} T(i, x) = T(i+1,x) - T(i, x-w_{i}). \end{aligned}$$
(9)

3.2 Computing the Public Good Index via Dynamic Programming

The recent article Staudacher et al. (2021) proposes a new algorithm with a favourable pseudopolynomial complexity for computing the PGI of weighted voting games. We present this algorithm in more detail. In this subsection, we assume the positive integer weights of our n players to be in a descending order, i.e. \(w_{1} \ge \dots \ge w_{n}\).

As pointed out in the textbook Chakravarty et al. (2015), p. 235, it is relatively simple to find the total number \(\vert M \vert \) of minimal winning coalitions in a weighted voting game via dynamic programming in O(qn) time. We observe

$$\begin{aligned} \vert M \vert = \sum _{i=1}^{n} \sum _{x=q-w_{i}}^{q-1} T(i-1,x) \end{aligned}$$

and note that \(\sum _{x=q-w_{i}}^{q-1} T(i-1,x)\) counts the number of minimal winning coalitions with player i being the player with largest index in the minimal winning coalition.

The recent paper Staudacher et al. (2021) shows that not only \(\vert M \vert \), but also the cardinalities \(\vert M_{i} \vert \) of the sets of minimal winning coalitions containing player i can be found in O(qn) time and O(q) memory space for all players. Following Staudacher et al. (2021), we define the operator d(S) removing the player with largest index from a coalition S. Further, let \(w(S) = \sum _{i \in S} w_{i}\) stand for the weight of coalition S and

$$\begin{aligned} B(i,x) = \vert \{ S \in 2^{N} \vert S \subseteq \{i, \dots , n\}, i \in S, w(d(S)) < x \le w(S) \} \vert \end{aligned}$$
(10)

for all players \(i \in \{ 1, \dots , n \}\) and all weights \(1 \le x \le q\). B(ix) is the number of coalitions S with i as the player with smallest index such that any coalition S has weight greater or equal x whereas S without its player with largest index has weight less than x. We observe \(\vert M_{1} \vert = B(1,q)\). Apart from that observation, Eq. (10) may seem awkward at first, but it helps count \(\vert M_{i} \vert \) efficiently without any need to know the player with largest index in any minimal winning coalition contained in \(M_{i}\). We can obtain B by looping for i from n to 1, as follows.

Theorem 2

(see Staudacher et al. (2021)) For all \(1 \le i \le n\) and all weights \(1 \le x \le q\) there holds

$$\begin{aligned} B(i,x) = \left\{ \begin{array} {cr} 1 &{} \quad \text { for } 1 \le x \le w_{i} \\ B(i+1,x-w_{i}) + B(i+1, x-w_{i}+w_{i+1}) &{} \quad \text { for } x > w_{i}, i < n \\ 0 &{} \quad \text { otherwise.} \end{array} \right. \end{aligned}$$

Proof

By definition of B(ix) from (10), there holds \(B(i,x)=1\) for \(1 \le x \le w_{i}\) as we count the singleton coalition consisting of player i. Furthermore, the statement holds true for \(i=n\). In all other cases, i.e. for \(x>w_{i}\) and \(i<n\), the recursion means that either player \(i+1\) is part of a coalition counted in B(ix) (first term) or player \(i+1\) is not part of a coalition counted in B(ix) (second term).

$$\begin{aligned} \begin{aligned} B(i,x)&= \vert \{ S \in 2^{N} \vert S \subseteq \{i+1, \dots , n\}, (i+1) \in S, w(d(S))< x-w_{i} \le w(S) \} \vert \\ +&\vert \{ S \in 2^{N} \vert S \subseteq \{i+1, \dots , n\}, (i+1) \notin S, w(d(S))< x-w_{i} \le w(S) \} \vert \\ =&\vert \{ S \in 2^{N} \vert S \subseteq \{i+1, \dots , n\}, (i+1) \in S, w(d(S))< x-w_{i} \le w(S) \} \vert \\ +&\vert \{ S \in 2^{N} \vert S \subseteq \{i+1, \dots , n\}, (i+1) \in S, w(d(S)) < x-w_{i}+w_{i+1} \le w(S) \} \vert \\&= B(i+1,x-w_{i}) + B(i+1, x-w_{i}+w_{i+1}). \end{aligned} \end{aligned}$$

Theorem 3

(see Staudacher et al. (2021)) Let v be an n-player weighted voting game with positive integer weights sorted in a descending order. With the help of the quantities T(ix) from Theorem 1 and B(ix) from Theorem 2, the Public Good index can be computed in O(qn) time and O(q) memory space for all players as there holds

$$\begin{aligned}\vert M_{i} \vert = \sum _{x=0}^{q-1} T(i-1,x) \cdot B(i,q-x). \end{aligned}$$

Proof

The statement is true for \(i=1\) as \(\vert M_{1} \vert = T(0,0) \cdot B(1,q) = 1 \cdot B(1,q) = B(1,q)\). For \(i \ge 2\) we find

$$\begin{aligned} \begin{aligned} \vert M_{i} \vert&= \vert \{ S \in 2^{N} \vert i \in S, w(d(S))< q \le w(S) \} \vert \\ =&\vert \{ S \in 2^{N} \vert S=S_{1} \cup S_{2}, S_{1} \subseteq \{1, \dots , i-1 \} , S_{2} \subseteq \{i, \dots , n\}, i \in S_{2}, \\&w(d(S_{2}))< q - w(S_{1}) \le w(S_{2}) \} \vert \\ =&\sum _{x=0}^{q-1} \vert \{ S_{1} \subseteq \{1, \dots , i-1 \} \vert w(S_{1})=x \} \vert \cdot \\&\quad \quad \vert \{ S_{2} \subseteq \{i, \dots , n\} \vert w(d(S_{2})) < q - x \le w(S_{2}) \} \vert \\ =&\sum _{x=0}^{q-1} T(i-1,x) \cdot B(i,q-x). \end{aligned} \end{aligned}$$

Since Staudacher et al. (2021) does not list any algorithms, we conclude this section with Algorithm 1 for computing the PGI for a weighted voting game specified by its number of players n, its quota q and its vector w of n weights in O(qn) time and O(q) space.

figure a

4 Computing Public Good Indices with Precoalitions via Dynamic Programming

This section forms the centrepiece of the article. It discusses new dynamic programming algorithms for the six Public Good indices introduced in Sect. 2.2. Thereby, we complement the recent work Staudacher et al. (2022). While Staudacher et al. (2022) generalizes the state-of-the-art algorithms for computing the Banzhaf index Banzhaf III (1964) and the Shapley–Shubik index Shapley and Shubik (1954); Shapley (1953) from the papers by Uno (2012) and Kurz (2016) to the Banzhaf-Owen (1981), Owen (1977) and Symmetric Coalitional Banzhaf Alonso-Meijide and Fiestras-Janeiro (2002) indices via two-level procedures, we hereby extend our algorithm for the PGI from the previous section to its six variants with precoalitions.

As we stated in Sect. 2.1, we assume that there are l precoalitions \(P_{1}, \dots , P_{l}\). The external game (also known as the quotient game) is defined as the weighted voting game played between the precoalitions Alonso-Meijide et al. (2009); Malawski (2004), i.e. a weighted voting game represented by the (unmodified) quota q and the m weights \(w(P_{1}), \dots , w(P_{l})\) where \(w(P_{k}) = \sum _{i \in P_{k}} w_{i}\) with \(k \in L\), \(L= \{ 1, \dots , l \}\). Furthermore, we define p as the maximal size of a precoalition, i.e. \(p= \max _{k \in L} \vert P_{k} \vert \), and r as the maximal weight of a precoalition.

In the following, we point out how the ideas and algorithms from the previous section translate into external and internal weighted voting games and algorithms for the six Public Good indices with precoalitions from Sect. 2.2 possessing fairly attractive pseudopolynomial computing times and storage requirements.

Theorem 4

For a weighted voting game with positive integer weights and a precoalition structure \(P = \{ P_{1}, \dots , P_{l} \}\), both the Solidarity Public Good and Union Public Good indices can be computed in O(lq) time and O(q) space for all players.

Proof

The proof is trivial. As we can see from the definitions of the Solidarity PGI (3) and the Union PGI (4), the only computational challenge is to find \(\vert M_{Q}^{P} \vert \) for all precoalitions \(Q \in P\) on the external level using Algorithm 1. For l unions, this can be achieved in O(lq) computing time and O(q) space.    \(\square \)

Next, we devote one theorem to the three Threat PGIs from Sect. 2.2 each.

Theorem 5

For a weighted voting game with positive integer weights and a precoalition structure \(P = \{ P_{1}, \dots , P_{l} \}\) the Threat Public Good indices \(T^{1}\) can be computed in \(O((l+n)q)\) time and O(q) space for all players.

Proof

The definition of the TGPI 1 indices (5) reveals the claim. We need two computations of PGIs using Algorithm 1, one on the level of the l precoalitions, another on the level of the n individual players. This can be achieved in \(O((l+n)q)\) computing time and O(q) space.    \(\square \)

For the TPGI 2 indices (6), more PGI computations are needed.

Theorem 6

For a weighted voting game with positive integer weights and a precoalition structure \(P = \{ P_{1}, \dots , P_{l} \}\), the Threat Public Good indices \(T^{2}\) can be computed in \(O(l(l+p)q)\) time and O(q) space for all players.

Proof

The definition of the TGPI 2 indices (6) reveals that we need \(l+1\) computations of PGIs using Algorithm 1, one on the level of the l precoalitions and another l simulating the break-up of each precoalition into singletons. The number of entities in a PGI computation is bounded by \(l+p-1\) with p being the maximal size of a precoalition. According to the conventions of the O-notation, we may state that the computation can be performed in \(O(l(l+p)q)\) time and O(q) memory space.    \(\square \)

Computing the TPGI 3 indices (7) means more effort as players break away as singletons leading to one internal game per player.

Theorem 7

For a weighted voting game with positive integer weights and a precoalition structure \(P = \{ P_{1}, \dots , P_{l} \}\), the Threat Public Good indices \(T^{3}\) can be computed in O(nlq) time and O(q) space for all players.

Proof

The definition of the TGPI 3 indices (7) reveals that we need \(n+1\) computations of PGIs using Algorithm 1, one on the level of the l precoalitions and another n internal PGIs when each player breaks away individually. The number of entities in a PGI computation in any internal threat game is \(l+1\). According to the conventions of the O-notation, we may state that the computation can be performed in O(nlq) time and O(q) memory space.    \(\square \)

Computing the Owen Extended PGI for weighted voting games is more complicated than for the other five PGI variants with precoalitions. From its definition (8), we know that in the internal games we need to work out how many times player \(i \in P(i)\) is part of a minimal winning coalition S formed together with other players from P(i) and other precoalitions from the set \(P \backslash P(i)\). We formulate a theorem with worst-case estimates for computing the Owen Extended PGI. Its proof describes our algorithm.

Theorem 8

For a weighted voting game with positive integer weights and a precoalition structure \(P = \{ P_{1}, \dots , P_{l} \}\), the Owen Extended Public Good indices \(\Gamma \) can be computed in \(O(l(l+p)q+lpr^{2})\) time and \(O(q+pr)\) space for all players.

Proof

We assume the weights of the l precoalitions to be in a descending order, i.e. \(w(P_{1}) \ge \dots \ge w(P_{l})\). The case \(r=w(P_{1}) \ge q\) is fairly simple. There are \(\tilde{l} \le l\) precoalitions with \(w(P_{k}) \ge q\) for all \(k = 1, \dots , \tilde{l}\). We obtain the Owen Extended Public Good indices \(\Gamma _{i}\) for all players i contained in precoalition \(P_{j}\) for \(j=1, \dots , l\) by first computing the PGIs for the internal games with the weights \(w^{int} = (w_{1}, \dots , w_{\vert P_{j} \vert })\) and quota q and then dividing the results by \(\tilde{l}\).

For \(r=w(P_{1}) < q\), it is more challenging to compute \(\Gamma _{i}\) for all players i contained in precoalition \(P_{j}\) for \(j=1, \dots , l\). Equation (8) tells us to find the relative frequencies with which player \(i \in P_{j}\) is contained in an essential part of a minimal winning coalition \(R \in M^{P}_{P_{j}}\) on external level. We initialize a vector f with \(f(i)=0\) for \(i=1, \dots , \vert P_{j} \vert \) for summing these relative frequencies. By \(w^{int} = (w_{1}, \dots , w_{\vert P_{j} \vert })\) we denote the vector of the individual weights of the members of union \(P_{j}\) and by \(w(P_{j}) = \sum _{i=1}^{\vert P_{j} \vert } w^{int}_{i}\) its sum. Since \(w(\bigcup _{Q'\in R \backslash \{ P_{j} \}} Q') < q\), we start with a preprocessing step and use Algorithm 1 to compute

$$\begin{aligned} h(i,x) = PGI(\vert P_{j} \vert , x, w^{int}) \end{aligned}$$
(11)

for all \(1 \le i \le \vert P_{j} \vert \) and all \(1 \le x \le w(P_{j})\). We first look at minimal winning coalitions \(R \in M^{P}_{P_{j}}\) on external level such that unions \(P_{j+1}, \dots , P_{l}\) are not contained in R. Let \(T^{ext}(j-1,x)\) for \(0 \le x \le q-1\) be the vector obtained from Theorem 1 for the weights of the first \(j-1\) unions, i.e. from \(w(P_{1}), \dots , w(P_{j-1})\). We update

$$\begin{aligned} f(i) = f(i) + \sum _{x=q-w(P_{j})}^{q-1} T^{ext}(i-1,x) \cdot h(i,q-x) \end{aligned}$$
(12)

for all \(1 \le i \le \vert P_{j} \vert \). Next, we loop for k from \(j+1\) to \(l-1\) and deal with minimal winning coalitions \(R \in M^{P}_{P_{j}}\) on external level such that unions \(P_{k+1}, \dots , P_{l}\) are not contained in R. We update the vector \(T^{ext}(j-1,x)\) for \(0 \le x \le q-1\) successively while omitting the weight \(w(P_{j})\) of precoalition j, i.e. we compute \(T^{ext}_{-j}(k-1,x)\) for \(0 \le x \le q-1\) using Theorem 1 with the weights \(w(P_{1}), \dots , w(P_{j-1}), w(P_{j+1}), \dots , w(P_{k-1})\). We update

$$\begin{aligned} f(i) = f(i) + \sum _{x=q-w(P_{j})-w(P_{k})}^{q-w(P_{j})-1} T^{ext}_{-j}(k-1,x) \cdot h(i,q-w(P_{k})-x) \end{aligned}$$
(13)

for all \(1 \le i \le \vert P_{j} \vert \). Finally, with \(\delta _{P_{j}}(P,v^{P})\) from (2) and \(\vert M^{P}_{P_{j}} \vert \) we find

$$\begin{aligned} \Gamma _{i}(N,v,P) = \delta _{P_{j}}(P,v^{P}) \frac{f(i)}{\vert M^{P}_{P_{j}} \vert }. \end{aligned}$$

Computing the values h(ix) in (11) for all \(1 \le i \le \vert P_{j} \vert \) and all \(1 \le x \le w(P_{j})\) can be done in at most \(O(pr^{2})\) time and O(pr) memory space as there are at most \(p \ge \vert P_{j} \vert \) members of a precoalition and as the weight of a precoalition is at most \(r \ge w(P_{j})\). For all l precoalitions, the preprocessing step (11) costs at most \(O(lpr^{2})\) time and O(pr) memory space. The vector \(T^{ext}\) needs additional O(q) memory space justifying the estimate \(O(q+pr)\) for storage. As for computing time, we also need to consider the outer loop for \(j=1, \dots , l\) over all precoalitions as well as the inner loops for \(k=j+1, \dots , l\) for updating the vector f in (12) and (13). This can be done in \(O(l(l+p)q)\) time justifying our total estimate \(O(l(l+p)q+lpr^{2})\).    \(\square \)

There is one major difference between Algorithm 1 for computing the PGI and our new algorithm for the Owen Extended PGI from Theorem 8. In Algorithm 1 for the PGI, we do not need to know the concrete indices of the players with largest index in a minimal winning coalition (assuming that weights are in a descending order). However, our algorithm for the Owen Extended PGI from Theorem 8 not only assumes that precoalitions are in a descending order by their weights, but it also needs the information on the precoalition with largest index in a minimal winning coalition on the external level. The latter requires an additional loop over precoalitions.

5 Numerical Results and Software

In the recent articles Staudacher et al. (2021, 2022), a powerful software package named EPIC (Efficient Power Index Computation) providing efficient C++ implementations of various power indices (both with and without precoalitions) for weighted voting games was introduced. EPIC is freely available via https://github.com/jhstaudacher/EPIC/. We integrated our new algorithms for the six PGI variants with precoalitions in EPIC. For further details on the internal workings of EPIC, readers are referred to Staudacher et al. (2021, 2022).

For testing our new algorithms, we created a number of games, publicly available at https://github.com/jhstaudacher/EPIC/tree/master/test_cases/precoalitions.

Tables 1 and 2 list computing times of the PGI without precoalitions (PGI), the Solidarity PGI (SPGI), the Union PGI (UPGI), the three Threat PGIs (TPGI1, TPGI2, TPGI3), and the Owen Extended PGI (OPGI) for some of these example problems. The numerical results in Tables 1 and 2 were obtained under Ubuntu 20.04 focal (64 bit) on an Intel Core(tm) i7-6600U CPU with a clock speed of 2.60 GHz and 16 GB RAM, i.e. on a standard laptop PC.

Table 1 Computing times for three test problems with quotas equal to 50 % plus 1 vote

In Table 1, we compare three different problems with quotas equal to 50 % plus 1 vote in each case. As reported in Staudacher et al. (2021), the new algorithm for the PGI is very fast, handling problems with more than 3000 players and large quotas in less than two minutes. Not surprisingly, the computing times of the SPGI and the UPGI coincide and are very small since sophisticated computations are performed only on precoalition level. Computing times for TPGI1 are only a little larger than for the PGI confirming our claims from Theorem 5. Comparing computing times for TPGI2, more than three times as many precoalitions (and more players) in problem 3 outweigh the fact that the quota in problem 2 is more than twice the quota in problem 3. As predicted by Theorem 7, the computing times for TPGI3 are much larger than for TPGI2 mirroring the internal games for each individual player. Our new algorithm for OPGI proves to be applicable for large problems and outperforms TPGI3 for test problems 2 and 3. Comparing the computing times of OPGI and TPGI2 for problems 1, 2 and 3 underlines the influence of the preprocessing steps (11) and the maximal weight of a precoalition on our algorithm from Theorem 8.

In Table 2, we study the effects of the quota for another test problem. For PGI, SPGI, UPGI, TPGI1, TPGI2 and TPGI3, these effects on computing times are as predicted by Theorems 3, 4, 5, 6 and 7. For OPGI, the quota has hardly any impact on computing times underlining the fact that the preprocessing steps in (11) are by far the most time-consuming part of the algorithm.

Table 2 Computing times for a test problems with 1031 players, \(\tilde{w} = 22031\), 60 precoalitions, max. coal. size 52, avg. coal. size 18 and max. prec. weight 1493 for three different quotas

6 Outlook and Conclusions

This article proposes new dynamic programming algorithms for six variants of the PGI with precoalitions Alonso-Meijide et al. (2010b); Holler and Nohn (2009); Alonso-Meijide et al. (2010a) for weighted voting games. All the new algorithms employ an algorithm for computing the PGI efficiently which was recently proposed in Staudacher et al. (2021) and supersedes the previous state-of-the-art approach from Matsui and Matsui (2000). Even though further algorithmic improvements for both the Threat Public Good indices 2 and 3 and the Owen Extended PGI (OPGI) might be possible, we emphasize that our current C++ implementations can be applied for large numbers of players. With the software EPIC Staudacher et al. (2021, 2022) for weighted voting games (with and without precoalitions) and the R package CoopGame Staudacher and Anwander (2021) providing a prototypical implementation of the Public Value by Holler and Li (1995) for cooperative games with transferable utility, there is now publicly available software for many solution concepts proposed by Manfred Holler.

Still, open questions in the context of power index computation abound. Overcoming the limitations of weighted voting games and solving other classes of simple games efficiently is one of them. Wilms (2020) presents dynamic programming algorithms for computing Banzhaf and Shapley–Shubik indices for conjunctions and disjunctions of weighted voting games. It appears rewarding to expand these ideas to other power indices, including the PGI and power indices with precoalitions. Wilms (2020) compares his algorithms with quasi-ordered binary decision diagrams (QOBDDs) Bolus (2011, 2012), i.e. a recent technique based on relational algebra, which has not yet been extended to power indices with precoalitions. These binary decision diagrams provide representations of weighted voting games which come with computational costs for their generation, but are independent of the integer weights and quota. Hence, Wilms (2020) speaks of a minimum quota effect meaning that when using QOBDDs the same bounds for the quota and the sum of all weights can be used as for a minimum sum representation Freixas and Molinero (2009) of the weighted voting game. As we confirmed in Sect. 5, our new algorithms benefit from small integer weights and quotas. In all cases except for OPGI, a smaller quota implies lower storage requirements.

As stated in our introduction, dynamic programming and generating functions Algaba et al. (2007); Bilbao et al. (2000); Alonso-Meijide et al. (2008); Alonso-Meijide and Bowles (2005) are strongly related. The publicly available doctoral dissertation by Lindner (2004) points out in detail how we can use the recursion from Theorem 1 to find the coefficients of a corresponding generating function and elaborates relations between generating functions and recursions used in dynamic programming algorithms for the Banzhaf and Shapley–Shubik indices. While clearly beyond the scope of this article, studying the mathematical relations between dynamic programming and generating functions for power index computation, including the PGI and its variants with precoalitions, appears to be a very promising field of future research. It bears the potential to lead to even faster algorithms. Furthermore, it could be interesting to study whether a recent result by Koiliaris and Xu (2019) can be used to make the dynamic programming algorithms from Staudacher et al. (2021, 2022) even faster.

Another promising task could be the parallel computation of power indices. Our new algorithms for PGIs with precoalitions presented in the proofs of Theorems 6, 7 and 8 appear to be suitable for parallel processing, given that one can compute internal games independently. We also note that dynamic programming algorithms for the Deegan–Packel index with precoalitions Alonso-Meijide et al. (2011) and the Johnston index with precoalitions Mercik and Ramsey (2017) for weighted voting games have yet to be developed. In terms of practical applications, the author hopes that the new algorithms proposed in this work will prove useful for extending existing studies of social and economic networks Holler and Rupp (2019, 2020, 2021); Staudacher et al. (2021) to precoalitions among the player set and large numbers of players.