1 Introduction

In decision-making systems, the power index of each voter can be interpreted as a measure of his influence on the outcome of the decision. To model such situations, simple games, and more specifically weighted majority games, are usually considered, where each voter is a player. Such games are characterized by an existing quota that imposes a majority in the decision and a collection of individual weights for the players. Thus, a set of players is said to be a winner if the sum of their individual weights is greater than or equal to the quota. In these settings, several power indices have been proposed in the literature, such as the Shapley–Shubik index (Shapley & Shubik, 1954), the Banzhaf index (Banzhaf, 1965), the Deegan–Packel index (Deegan & Packel, 1978), the Johnston index (Johnston, 1978), the Public Good index (Holler, 1982) and the Colomer–Martínez measure (Colomer & Martínez, 1995), defined specifically for weighted majority games.

The exact determination of power measures on the class of weighted majority games is, in general, a challenging computational task. A widely used tool to facilitate this computation are the generating functions, which are in fact based on counting algorithms (Wilf, 1994). In practice, generating functions can be used, for instance, in optimal allocation problems (Levitin, 2003), in umbral calculus (Dattoli & Srivastava, 2008), or in obtaining power indices in voting situations (Bolus, 2011). Following an idea of David G. Cantor, Mann and Shapley (1962) firstly used generating functions to compute the Shapley–Shubik index for any weighted majority game. Brams and Affuso (1976) also considered this tool to compute the Banzhaf index. There are other contributions in Lucas (1983), that explored various indices as measures of power from this perspective. Bilbao et al. (2000) studied the computational complexity of procedures based on generating functions for calculating the Shapley–Shubik and the Banzhaf indices. After, Alonso-Meijide and Bowles (2005) and Algaba et al. (2007) obtained the Banzhaf index using generating functions and Alonso-Meijide et al. (2012) used them to compute the Deegan–Packel and the Public Good indices. Chessa (2014) analysed the efficient computation of the Public Good index by means of generating functions. The use of such methods has also been extended to other families of weighted majority games. For example, Algaba et al. (2003) proposed a procedure for their obtaining in the case of weighted multiple majority games, and Alonso-Meijide et al. (2009) computed them under the presence of a priori unions structures. Rodríguez-Veiga et al. (2016) used generating functions to compute the Banzhaf-Coleman and the Owen indices for weighted majority games under the presence of a coalition configuration, and Neto and Fonseca (2019) used them in such a setting with incompatible players.

The aim of this paper is threefold. First, from a purely computational point of view, specific procedures based on generating functions are presented for the exact computation of the Johnston index and the Colomer–Martínez measure. Up to the authors’ knowledge, this is a novel approach to compute both power measures in a reasonable computational time, even for weighted majority games involving a large enough number of players. Second, a new power measure is constructed by taking into account the principles that justify the Johnston index and Colomer–Martínez measure. Again, a specific procedure for its exact determination based on generating functions is provided. Third, we introduce the R package powerindexR and describe its functionalities, which has been specifically designed for the exact computation of these and other power measures taken from the literature. Finally, we illustrate its usage on a real example taken from the Spanish Parliament.

The paper is structured as follows. Section 2 presents some basic definitions of weighted majority games. Section 3 describes a new procedure based on generating functions to compute the Johnston power index. Section 4 analogously considers the computation of the Colomer–Martínez measure by means of generating functions. Section 5 introduces a new approach of power measure, that combines the principles of the Johnston index and the Colomer–Martínez measure as well as a specific procedure for its computation also based on generating functions. Section 6 analyses the computational complexity of the proposed methods. Section 7 describes the R package powerindexR and includes the analysis of power’s evolution of the political parties into the Spanish parliament during the period from 2015 to 2019. Section 8 contains some concluding remarks.

2 Preliminaries

A simple game is a pair (NW), where N represents the set of players and W is a family of coalitions of N satisfying that \(\emptyset \notin W\), \(N \in W\), and for each pair of coalitions ST of N such that \(S \subseteq T \subseteq N\), that \(S \in W\) implies \(T \in W\). We refer to W as the set of winning coalitions of N. We denote by n the cardinality of N.

Let \(S \in W\) be a winning coalition. If there is at least one player \(i \in S\) such that \(S \backslash \{i\} \notin W\), then S is a quasi-minimal winning coalition, and player i is a critical player of S. The set of critical players of S is denoted by \(\chi (S)\). The set of quasi-minimal winning coalitions in a given simple game (NW) is denoted by Q, and for each \(i\in N\), \(Q_{i}=\{S \in Q: i \in \chi (S)\}\). A coalition \(S \in W\) is a minimal winning coalition if there is no \(T \subset S\) such that T is a winning coalition. The set of all minimal winning coalitions in (NW) is denoted by M, and for each \(i \in N\), \(M_i = \{S \in M: i \in S\}\). Note that if \(\chi (S) = S\), then \(S \in M\). Obviously, for any simple game (NW), \(M \subseteq Q \subseteq W\).

A power index g for simple games is a mapping that assigns a vector \(g(N,W) \in \mathbb {R}^{N}\) to each simple game (NW), where \(g_{i}(N,W)\) quantifies the power of player i in (NW). A well-known power index for simple games is the Johnston index (Johnston, 1978). It is defined, for any simple game (NW) and for any \(i\in N\), by

$$\begin{aligned} \text{ J}_{i}(N,W) = \frac{1}{\mid Q \mid } \sum _{S \in Q_{i}} \frac{1}{\mid \chi (S) \mid }. \end{aligned}$$
(1)

Its definition is based on the following principles: (i) only quasi-minimal winning coalitions will emerge victorious, (ii) all quasi-minimal winning coalitions are equally likely, and (iii) all critical players in the same quasi-minimal winning coalition play the same role.

A weighted majority game is a simple game (NW) that can be represented by \((q;{\varvec{w}})\) or \([q; w_{1}, \ldots , w_{n}]\), such that \(q \in \mathbb {N}\) (\(q>0\)) is an imposed quota and \({\varvec{w}}=(w_1,\ldots ,w_n)\) represents the collection of non-negative integer voting weights of players of N. In this case, \(S \in W\) if and only if \(w(S) \ge q\), being \(w(S) = \sum _{i \in S} w_{i}\) for any given coalition \(S\subseteq N\). These games are usually used to represent voting systems where each player has a weight in the decision. The goal of the cooperation of players is to form winning coalitions. A power measure f for weighted majority games is a mapping that assigns a vector \(f(q;{\varvec{w}}) \in \mathbb {R}^{N}\) to each representation of a weighted majority game \((q;{\varvec{w}})\), where \(f_{i}(q;{\varvec{w}})\) measures the power of player i in \((q;{\varvec{w}})\).

Note that a weighted majority game can be represented by different quota and weights configurations. Nevertheless, power indices, such as the Johnston, the Shapley–Shubik and the Banzhaf indices, do not depend on these representations. In general, a power index for a weighted majority games is a power measure that provides the same power distribution for all its representations.

The Colomer–Martínez measure (Colomer & Martínez, 1995) is defined, for every weighted majority game \((q;{\varvec{w}})\) and every \(i\in N\), by

$$\begin{aligned} \text{ CM}_{i} (q;{\varvec{w}})= \frac{1}{\mid M\mid } \sum _{S \in M_{i}} \frac{w_{i}}{w(S)}. \end{aligned}$$
(2)

From its definition, we can state that this index considers only minimal winning coalitions. Moreover, all minimal winning coalitions are equally likely to be selected. The power of minimal winning coalitions is distributed proportionally with respect to the contribution of the players (the individual weight) to the total weight of the coalition.

Note that the Colomer–Martínez measure may not assign the same distribution of power for two different representations of the same weighted majority game. This is because the index considers not only the minimal winning coalitions but also the weights of the players.

3 The generating functions-based computation of the Johnston index

In this section we propose a method to compute the Johnston index for weighted majority games using generating functions. The method of generating functions is a combinatorial analysis technique based on obtaining a polynomial enumeration of the set of all coalitions with control over their weights. See, for example, Stanley (1986) for more details.

For this purpose, we consider an alternative formulation of the Johnston index in (1) based on the cardinality of the set of quasi-minimal winning coalitions. Let (NW) be a weighted majority game and take \(i\in N\). Firstly, we consider the set \({\mathcal {C}}_i\) given by

$$\begin{aligned} {\mathcal {C}}_i=\big \{|\chi (S)|: S \in Q_i\big \} \end{aligned}$$
(3)

for every \(i\in N\). For each \(k \in {\mathcal {C}}_i\), we denote by \(c^i_k\) the cardinality of the set of quasi-minimal winning coalitions \(S \in Q_{i}\) such that \(|\chi (S)|=k\).

Thus, the Johnston index for the weighted majority game (NW) can be also expressed, for any player \(i \in N\), by

$$\begin{aligned} \text{ J}_{i}(N,W) = \frac{1}{\mid Q\mid } \sum _{k \in {\mathcal {C}}_i} \frac{c^{i}_k}{k}, \end{aligned}$$
(4)

with \({\mathcal {C}}_i\) being the set of sizes in (3).

Below, we propose a procedure to compute \(c^i_k\) for each \(i \in N\) and each \(k \in {\mathcal {C}}_i\) in a weighted majority game \((q;{\varvec{w}})\).

Procedure 1

Let (NW) be a weighted majority game given by \((q;{\varvec{w}})\). The steps to compute \(c^i_k\), for each \(i \in N\) and each \(k \in {\mathcal {C}}_i\), are the following.

  • Step 1. For every \(i\in N\), consider the function \(f^i\) defined as:

    $$\begin{aligned} f^i(z_{1}, \dots ,z_{i-1},z_{i+1}, \dots ,z_{n},x)= & \prod _{j = 1: j \ne i}^{n} (1 + x^{w_{j}}z_{j}). \end{aligned}$$
  • Step 2. Obtain, for every \(i\in N\), the function \(g^i (z_{1}, \dots ,z_{n},h_{i})\) defined as the sum of those terms of the function \(f^i\) with a degree of variable x between \(q - w_i\) and \(q-1\), and replacing the variable x and its degree by \(z_ih_i\).

  • Step 3. Obtain the function \(G(z_{1}, \dots ,z_{n},h_{1}, \dots ,h_{n})\) defined as the sum of the functions \(g^i\) obtained in the previous step for all \(i \in N\).

  • Step 4. Arrange the addends in G by grouping those ones with the same variables z.

  • Step 5. For each addend of G, eliminate the z’s and, in the summation of the h’s, add to each \(h_i\) involved a degree equal to the number of addend of this sum. So, we obtain the generating function \(GJ(h_1,\ldots ,h_n)\).

  • Step 6. Obtain \(c_k^i\) as the coefficient of the addend \(h_i^k\) of GJ for each \(i\in N\) and each \(k\in {\mathcal {C}}_i\).

The next result ensures that Procedure 1 determines the values \(c^i_k\) for each \(i \in N\) and each \(k \in {\mathcal {C}}_i\) specified in (4).

Theorem 3.1

Let (NW) be a weighted majority game. Procedure 1 provides \(c^i_k\) for each \(i \in N\) and each \(k \in {\mathcal {C}}_i\) and thus, the Johnston index.

Proof

Let (NW) be a weighted majority game. W.l.o.g assume that its representation is given by \((q;{\varvec{w}})\), where \({\varvec{w}}\) denotes the collection \(w_1, w_2,\ldots , w_n\) of individual weights of players in N, and consider Procedure 1.

By using Step 1, consider function \(f^{i}\) for each \(i \in N\). Thus,

$$\begin{aligned} f^i(z_{1}, \dots , z_{i-1},z_{i+1}, \dots ,z_{n},x)= & (1+x^{w_{1}}z_{1}) \cdots (1+x^{w_{i-1}}z_{i-1})(1+x^{w_{i+1}}z_{i+1}) \cdots (1+x^{w_{n}}z_{n}) \\= & 1 + \sum _{S \subseteq N\backslash \{i\}} \prod _{k \in S } x^{w_{k}}z_{k}\\= & 1 + \sum _{j=1}^{n-1} \sum _{l = 1}^{w(N)-w_i} x^l \sum _{\begin{array}{c} S \subseteq N \backslash \{i\} \\ |S|=j \\ w(S)=l \end{array}} \bigg (\prod _{k \in S} z_k\bigg ), \end{aligned}$$

for every \(i\in N\).

Now, by Step 2, obtain the functions \(g^{i}\) for each \(i \in N\), that are obtained as the sum of those addends of \(f^i\) with a degree of x between \(q-w_i\) and \(q-1\) and replacing the variable x and its degree by \(z_ih_i\). That is, for each \(i\in N\), we have that

$$\begin{aligned} g^i (z_{1}, \dots ,z_{n},h_{i})= & z_{i}h_{i} \sum _{j=1}^{n-1} \sum _{l = q-w_i}^{q-1} \sum _{\begin{array}{c} S \subseteq N \backslash \{i\} \\ |S|=j \\ w(S)=l \end{array}} \bigg (\prod _{k \in S} z_k\bigg )\\= & \sum _{\begin{array}{c} S \in Q_i \end{array}} h_{i} \bigg (\prod _{k \in S} z_k\bigg ). \end{aligned}$$

Note that the expression above does not depend on the chosen representation for the weighted majority game. Moreover, the set of coalitions in which a given player i is critical can be identified by reorganising the polynomial G. According to Step 3, we obtain the function G as follows:

$$\begin{aligned} G(z_{1}, \dots ,z_{n},h_{1}, \dots ,h_{n})= & \sum _{i \in N} g^i (z_{1}, \dots ,z_{n},h_{i}) \\= & \sum _{i \in N}\sum _{\begin{array}{c} S \in Q_i \end{array}} \ h_{i} \bigg (\prod _{k \in S} z_k\bigg ). \end{aligned}$$

We rearrange the addends in G with respect to z’s variables, as indicated in Step 4:

$$\begin{aligned} G(z_{1}, \dots ,z_{n},h_{1}, \dots ,h_{n})= & \sum _{\begin{array}{c} S \in Q \end{array}} \bigg ( \left( \prod _{k \in S} z_k \right) \cdot \bigg (\sum _{i \in \chi (S)} h_{i}\bigg ) \bigg ). \end{aligned}$$

From Step 5, for each addend of G (corresponding to each quasi-minimal winning coalition), we remove the z variables and add to each \(h_i\) a degree equal to the number of addends of the sum of h variables (corresponding to the cardinality of the set of critical players of the quasi-minimal winning coalition under consideration). Then, we obtain the generating function GJ as

$$\begin{aligned} GJ(h_{1}, \dots ,h_{n})= & \sum _{\begin{array}{c} S \in Q \end{array}} \sum _{i \in \chi (S)} h_{i}^{\mid \chi (S) \mid } \\= & \sum _{i \in N } \sum _{k =1}^n \sum _{\begin{array}{c} S \in Q_i \\ |\chi (S)|=k \end{array}} h_i^k \\= & { \sum _{i \in N } \sum _{k \in {\mathcal {C}}_i} c_k^i h_i^k.} \end{aligned}$$

Finally, by Step 6, we obtain \(c^i_{k} = |\{S \in Q_i: |\chi (S)|=k\}|\) for each \(k\in {\mathcal {C}}_i\). \(\square \)

The following corollary can be established as a direct consequence of Theorem 3.1.

Corollary 3.2

Let (NW) be a weighted majority game. The cardinality of the set of quasi-minimal winning coalitions is given by the number of addends of the polynomial resulting from Step 4 of Procedure 1.

Let us note that, as for the Shapley–Shubik and the Banzhaf indices, the power index computed by this procedure does not depend on the representation used for the weighted majority game.

The following example illustrates the obtaining of the Johnston index on the basis of the application of Procedure 1.

Example 3.3

Take the weighted majority game (NW) with 4 players given by \([16; 14,13,2,1]\). We follow the steps of Procedure 1 to obtain the Johnston index, as shown below.

  • Step 1. First, we obtain the function \(f^i(z_{1},\dots , z_{i-1},z_{i+1},\dots , z_{4}, x)\) for each \(i \in N\). So, we have that

    $$\begin{aligned} f^1(z_{2},z_{3},z_{4},x)= & (1+x^{13}z_{2})(1+x^{2}z_{3})(1+xz_{4})\\= & 1 + x^{13}z_{2} + x^{2}z_{3} + xz_{4} + x^{15}z_{2}z_{3} + x^{14}z_{2}z_{4} + x^{3}z_{3}z_{4} + x^{16}z_{2}z_{3}z_{4}\\ f^2(z_{1},z_{3},z_{4},x)= & (1+x^{14}z_{1})(1+x^{2}z_{3})(1+xz_{4}) \\= & 1 + x^{14}z_{1} + x^{2}z_{3} + xz_{4} + x^{16}z_{1}z_{3} + x^{15}z_{1}z_{4} + x^{3}z_{3}z_{4} + x^{17}z_{1}z_{3}z_{4}\\ f^3(z_{1},z_{2},z_{4},x)= & (1+x^{14}z_{1})(1+x^{13}z_{2})(1+xz_{4})\\ = & 1 + x^{14}z_{1} + x^{13}z_{2} + xz_{4} + x^{27}z_{1}z_{2} + x^{15}z_{1}z_{4} + x^{14}z_{2}z_{4} + x^{28}z_{1}z_{2}z_{4}\\ f^4(z_{1},z_{2},z_{3},x)= & (1+x^{14}z_{1})(1+x^{13}z_{2})(1+x^{2}z_{3})\\= & 1 + x^{14}z_{1} + x^{13}z_{2} + x^{2}z_{3} + x^{27}z_{1}z_{2} + x^{16}z_{1}z_{3} + x^{15}z_{2}z_{3} + x^{29}z_{1}z_{2}z_{3} \end{aligned}$$
  • Step 2. Now, for each \(i \in N\), we sum those terms of each function \(f^i\) with a degree of the variable x between \(q-w_{i}\) and \(q-1\), and replace the variable x and its degree by \(z_ih_i\). Thus, we obtain the the polynomials \(g^i(z_{1},z_{2},z_{3},z_{4},h_{i})\) and we have that

    $$\begin{aligned} g^1(z_{1},z_{2},z_{3},z_{4},h_{1})= & z_{1}h_{1} \left( z_{2} + z_{3} + z_{2}z_{3} + z_{2}z_{4} + z_{3}z_{4} \right) \\= & z_{1}z_{2}h_{1} + z_{1}z_{3}h_{1} + z_{1}z_{2}z_{3}h_{1} + z_{1}z_{2}z_{4}h_{1} + z_{1}z_{3}z_{4}h_{1}\\ g^2(z_{1},z_{2},z_{3},z_{4},h_{2})= & z_{2}h_{2} \left( z_{1} + z_{1}z_{4} + z_{3}z_{4} \right) \\= & z_{1}z_{2}h_{2} + z_{1}z_{2}z_{4}h_{2} + z_{2}z_{3}z_{4}h_{2}\\ g^3 (z_{1},z_{2},z_{3},z_{4},h_{3})= & z_{3}h_{3} \left( z_{1} + z_{1}z_{4} + z_{2}z_{4} \right) \\= & z_{1}z_{3}h_{3} + z_{1}z_{3}z_{4}h_{3} + z_{2}z_{3}z_{4}h_{3}\\ g^4 (z_{1},z_{2,}z_{3},z_{4},h_{4})= & z_{4}h_{4}\left( z_{2}z_{3}\right) = z_{2}z_{3}z_{4}h_{4} \end{aligned}$$
  • Step 3. This step implies the addition of the polynomials \(g^i\) and thus we obtain

    $$\begin{aligned} G(z_{1},z_{2},z_{3},z_{4},h_{1},h_{2},h_{3},h_{4})= & z_{1}z_{2}h_{1} + z_{1}z_{3}h_{1} + z_{1}z_{2}z_{3}h_{1} + z_{1}z_{2}z_{4}h_{1} + z_{1}z_{3}z_{4}h_{1} \\ & +\, z_{1}z_{2}h_{2} + z_{1}z_{2}z_{4}h_{2} + z_{2}z_{3}z_{4}h_{2} + z_{1}z_{3}h_{3} + z_{1}z_{3}z_{4}h_{3} \\ & +\, z_{2}z_{3}z_{4}h_{3} + z_{2}z_{3}z_{4}h_{4} \end{aligned}$$
  • Step 4. In this step, we rearrange the terms in the polynomial G by grouping those terms with the same variables z’s. This implies that we alternatively obtain that

    $$\begin{aligned} G(z_{1},z_{2},z_{3},z_{4},h_{1},h_{2},h_{3},h_{4})= & z_{1}z_{2}\left( h_{1} + h_{2} \right) + z_{1}z_{3} \left( h_{1} + h_{3} \right) + z_{1}z_{2}z_{3}\left( h_{1}\right) \\ & +\, z_{1}z_{2}z_{4}\left( h_{1} + h_{2}\right) + z_{1}z_{3}z_{4} \left( h_{1} + h_{3}\right) \\ & +\, z_{2}z_{3}z_{4}\left( h_{2}+h_{3}+h_{4}\right) \end{aligned}$$

    Besides, Corollary 3.2 directly ensures that \(\mid Q\mid = 6\).

  • Step 5. In this step, we add to each \(h_{i}\) a degree equal to the cardinality of elements z’s with the same subindex that elements h’s in the corresponding term of the polynomial G and we remove the variables z’s from G. Then, we obtain the generating function \( GJ(h_{1},h_{2}, h_{3},h_{4})\) as follows:

    $$\begin{aligned} GJ(h_{1},h_{2}, h_{3},h_{4})= & \left( h_{1}^{2} + h_{2}^{2} \right) + \left( h_{1}^{2} + h_{3}^{2} \right) + \left( h_{1}\right) + \left( h_{1}^{2} + h_{2}^{2}\right) + \left( h_{1}^{2} + h_{3}^{2}\right) \\ & + \,\left( h_{2}^{3}+h_{3}^{3}+h_{4}^{3}\right) = h_{1} + 4 h_{1}^{2} + 2 h_{2}^{2} + h_{2}^{3} + 2 h_{3}^{2} + h_{3}^{3}+h_{4}^{3} \end{aligned}$$
  • Step 6. In each term \(c^i_k h^k_i\) of the polynomial GJ, with \(i \in N\) and \(k \in {\mathcal {C}}_i\), \(c^i_k\) is the cardinality of the set of quasi-minimal winning coalitions S, such that \(S \in Q_{i}\) and \(\mid \chi (S)\mid =k\). Then we have

    • \(c^1_1 = 1\) and \(c^1_2 = 4\), for player 1;

    • \(c^2_2 = 2\) and \(c^2_3 = 1\), for player 2;

    • \(c^3_2 = 2\) and \(c^3_3 = 1\), for player 3, and

    • \(c^4_3 = 1\), for player 4.

    Finally, we calculate the Johnston index, as

    • \(\text{ J}_{1}(N,W)= \frac{1}{6} \left( \frac{1}{1} + \frac{4}{2}\right) = 0.500\),

    • \(\text{ J}_{2}(N,W)= \frac{1}{6} \left( \frac{2}{2} + \frac{1}{3}\right) \approx 0.222\),

    • \(\text{ J}_{3}(N,W)= \frac{1}{6} \left( \frac{2}{2} + \frac{1}{3}\right) \approx 0.222\), and

    • \(\text{ J}_{4}(N,W)= \frac{1}{6} \left( \frac{1}{3} \right) \approx 0.056\).

4 The generating functions-based computation of the Colomer–Martínez measure

In this section we propose a procedure to compute the Colomer–Martínez measure for weighted majority games using generating functions. Recall that the Colomer–Martínez measure depends on the chosen representation of the weighted majority game. Then, from now on we use the representation in reference to the weighted majority game.

Again, we consider an alternative formulation of the Colomer–Martínez measure, originally introduced in (2), now based on the cardinality of the set of minimal winning coalitions. More specifically, we propose a procedure that counts the minimal winning coalitions involving each player i and where the sum of the individual weights of its members is k. Let \((q;{\varvec{w}})\) be a weighted majority game such that \({\varvec{w}}\) denotes the collection of individual weights of players in N given by \(w_1, w_2,\ldots , w_n\). For each \((q;{\varvec{w}})\) and for each \(i\in N\), we consider the set of weights \({\mathcal {W}}_i\) given by

$$\begin{aligned} {\mathcal {W}}_i=\big \{w(S): S \in M_i\big \}. \end{aligned}$$
(5)

For each \(i \in N\) and each \(k \in {\mathcal {W}}_i\), we denote by \(cm_k^i\) the cardinality of the set of minimal winning coalitions \(S \in M_i\) such that \(w(S) = k\).

Thus, the Colomer–Martínez measure for the weighted majority game \((q;{\varvec{w}})\) admits, for each \(i\in N\), the following formulation:

$$\begin{aligned} \text{ CM}_{i}(q;{\varvec{w}}) = \frac{w_{i}}{\mid M\mid } \sum _{k \in {\mathcal {W}}_i} \frac{cm^i_k}{k}, \end{aligned}$$
(6)

with \({\mathcal {W}}_i\) being the set of weights given in (5).

Next, we propose a procedure to compute \(cm_k^i\) for each \(i \in N\) and each \(k \in {\mathcal {W}}_i\) and thus, the Colomer–Martínez measure as in (6).

Procedure 2

Let \((q;{\varvec{w}})\) be a weighted majority game. The steps to compute \(cm_k^i\) for each \(i \in N\) and each \(k \in {\mathcal {W}}_i\) are described below.Footnote 1

  • Step 1. First, compute the function f defined by

    $$\begin{aligned} f(z_{1},\ldots ,z_{n},x) = \prod _{j =1}^{n} (1+x^{w_{j}}z_{j}). \end{aligned}$$
  • Step 2. Select the terms in \(f(z_{1},\ldots ,z_{n},x)\) with a degree of x greater than or equal to q. Thus we obtain the polynomial \(g(z_{1},\ldots ,z_{n},x)\).

  • Step 3. Remove the monomials that are divisible by another monomial of g. Then, we obtain the polynomial \(GCM(z_{1},\ldots ,z_{n},x)\).

  • Step 4. Obtain the generating functions \(GCM^{i}(x)\) as the polynomial composed, for each \(i\in N\), of the terms of \(GCM(z_{1},\ldots ,z_{n},x)\) that contain \(z_i\), after removing the z variables.

  • Step 5. Finally, \(cm^i_k\) is the coefficient of each term of the polynomial \(GCM^{i}(x)\) where the degree of x is k, for each \(k \in {\mathcal {W}}_i\).

Below, Theorem 4.1 ensures that Procedure 2 determines the values \(cm_k^i\), for each \(i \in N\) and each \(k \in {\mathcal {W}}_i\), in (6).

Theorem 4.1

Let \((q;{\varvec{w}})\) be a weighted majority game. Procedure 2 provides \(cm_k^i\) for each \(i \in N\) and each \(k \in {\mathcal {W}}_i\) and hence the Colomer–Martínez measure.

Proof

Take \((q;{\varvec{w}})\) a weighted majority game and consider Procedure 2. Using Step 1, consider the function f given by

$$\begin{aligned} f(z_{1},\ldots ,z_{n},x)= & (1+x^{w_{1}} z_{1}) \cdots (1+x^{w_{n}}z_{n}) \\= & 1 + \sum _{S \subseteq N} \prod _{k \in S} x^{w_k} z_{k} \\= & 1 + \sum _{j = 1}^{n} \sum _{l = 1}^{w(N)} x^l \bigg (\sum _{\begin{array}{c} S \subseteq N \\ |S|=j \\ w(S)=l \end{array}} \bigg (\prod _{k \in S} z_k\bigg )\bigg ). \end{aligned}$$

By Step 2 of the procedure, we identify those terms of f where the degree of x is equal to or greater than q. Thus, we directly have the polynomial g given by

$$\begin{aligned} g(z_{1},\ldots ,z_{n},x)= & \sum _{j = 1}^{n} \sum _{l = q}^{w(N)} x^l \bigg (\sum _{\begin{array}{c} S \subseteq N \\ |S|=j \\ w(S)=l \end{array}} \bigg (\prod _{k \in S} z_k\bigg )\bigg )\\= & \sum _{\begin{array}{c} S \in W \end{array}} x^{w(S)}\bigg (\prod _{k \in S} z_k\bigg ). \end{aligned}$$

Using Step 3, we remove those monomials that are divisible by another monomial of the function \(g(z_{1},\ldots ,z_{n},x)\). Then we obtain the polynomial \(GCM(z_{1},\ldots ,z_{n},x)\) given by

$$\begin{aligned} GCM(z_{1},\ldots ,z_{n},x)= & \sum _{\begin{array}{c} S \in M \end{array}} x^{w(S)} \bigg (\prod _{k \in S} z_k\bigg ). \end{aligned}$$

We obtain the values of \(cm^i_k\) from the generating functions \(GCM^i\) in Step 4 of the procedure. Thus, for each \(i \in N\) and each \(k \in {\mathcal {W}}_i\), these values are the number of terms of the above polynomial with degree k in which \(z_{i}\) is present. That is,

$$\begin{aligned} GCM^{i}(x)= & \sum _{\begin{array}{c} S \in M_i \end{array}} x^{w(S)} \\= & {\sum _{k \in {\mathcal {W}}_i} cm^{i}_{k} x^{k}.} \end{aligned}$$

So, by Step 5 we have \(cm_k^i = |\{S \in M_i: w(S) = k\}|\) for each \(k\in {\mathcal {W}}_i\). \(\square \)

From Theorem 4.1 we can directly state some results on the identification of winning coalitions and minimal winning coalitions.

Corollary 4.2

Let \((q;{\varvec{w}})\) be a weighted majority game. The cardinality of the set of winning coalitions and the cardinality of the set of minimal winning coalitions are determined respectively by Step 2 and Step 3 of Procedure 2.

The following example illustrates the proposed procedure for calculating the Colomer–Martínez measure.

Example 4.3

Take again the weighted majority game with 4 players considered in Example 3.3 and that is given by [16; 14, 13, 2, 1]. We follow the steps of Procedure 2 to obtain the Colomer–Martínez measure, as shown below.

  • Step 1. First, we calculate the function f as

    $$\begin{aligned} f(z_{1},z_{2},z_{3},z_{4},x)= & (1+x^{14}z_{1})(1+x^{13}z_{2})(1+x^{2}z_{3})(1+xz_{4})\\= & 1 + x^{14}z_{1} + x^{13}z_{2} + x^{2}z_{3} + xz_{4} + x^{27}z_{1}z_{2} + x^{16}z_{1}z_{3} + x^{15}z_{1}z_{4} \\ & + x^{15}z_{2}z_{3} + x^{14}z_{2}z_{4} + x^{3}z_{3}z_{4} + x^{29}z_{1}z_{2}z_{3} + x^{28}z_{1}z_{2}z_{4} \\ & + x^{17}z_{1}z_{3}z_{4} + x^{16}z_{2}z_{3}z_{4} + x^{30}z_{1}z_{2}z_{3}z_{4}. \end{aligned}$$
  • Step 2. Then, we select the terms of f with a degree of variable x greater or equal than \(q = 16\). So,

    $$\begin{aligned} g (z_{1},z_{2},z_{3},z_{4},x)= & x^{27}z_{1}z_{2} + x^{16}z_{1}z_{3} + x^{29}z_{1}z_{2}z_{3} \\ & + x^{28}z_{1}z_{2}z_{4} + x^{17}z_{1}z_{3}z_{4} + x^{16}z_{2}z_{3}z_{4} + x^{30}z_{1}z_{2}z_{3}z_{4}. \end{aligned}$$

    By Corollary 4.2, the total number of addends of this polynomial coincides with the cardinality of the set of winning coalitions, i.e., \(|W|= 7\).

  • Step 3. In the third step, we delete those monomials that are divisible by another monomial of the considered function to obtain the polynomial GCM.

    $$\begin{aligned} GCM(z_{1},z_{2},z_{3},z_{4},x) = x^{27}z_{1}z_{2} + x^{16}z_{1}z_{3} + x^{16}z_{2}z_{3}z_{4}. \end{aligned}$$

    Again, Corollary 4.2 ensures that the cardinality of the set of minimal winning coalitions is \(|M|= 3\).

  • Step 4. In the fourth step, we obtain \(GCM^i\), for each \(i \in N\).

    • \(GCM^{1}(x) = x^{27}+ x^{16}.\)

    • \(GCM^{2}(x) = x^{27} + x^{16}.\)

    • \(GCM^{3}(x) = 2x^{16}.\)

    • \(GCM^{4}(x) = x^{16}.\)

  • Step 5. Finally, we obtain \(c^i_k\), for each \(i \in N\) and \(k \in {\mathcal {W}}_i\), as follows.

    • For player 1, \(cm^1_{27} = 1\) and \(cm^1_{16} = 1\).

    • For player 2, \(cm^2_{27} = 1\) and \(cm^2_{16} = 1\).

    • For player 3, \(cm^3_{16} = 2\).

    • For player 4, \(cm^4_{16} = 1\).

    Once these values are obtained, we calculate the Colomer–Martínez measure. This gives us

    • \(\text{ CM}_{1}(q;{\varvec{w}}) = \frac{14}{3} \left( \frac{1}{16} + \frac{1}{27} \right) \approx 0.465\),

    • \(\text{ CM}_{2}(q;{\varvec{w}}) = \frac{13}{3} \left( \frac{1}{16} + \frac{1}{27} \right) \approx 0.431\),

    • \(\text{ CM}_{3}(q;{\varvec{w}}) = \frac{2}{3} \left( \frac{2}{16} \right) \approx 0.083\), and

    • \(\text{ CM}_{4}(q;{\varvec{w}}) = \frac{1}{3} \left( \frac{1}{16} \right) \approx 0.021\).

5 The Johnston–Colomer–Martínez measure

In this section we present a new measure for weighted majority games. To formalize it, we combine those principles underlying the Johnston index and the Colomer–Martínez measure and that are summarized below.

  • Among all possible coalitions that can be formed in N, only quasi-minimal winning coalitions are considered.

  • Furthermore, it is also assumed that all quasi-minimal winning coalitions are equally likely, i.e. they have the same probability of forming.

  • The power of a critical player in any quasi-minimal winning coalition is the fraction of that player’s individual weight over the total weight of the critical players in the considered coalition.

The Johnston index and the Colomer–Martinez measure satisfy interesting properties and have several applications (see Freixas et al., 2012 and Armijos-Toro et al., 2024a). For example, the Colomer–Martinez measure satisfies weighted symmetry in the representations of weighted majority games with a single minimal winning coalition. Barua et al. (2005) introduced a similar measure that satisfies a similar weighted symmetry property, using all winning coalitions instead of minimal winning coalitions. Then, it is interesting to introduce a new measure, using arguments from the Johnston index and the Colomer–Martinez measure to assess power in different representations of a weighted majority game. This new measure employs quasi-minimal winning coalitions as the Johnston index and satisfies weighted symmetry as the Colomer–Martinez measure.

The new proposed power measure takes into account, like the Colomer–Martínez measure, the internal distribution of power in the coalition based on the information provided by its weights. While the Colomer–Martínez measure only considers minimal winning coalitions, the new measure uses more information, since those coalitions containing at least one critical player are included in its calculation, as the Johnston index.

One argument to justify the use of this new measure is that it takes into account not only that a player can destroy a winning coalition, but also that it serves to make comparisons between the set of players that have this ability to destroy the same set of winning coalitions. Then, we formalize the new measure for weighted majority games below.

Definition 5.1

Let \((q;{\varvec{w}})\) be a weighted majority game. The Johnston–Colomer–Martínez measure for \((q;{\varvec{w}})\) is, for each player \(i \in N\), defined by

$$\begin{aligned} \text{ JCM}_{i}(q;{\varvec{w}})= \frac{1}{\mid Q\mid } \sum _{S \in Q_{i}} \frac{w_{i}}{w(\chi (S))}. \end{aligned}$$
(7)

As a remark, we mention that the Johnston index for weighted majority games can be seen as a particular case of this new measure proposal for the case of those weighted majority games in which all critical players have the same individual weight in any quasi-minimal coalition.

5.1 The generating functions-based computation of the Johnston–Colomer–Martínez measure

In this section we analyse the task of computing the Johnston–Colomer–Martínez measure. Specifically, we provide a procedure for calculating it using generating functions. First, we rewrite the expression for the Johnston–Colomer–Martínez measure given in (7) and introduce some required notation.

Let \((q;{\varvec{w}})\) be a weighted majority game and take \(i\in N\). Now, we consider the set of weights \({\mathcal {W}}_{Q_i}\), for each \(i\in N\), given by

$$\begin{aligned} {\mathcal {W}}_{Q_i}=\big \{w(\chi (S)): S \in Q_i\big \}, \end{aligned}$$
(8)

and \(Q_i\) being the set of quasi-minimal winning coalitions containing a given player i. Fixed \(i\in N\) and \(k \in {\mathcal {W}}_{Q_i}\), \(jcm^i_k\) denotes the cardinality of the set of coalitions \(S \in Q_i\) such that \(w(\chi (S))=k\). Thus, the Johnston–Colomer–Martínez measure for the weighted majority game \((q;{\varvec{w}})\) can alternatively be expressed, for each player \(i \in N\), as

$$\begin{aligned} \text{ JCM}_{i}(q;{\varvec{w}}) = \frac{w_{i}}{\mid Q \mid } \sum _{k \in {\mathcal {W}}_{Q_i}} \frac{jcm^i_k}{k}, \end{aligned}$$
(9)

where \({\mathcal {W}}_{Q_i}\) is the set of weights in (8).

Now we propose a procedure to compute the amounts \(jcm^i_k\) specified for each \(i \in N\) and each \(k \in {\mathcal {W}}_{Q_i}\) in (9).

Procedure 3

Let \((q;{\varvec{w}})\) be a weighted majority game. The steps to compute \(jcm_k^i\) for each \(i \in N\) and each \(k \in {\mathcal {W}}_{Q_i}\) are described below.

  • Step 1. For each \(i\in N\), consider the function \(f^i\), which is defined as follows for each \(i \in N\):

  • Step 2. Now, obtain the function \(j^i (z_{1},\ldots ,z_{n},h_{i})\) defined, for each \(i \in N\), as the sum of those terms of the function \(f^i\) with a degree of variable x is between \(q - w_i\) and \(q-1\), and replacing the variable x and its degree by \(z_ih_i\).

  • Step 3. Next, calculate the function J, defined as the sum of the functions \(j^i\) obtained, for all \(i \in N\), in the previous step.

  • Step 4. Arrange the addends in J by grouping those ones with the same variables z.

  • Step 5. After, each product of the variables z in each addend is replaced by a variable t. Its degree is equal to the sum of the individual weights of the critical players, that are indicated by the sub-indices of the variables h in the addend. Then, obtain the generating function

    $$\begin{aligned} GJCM(h_{1},\ldots ,h_{n},t). \end{aligned}$$
  • Step 6. Finally, obtain \(jcm^i_k\) corresponds to the coefficient of each term \(t^{k}h_{i}\) in the resulting polynomial GJCM for each \(i \in N\) and each \(k \in {\mathcal {W}}_{Q_i}\).

Note that the first four steps of Procedure 3 are exactly the same as the first four steps of Procedure 1 to compute the Johnston index by means of generating functions.

Below, we prove that Procedure 3 returns the values \(jcm^i_k\) for each \(i \in N\) and each \(k \in {\mathcal {W}}_{Q_i}\) specified in (9).

Theorem 5.2

Let \((q;{\varvec{w}})\) be a weighted majority game. Procedure 3 provides \(jcm_k^i\) for each \(i \in N\) and each \(k \in {\mathcal {W}}_{Q_i}\) and hence the Johnston–Colomer–Martínez measure.

Proof

Let \((q;{\varvec{w}})\) be a weighted majority game, where \({\varvec{w}}\) denotes the collection \(w_1, w_2,\ldots , w_n\) of individual weights of players in N, and consider Procedure 3.

Using Step 1, consider the polynomial \(f^i\) defined for each \(i \in N\) as follows.

$$\begin{aligned} f^i(z_{1}, \dots , z_{i-1},z_{i+1}, \dots ,z_{n},x)= & (1+x^{w_{1}}z_{1})\cdots (1+x^{w_{i-1}}z_{i-1})(1+x^{w_{i+1}}z_{i+1})\cdots \\ & \cdot (1+ x^{w_n}z_n)\\= & 1 + \sum _{S \subseteq N \backslash \{i\}} \prod _{k \in S} x^{w_{k}}z_{j}\\= & 1 + \sum _{j =1}^{n-1} \sum _{l =1}^{w(N) - w_i} x^l \sum _{\begin{array}{c} S \subseteq N \backslash \{i\} \\ |S|=j \\ w(S)=l \end{array}} \bigg (\prod _{k \in S} z_k\bigg ). \end{aligned}$$

Using Step 2, compute the function \(j^i\) for each \(i \in N\) as the sum of those terms of the function \(f^i\) with a degree of variable x between \(q-w_i\) and \(q-1\) and replacing the variable x and its degree by \(z_ih_i\). So for each \(i\in N\) we obtain

$$\begin{aligned} j^i (z_{1},\ldots ,z_{n},h_{i})= & z_{i}h_i\sum _{j =1}^{n-1} \sum _{l = q}^{q-1} \sum _{\begin{array}{c} S \subseteq N \backslash \{i\} \\ |S|=j \\ w(S)=l \end{array}} \bigg (\prod _{k \in S} z_k\bigg ) \\= & \sum _{S \in Q_i} h_i \bigg (\prod _{k \in S} z_k\bigg ). \end{aligned}$$

Thus, by adding, we obtain the function J by considering Step 3.

$$\begin{aligned} J(z_{1},\ldots ,z_{n},h_{1},..,h_{n})= & \sum _{i = 1}^n j^i (z_{1},\ldots ,z_{n},h_{i}) \\= & \sum _{i \in N} \sum _{S \in Q_i} h_i \bigg (\prod _{k \in S} z_k\bigg ). \end{aligned}$$

Step 4 gives the grouping of the addends with respect to the variables z. By Corollary 3.2, each addend corresponds to a quasi-minimal winning coalition.

$$\begin{aligned} J(z_{1},\ldots ,z_{n},h_{1},..,h_{n})= & \sum _{i \in N} \sum _{S \in Q_i} h_i \bigg (\prod _{k \in S} z_k \bigg )\\= & \sum _{S \in Q} \bigg (\left( \prod _{k \in S} z_k \right) \cdot \bigg (\sum _{i \in \chi (S)} h_i \bigg ) \bigg ). \end{aligned}$$

In Step 5 we replace the product of variables z by t. The degree of t is the sum of the weights of the critical variables in each quasi-minimal winning coalition. Thus,

$$\begin{aligned} GJCM(h_{1},..,h_{n},t)= & \sum _{S \in Q} t^{w(\chi (S))} \left( \sum _{\begin{array}{c} i \in \chi (S) \end{array}} h_i \right) \\= & \sum _{i \in N} h_i \left( { \sum _{k \in {\mathcal {W}}_{Q_i}} jcm^{i}_k \cdot t^{k}}\right) . \end{aligned}$$

Finally, by Step 6, we have that \(jcm^{i}_{k} = |\{S \in Q_i: w(\chi (S)) = k \}|\) for each \(i \in N\) and each \(k \in {\mathcal {W}}_{Q_i}\). Hence, we compute the Johnston–Colomer–Martínez measure. \(\square \)

We revisit Examples 3.3 and 4.3 to illustrate the computation of the Johnston–Colomer–Martínez measure.

Example 5.3

Take again the weighted majority game [16; 14, 13, 2, 1]. We follow the steps of Procedure 3 for obtaining the Johnston–Colomer–Martínez measure.

  • Step 1. First, the function \(f^i\) is computed, for each \(i \in N\), by

    $$\begin{aligned} f^1(z_2,z_3,z_4,x)= & \left[ (1+x^{13}z_{2})(1+x^{2}z_{3})(1+xz_{4})\right] \\= & 1 + x^{13}z_{2} + x^{2}z_{3} + xz_{4} + x^{15}z_{2}z_{3} + x^{14}z_{2}z_{4} \\ & + x^{3}z_{3}z_{4} + x^{16}z_{2}z_{3}z_{4}\\ f^2(z_1,z_3,z_4,x)= & \left[ (1+x^{14}z_{1})(1+x^{2}z_{3})(1+xz_{4})\right] \\= & 1 + x^{14}z_{1} + x^{2}z_{3} + xz_{4} + x^{16}z_{1}z_{3} + x^{15}z_{1}z_{4} \\ & + x^{3}z_{3}z_{4} + x^{17}z_{1}z_{3}z_{4}\\ f^3(z_1,z_2,z_4,x)= & \left[ (1+x^{14}z_{1})(1+x^{13}z_{2})(1+xz_{4})\right] \\= & 1 + x^{14}z_{1} + x^{13}z_{2} + xz_{4} + x^{27}z_{1}z_{2} + x^{15}z_{1}z_{4} \\ & + x^{14}z_{2}z_{4} + x^{28}z_{1}z_{2}z_{4}\\ f^4(z_1,z_2,z_3,x)= & \left[ (1+x^{14}z_{1})(1+x^{13}z_{2})(1+x^{2}z_{3})\right] \\= & 1 + x^{14}z_{1} + x^{13}z_{2} + x^{2}z_{3} + x^{27}z_{1}z_{2} + x^{16}z_{1}z_{3}\\ & + x^{15}z_{2}z_{3} + x^{29}z_{1}z_{2}z_{3} \end{aligned}$$
  • Step 2. Now, we compute the polynomials \(j^i(z_{1},z_{2},z_{3},z_{4},h_{i})\), for each \(i\in N\), as follows:

    $$\begin{aligned} j^1(z_{1},z_{2},z_{3},z_{4},h_{1})= & z_{1}h_{1} \left( z_{2} + z_{3} + z_{2}z_{3} + z_{2}z_{4} + z_{3}z_{4} \right) = z_{1}z_{2}h_{1} +z_{1} z_{3}h_{1} \\ & + z_{1} z_{2}z_{3}h_{1} +z_{1} z_{2}z_{4}h_{1} + z_{1}z_{3}z_{4}h_{1}\\ j^2(z_{1},z_{2},z_{3},z_{4},h_{2})= & z_{2}h_{2}\left( z_{1} + z_{1}z_{4} + z_{3}z_{4} \right) = z_{1}z_{2}h_{2} + z_{1}z_{2}z_{4}h_{2} + z_{2}z_{3}z_{4}h_{2} \\ j^3 (z_{1},z_{2},z_{3},z_{4},h_{3})= & z_{3}h_{3} \left( z_{1} + z_{1}z_{4} + z_{2}z_{4} \right) = z_{1}z_{3}h_{3} + z_{1}z_{3}z_{4}h_{3} + z_{2}z_{3}z_{4}h_{3}\\ j^4 (z_{1},z_{2},z_{3},z_{4},h_{4})= & z_{4}h_{4}\left( z_{2}z_{3} \right) = z_{2}z_{3}z_{4}h_{4} \end{aligned}$$
  • Step 3. In the third step, we sum these polynomials \(j^i\) for all \(i\in N\), and thus

    $$\begin{aligned} J(z_{1},z_{2},z_{3},z_{4},h_{1},h_{2},h_{3},h_{4})= & z_{1}z_{2}h_{1} +z_{1} z_{3}h_{1} + z_{1} z_{2}z_{3}h_{1} +z_{1} z_{2}z_{4}h_{1} + z_{1}z_{3}z_{4}h_{1} \\ & + z_{1}z_{2}h_{2} + z_{1}z_{2}z_{4}h_{2} + z_{2}z_{3}z_{4}h_{2} + z_{1}z_{3}h_{3} + z_{1}z_{3}z_{4}h_{3} \\ & + z_{2}z_{3}z_{4}h_{3} + z_{2}z_{3}z_{4}h_{4}. \end{aligned}$$
  • Step 4. Below we group the addends of J with respect to the variables z. We get

    $$\begin{aligned} J(z_{1},z_{2},z_{3},z_{4},h_{1},h_{2},h_{3},h_{4})= & z_{1}z_{2}\left( h_{1} + h_{2} \right) + z_{1}z_{3}\left( h_{1} + h_{3} \right) + z_{1}z_{2}z_{3}\left( h_{1} \right) \\ & + z_{1}z_{2}z_{4}\left( h_{1}+h_{2} \right) + z_{1}z_{3}z_{4}\left( h_{1} + h_{3}\right) \\ & + z_{2}z_{3}z_{4}\left( h_{2}+h_{3}+h_{4}\right) . \end{aligned}$$

    Then, we have that \(\mid Q \mid = 6\).

  • Step 5. In the previous expression, we change the variables z by t with a degree equal to the sum of the weights of the critical players in each quasi-minimal winning coalition given by the sub-index of variables \(h_i\). Thus,

    $$\begin{aligned} GJCM(h_{1},h_{2},h_{3},h_{4},t)= & t^{27}\left( h_{1} + h_{2} \right) + t^{16}\left( h_{1} + h_{3} \right) + t^{14}\left( h_{1} \right) + t^{27}\left( h_{1}+h_{2} \right) \\ & + t^{16}\left( h_{1} + h_{3}\right) + t^{16}\left( h_{2}+h_{3}+h_{4}\right) \\= & h_{1}\left( 2 t^{27} + 2 t^{16} + t^{14} \right) + h_{2}\left( 2t^{27} + t^{16}\right) + h_{3}\left( 3t^{16} \right) \\ & + h_{4}\left( t^{16}\right) . \end{aligned}$$
  • Step 6. For each \(i \in N\) and each \(k \in {\mathcal {W}}_{Q_i}\), we identify \(jcm^i_k\) as the coefficient of the term \(t^{k}h_{i}\) in GJCM. So we have

    • For player 1, \(jcm^1_{27} = 2\), \(jcm^1_{16} = 2\), and \(jcm^1_{14} = 1\).

    • For player 2, \(jcm^2_{27} = 2\) and \(jcm^2_{16} = 1\).

    • For player 3, \(jcm^3_{16} = 3\).

    • For player 4, \(jcm^4_{16} = 1\).

    Finally, we calculate the Johnston–Colomer–Martínez measure. Thus, we have that

    • \(\text{ JCM}_{1}(q;{\varvec{w}}) = \frac{14}{6} \left( \frac{1}{14} + \frac{2}{16} + \frac{2}{27} \right) \approx 0.631\),

    • \(\text{ JCM}_{2}(q;{\varvec{w}}) = \frac{13}{6} \left( \frac{1}{16} + \frac{2}{27} \right) \approx 0.296\),

    • \(\text{ JCM}_{3}(q;{\varvec{w}}) =\frac{2}{6} \left( \frac{3}{16} \right) \approx 0.063\), and

    • \(\text{ JCM}_{4}(q;{\varvec{w}}) = \frac{1}{6} \left( \frac{1}{16} \right) \approx 0.010\).

6 A brief note on computational complexity

In this section we do an analysis of the computational complexity of the proposed algorithms for the obtaining of the Johnston index, the Colomer–Martínez measure and the Johnston–Colomer–Martínez measure. Note that the calculation of power measures is generally based on counting the total number of coalitions. Thus, in the worst case, the computation of most power measures has an execution time of \({\mathcal {O}}( 2^{n})\).

In the following, we evaluate the computational complexity of the proposed algorithms in Procedures 1, 2, and 3. For this purpose, we follow the lines in Bilbao et al. (2000), that analysed the computational complexity of computing the Shapley–Shubik index and the Banzhaf index by means of generating functions, and in Chessa (2014), that evaluated the computational complexity of such tools for the Public Good index calculation. Both approaches assumed a logarithmic cost model. Following Gács and Lovász (1999), a procedure is said to be polynomial if we perform only a polynomial number of operations on numbers with at most a polynomial number of digits.Footnote 2

There are results in the literature on the computational complexity of the procedures for obtaining other power indices for weighted majority games using generating functions. Among others, we mention Bilbao et al. (2000) and Chessa (2014), that respectively proved that the time complexity of computing the Banzhaf and the Shapley–Shubik indices and the Good Public index for a weighted majority game is of order \({\mathcal {O}}(n^2 \cdot {\mathcal {A}})\), where \({\mathcal {A}}\) is the number of non-zero coefficients in their respective generating functions.

Thus, we also assume the logarithmic cost model and we state the following collection of results, in a similar way to the one of Bilbao et al. (2000) and of Chessa (2014). First, we study the computational complexity of obtaining the Johnston index by means of generating functions.

Theorem 6.1

Let \((q;{\varvec{w}})\) be a weighted majority game. If \({\mathcal {A}}_i\) is the number of non-zero coefficients of \(f^i(z_{1},\ldots ,z_{n},x)\) for every \(i\in N\) and \({\mathcal {A}}=\max _{i\in N}\{{\mathcal {A}}_i\}\), then the time complexity of the generating algorithm for the Johnston index is \({\mathcal {O}}(n^2 \cdot {\mathcal {A}})\).

Proof

Let i be a player of N and consider the function \(GJ_i(h_1,\ldots ,h_n)= \sum _{k \in {\mathcal {C}}_i} c_k^{i} h_i^{k}\), specified by the addend of the generating function \(GJ(h_1,\ldots ,h_n)\) associated with player i. It is obtained by the following loops:

  1. 1.

    Take \(i \in N\). Thus, the function \(f^i(z_{1},\ldots ,z_{n},x) = \prod _{j = 1: j \ne i}^{n} (1 + x^{w_{j}}z_{j})\), associated with player i, is obtained as \(f^i(z_{1},\ldots ,z_{n},x) \leftarrow 1\) for \(j \in \{1,\ldots ,n\}\) with \(j \ne i\) do      \(f^i(z_{1},\ldots ,z_{n},x) \leftarrow f^i(z_{1},\ldots ,z_{n},x) + f^i(z_{1},\ldots ,z_{n},x) \cdot x^{w_j}\cdot z_j\) endfor The time to compute the line in the loop is \({\mathcal {O}}({\mathcal {A}}_i)\), then the time to compute the function \(f^i(z_{1},\ldots ,z_{n},x)\) is \({\mathcal {O}}(n \cdot {\mathcal {A}}_i)\) for every player \(i\in N\). Thus, if we take \({\mathcal {A}}=\max _{i\in N}\{{\mathcal {A}}_i\}\), the total time to compute such functions for N is \({\mathcal {O}}(n^2 \cdot {\mathcal {A}})\) for all players.

  2. 2.

    By using Step 3 in Procedure 1, we obtain the function \(G(z_1,\ldots ,z_n,h_1,\ldots ,h_n) = \sum _{i \in N} \sum _{\begin{array}{c} k \in {\mathcal {C}}_i \end{array}} h_{i} \bigg (\prod _{k \in S} z_k\bigg )\). To this aim, we will denote by \(g^{i}_{k}(z_1,\ldots ,z_n)\) the \(k^{th}\) monomial of \(f^i\) with degree of x between \(q-w_i\) and \(q-1\), and do the following: \(G(z_1,\ldots ,z_n,h_1,\ldots ,h_n) \leftarrow 0\) for \(i \in \{1,\ldots ,n\}\) do      for \(k \in {\mathcal {C}}_i\) do         \(g^{i}_{k}(z_1,\ldots ,z_n) \leftarrow f^i(z_{1},\ldots ,z_{n},x)\)         \(G(z_1,\ldots ,z_n,h_1,\ldots ,h_n) \leftarrow G(z_1,\ldots ,z_n,h_1,\ldots ,h_n) + g^{i}_{k}(z_1,\ldots ,z_n) \cdot z_i \cdot h_i\)      endfor endfor The time to compute the inner loop is \({\mathcal {O}}(|{\mathcal {C}}_i|)\) for each \(i \in N\). Then, the time to compute this function is \({\mathcal {O}}(n \cdot \max _{i \in N} |{\mathcal {C}}_i| )\). Since \(\max _{i \in N} |{\mathcal {C}}_i| < {\mathcal {A}}\), we have ensured a time complexity \({\mathcal {O}}(n \cdot {\mathcal {A}})\).

  3. 3.

    Finally, we analyse the case of determining the function \(GJ_i(h_1,\ldots ,h_n) = \sum _{k \in {\mathcal {C}}_i} c_k^{i} h_i^{k}\) for each \(i\in N\) from the function \(G(z_1,\ldots ,z_n,h_1,\ldots ,h_n)\). \(s \leftarrow 0\) for \(k \in {\mathcal {C}}_i\) do      \(s \leftarrow s + c_k^{i}\) endfor The time to compute the loop is \({\mathcal {O}}(|{\mathcal {C}}_i|)\) for each \(i \in N\). Again, as \(\max _{i \in N} |{\mathcal {C}}_i| < {\mathcal {A}}\), we have ensured a time complexity of \({\mathcal {O}}({\mathcal {A}})\).

Thus, we can conclude that the generating algorithm for computing the Johnston index in Procedure 1 has associated a total time complexity \({\mathcal {O}}(n^2 \cdot {\mathcal {A}})\). \(\square \)

Below, we analyse the computational complexity of obtaining of the Colomer–Martínez measure by using generating functions.

Theorem 6.2

Let \((q;{\varvec{w}})\) be a weighted majority game. If \({\mathcal {A}}\) is the number of non-zero coefficients of \(f(z_{1},\ldots ,z_{n},x)\), then the time complexity of the generating algorithm for the Colomer–Martínez measure is \({\mathcal {O}}(n \cdot {\mathcal {A}})\).

Proof

Let i be a player of N and consider the function \(GCM^i(x)= \sum _{k \in {\mathcal {W}}_i} cm_k^{i} x^{k}\), specified by those addends of the generating function \(GCM(z_1,\dots ,z_n,x)\) in which \(z_i\) is present. It is obtained by the following loops:

  1. 1.

    The function \(f(z_{1},\ldots ,z_{n},x) = \prod _{j = 1}^{n} (1 + x^{w_{j}}z_{j})\) is obtained as \(f(z_{1},\ldots ,z_{n},x) \leftarrow 1\) for \(j \in \{1,\ldots ,n\}\) do      \(f(z_{1},\ldots ,z_{n},x) \leftarrow f(z_{1},\ldots ,z_{n},x) + f(z_{1},\ldots ,z_{n},x) \cdot x^{w_j}\cdot z_j\) endfor The time to compute the line in the loop is \({\mathcal {O}}({\mathcal {A}})\), then the time to compute the function \(f(z_{1},\ldots ,z_{n},x)\) is \({\mathcal {O}}(n \cdot {\mathcal {A}})\).

  2. 2.

    By using Step 3 in Procedure 2, we obtain \(GCM(z_1,\ldots ,z_n,x) = \sum _{S \in M} x^{w(S)}\bigg (\prod _{k \in S} z_k\bigg )\). Recall that we denote by \(g(z_1,\ldots ,z_n,x)\) that polynomial specified by the monomials of \(f(z_{1},\ldots ,z_{n},x)\) with a degree of \(x \ge q\). Thus, we have to do: \(GCM(z_1,\ldots ,z_n,x) \leftarrow 0\) for \(j \in M\) do      \(g(z_1,\ldots ,z_n,x) \leftarrow \) monomial of \(f(z_{1},\ldots ,z_{n},x)\) with degree of \(x\ge q\)      \(GCM(z_1,\ldots ,z_n,x) \leftarrow GCM(z_1,\ldots ,z_n,x) + g(z_1,\ldots ,z_n,x)\) endfor Thus, the time to compute \(GCM(z_1,\ldots ,z_n,x)\) is \({\mathcal {O}}(|M|)\). Note that, as \(|M| \le {\mathcal {A}}\), it satisfies that the time complexity is \({\mathcal {O}}({\mathcal {A}})\).

  3. 3.

    Finally, we analyse the case of determining the function \(GCM^{i}(x) = \sum _{k \in {\mathcal {W}}_i} cm_k^{i}x^{k}\), that is obtained as the polynomial resulting from the addends of \(GCM(z_1,\dots ,z_n,x)\) that contain \(z_i\) after excluding z variables for each \(i \in N\). \(s \leftarrow 0\) for \(k \in {\mathcal {W}}_i\) do      \(s \leftarrow s + cm_k^{i}\) endfor Clearly, the time to compute the previous loop is \({\mathcal {O}}(|{\mathcal {W}}_i|)\) fore every \(i \in N\). As \( \max _{i \in N} |{\mathcal {W}}_i| \le |M| < {\mathcal {A}}\), the total time complexity is \({\mathcal {O}}({\mathcal {A}})\).

Thus, we can conclude that the generating algorithm for computing the Colomer–Martínez measure in Procedure 2 has associated a total time complexity \({\mathcal {O}}(n \cdot {\mathcal {A}})\). \(\square \)

Finally, we formalize an analogous result on the complexity of computing the Johnston–Colomer–Martínez measure for weighted majority games through generating functions. Due to the nature of this measure, the outline of its proof is quite similar to those of the results already presented in Theorem 6.1. For simplicity, we omit it from the paper.

Theorem 6.3

Let \((q;{\varvec{w}})\) be a weighted majority game. If \({\mathcal {A}}_i\) is the number of non-zero coefficients of \(f^i(z_{1}, \dots , z_{i-1},z_{i+1}, \dots ,z_{n},x)\) for every \(i\in N\) and \({\mathcal {A}}=\max _{i\in N}\{{\mathcal {A}}_i\}\), then the time complexity of the generating algorithm for the Johnston–Colomer–Martínez measure is \({\mathcal {O}}(n^2 \cdot {\mathcal {A}})\).

7 powerindexR: a tool for measuring the power

This section illustrates the usage of generating functions for computing, among others, the Johnston index, the Colomer–Martínez measure, and the Johnston–Colomer–Martínez measure in voting situations. Specifically, we analyse the evolution of power in the most representative political parties in different compositions of the parliament of Spain in the period from 2015 to 2019.

For this purpose, we have implemented several power indices in R software (R Core Team, 2024), a fact that enabled the development of the R package powerindexR (Armijos-Toro et al., 2024b) for the computation of several power measures. For instance, it additionally considers the computation of other well-known power measures, such as the Shapley–Shubik index or the Banzhaf index.

Below, we briefly describe its capabilities for determining power measures of players in weighted majority games. Following basic instructions, powerindexR in R software allows the computation of several power measures by introducing the quota q (quota) and the vector of weights \(w_1,w_2,\ldots ,w_n\) (weights) for the set of players of any voting situation. The remaining arguments are summarized in Table 1, that describes the functions in powerindexR and their options.

Table 1 Arguments of the functions in powerindexR package

The package is also implemented for other families of weighted majority games. For instance, if a coalitional structure is considered on N, the extension of the Shapley–Shubik and the Banzhaf indices is obtained by doing partition=TRUE. In the case of the Banzhaf index, the parameter normalized=TRUE provides its normalized version, and swing=TRUE computes the cardinality of the set of coalitions for which each player is critical. The logical arguments minimal=TRUE and quasiminimal=TRUE respectively provide the minimal and the quasi-minimal winning coalitions of a weighted majority game. Besides, powerindex() function requires an extra parameter to indicate the power index to be computed. Let us note that, although such functions were implemented for a general number of players, the features of the computer in which power measures are performed will determine the computational capacity in practice. For example, on a standard personal computer with an Intel(R) Core(TM) i9-11900KF, 3.50GHz and 16GB RAM, if we consider a weighted majority game without symmetries, such as the one described in Example 5 of Freixas and Pons (2023), the Johnston index can be calculated for 25 players in just over 1 min and for 28 players in about 10 min. More information is available on the website https://cran.r-project.org/package=powerindexR.

7.1 An application of powerindexR: the power in the Spanish parliament

The Spanish parliament, namely Congreso de los Diputados, is composed of 350 seats who are elected through a proportional representation system every four years (as maximum). This parliament is responsible for representing their constituencies, proposing and passing legislation, and acting as a control of the different areas of government (such as education, foreign affairs, or justice, among others).

The current composition of the parliament reflects the results of the last Spanish General election, held in November 2019. In that moment, the Partido Socialista Obrero Español (PSOE) holds the largest number of seats with 120, the Partido Popular (PP) obtained 89 seats, the merge of far-left parties Unidas Podemos (UP), 35 seats, the center-right party Ciudadanos (Cs), 10 seats, the far-right partido VOX, 52 seats, and other smaller parties the remaining seats. Table 2 completes the distribution of seats by political party in the last four General elections in Spain until 2022. Prior to 2015, it was common for the PP and PSOE to alternate in government, either on their own or with the support of some minority parties.

Table 2 Seats by political party in the Spanish parliament in the period 2015–2019

The task of measuring power in the Congreso de los Diputados can be approached from the perspective of cooperative game theory, as in any other voting situation. Thus, each party can be considered as a player in a weighted majority game with a quota of 176, being the individual weights the number of seats of each party. In this scenario, power measures indicate the capabilities of influence of each party in passing laws. Along this section, we focus on analysing the power evolution of the most representative political parties in Spain after each election. For this purpose, we use powerindexR in R software and the data in Table 2.

In a first step, we analysed the number of coalitions, winning coalitions, quasi-minimal winning coalitions and minimal winning coalitions for each post-election scenario. It is worth mentioning that the fragmentation of a parliament makes their exact computation a challenge task because of, among others, the number of minimal winning coalitions enlarges as the representativeness of parties in parliament also increases. See, for instance, the case of the results of the elections of 2019. Table 3 depicts these amounts that were obtained by using powerindexR package on the different compositions of seats of the Spanish parliament.

Table 3 Summary of the Spanish parliament in the period 2015–2019

Table 4 shows the evolution of the influence of those parties with the largest representation in the Spanish parliament in the period from 2015 to 2019, by using power measures as criterion. For their obtaining, we use powerindexR package. By notational convenience, we denote the Shapley–Shubik index by SS, the Banzhaf index, by BZ, the Johnston index, by JH, the Colomer–Martínez measure, by CM, and the Johnston–Colomer–Martínez measure, by JCM.

Table 4 Power distribution in the Spanish parliament resulting from elections in the period 2015–2019

From the numerical results, we point out below some significant issues on the evolution of the power of the different political parties. PP is a political party considered on the right/centre-right of the Spanish political spectrum. This political party led the government in the periods 1996–2004 and 2011–2018. This party achieved an absolute majority, with 186 seats, from the Spanish General elections of 2011. Table 4 indicates that PP obtained the largest power of the parliament (for any power index considered) for the results of 2015 and 2016. Meanwhile, this political party was displaced to the second place within the Spanish parliament after the general elections of 2019. Its decline favoured the political party VOX, that takes a conservative and Spanish-nationalist ideology and that emerged in the Spanish parliament from the elections of 2019. In view of the results in Table 4, we check that the JCM measure is more sensitive to changes, since it is not only influenced by the cardinality of the set of quasi-minimal winning coalitions but also by the seats obtained by each party. Table 4 also shows that VOX considerably increased its power in the Spanish parliament in just seven months (from April to November 2019). In this case, power measures for weighted majority games such as CM and JCM are the ones that assign the least power to this political party. Besides, we mention the case of Cs, that is a Spanish center-liberal political party. It was one of the political parties that has reduced its power after the elections of 2019 for the Spanish parliament. Clearly, the JCM measure penalizes its power the most, since that this political party went from having 57 seats in April 2019 to 10 in November of the same year.

On the other hand, PSOE is usually recognized as a center-left party. Table 4 evidences that this political party went on to lead the Spanish parliament after the 2019 elections. PSOE presented the same power as the other left-wing political party UP (after, its partner in government) when using SS, B, and JH indices over the compositions of the Spanish parliament resulting from the elections of 2015 and 2016. However, the power calculated with CM and JCM measures evidences differences between these two political parties according to the number of seats obtained in both elections. PSOE increased its power, while UP decreased it. Table 4 shows a clear decline in power for UP despite this cooperation.

As concluding comments, we have checked the Spanish Parliament has shifted its majority from a centre-right to a centre-left position, although we highlight the consolidation of parties with extreme positions in the 2019 elections. Moreover, in the case of the parties that lead governments, we can easily see that JH and JCM prescribe a power larger than 50% for PP after the 2015 and 2016 elections, but also for PSOE after the two elections in 2019. A special mention must be made for the case of two nationalist parties, Esquerra Republicana de Catalunya (ERC) and of Partido Nacionalista Vasco (PNV), which have played an important role in crucial events in Spanish democracy. Table 4 also indicates that the power of both political parties has been maintained over time with the exception of the elections of 2016, where they slightly reduce their influence.

8 Conclusions and further research

The analysis of power measures tends to focus on defining and characterising new measures of voter’s influence in voting situations. However, a common task is often the efficient computation of such measures by means of generating functions, as is the case of the Shapley–Shubik and the Banzhaf power indices. In this paper we describe specific procedures to compute the Johnston index and the Colomer–Martínez measure based on generating functions. Using the principles underpinning both, we propose a new measure of the power in this setting, the Johnston–Colomer–Martínez measure. The task of computing this new power measure by means of generating functions is also analysed from a computational complexity perspective.

Besides, we have implemented the generating functions for the three power measures mentioned above in the powerindexR package of R software, jointly with other analogous functions for calculating the Shapley–Shubik or the Banzhaf indices. This has already been used in the practical application of this work and can easily be extended in the future to include other power indices or measures from the literature.

Finally, we mention several relevant issues for further research. Firstly, a comprehensive analysis, from a purely theoretical point of view, of the Johnston–Colomer–Martínez measure should be undertaken. In addition, it would be interesting to propose methods to compute different indices resulting (or not) from variations of the Johnston index and the Colomer–Martínez measure for more complex models, such as games with a priori unions (Owen, 1977) or games with restricted communication (Myerson, 1977).