Abstract:
Nash equilibrium is an important concept for studying human behavior in group decision making process. Given the complexity of finding Nash equilibria, computational tools are necessary to find them. Several programs were developed for this task. However, available programs are either not comprehensive or might be of difficult installation and handling, creating a “barrier of entry” to nonspecialists. The aims of this research are twofold: (i) firstly, it was to identify and to discuss about the available programs for finding Nash equilibria; and (ii) secondly, based on the theoretical proprieties of a Nash equilibrium, to develop a program capable of finding all pure Nash equilibria in games with “n” players and “m” strategies (“n” and “m” being finite numbers) as a Macro tool for Microsoft Excel®. It is expected that the program can contributed to the area of Operations Research by providing a new tool that facilitate the use of game theory concepts within group decisionmaking problemsolving scenarios enabling practical applications using a widespread software.
Keywords:
Group decisionmaking; Game theory; Nash equilibrium; Software
Resumo:
O equilíbrio de Nash é um conceito importante para estudar o comportamento humano no processo de tomada de decisão em grupo. Dada a complexidade de se encontrar equilíbrios de Nash, ferramentas computacionais são necessárias para encontrálos. Vários programas foram desenvolvidos para essa tarefa. No entanto, os programas disponíveis não são abrangentes ou podem ser de instalação e manuseio difíceis, criando uma “barreira de entrada” para não especialistas. Os objetivos desta pesquisa são dois: (i) primeiramente, foi identificar e discutir sobre programas disponíveis para encontrar equilíbrios de Nash; e (ii) em segundo lugar, com base nas propriedades teóricas de um equilíbrio de Nash, desenvolver um programa capaz de encontrar todos os equilíbrios de Nash puros em jogos com “n” jogadores e “m” estratégias (“n” e “m” sendo números finitos) como uma ferramenta Macro para o Microsoft Excel®. Esperase que o programa possa contribuir para a área de Pesquisa Operacional, fornecendo uma nova ferramenta que facilite o uso dos conceitos da teoria dos jogos dentro dos cenários de resolução de problemas em grupo permitindo aplicações práticas usando um software difundido.
Palavraschave:
Tomada de decisão em grupo; Teoria dos jogos; Equilíbrio de Nash; Software
1 Introduction
According to Angeloni (2003)Angeloni, M. T. (2003). Elementos intervenientes na tomada de decisão. Ciência da Informação, 32(1), 1722. http://dx.doi.org/10.1590/S010019652003000100002.
http://dx.doi.org/10.1590/S010019652003...
, in order to increase the quality of a group decisionmaking process, it is convenient to consider the heterogeneous preferences of the decisionmakers and to improve their communication process. The former condition enables to assess the problem through different perspectives, allowing different possibilities to solve the problem. The latter is important for these groups to work efficiently. Game theory has been presented as a tool for dealing and promoting both conditions, expanding the way in which group decision making problems are dealt with.
Luce & Raiffa (1957Luce, R. D., & Raiffa, H. (1957). Games and decisions: Introduction and critical survey. New York: Wiley., p. 5) had already informally characterized game theory as a mathematical formulation for situations of conflict among several people, whom is required to make choices from a welldefined set of strategies. Recently, Sanfey (2007Sanfey, A. G. (2007). Social decisionmaking: insights from game theory and neuroscience. Science, 318(5850), 598602. http://dx.doi.org/10.1126/science.1142996. PMid:17962552.
http://dx.doi.org/10.1126/science.114299...
, p. 318) states that “game theory provides a useful foundation for the study of decisions in a social context”, while Parsons & Wooldridge (2002)Parsons, S., & Wooldridge, M. (2002). Game theory and decision theory in multiagent systems. Autonomous Agents and MultiAgent Systems, 5(3), 243254. http://dx.doi.org/10.1023/A:1015575522401.
http://dx.doi.org/10.1023/A:101557552240...
assert that “game theory is a close relative of decision theory […] that can be considered the study of games against nature, where nature is an opponent that does not seek to gain the best payoff, but rather acts randomly”.
Myerson (1996)Myerson, R. (1996). John Nash’s Contribution to Economics. Games and Economic Behavior, 14(2), 287295. http://dx.doi.org/10.1006/game.1996.0053.
http://dx.doi.org/10.1006/game.1996.0053...
states that Nash equilibrium is a powerful concept of solution in game theory, since it provides stable solutions for strategic interactions scenarios. Conversely, according to Garey & Johnson (1977)Garey, M. R., & Johnson, D. S. (1977). Computers and intractability: A guide to the theory of NPcompleteness. The Freeman, the search of Nash equilibrium is considered a nonpolynomial computational problem, in which exponential behavior can be noticed. Therefore, there is the need of computational tool for finding the Nash equilibria in games involving more than two players and strategies, since manually applying algorithms for this search is an extremely timeconsuming task. According to the Game Theory Society (2019)Game Theory Society. (2019). Retrieved in 2014, October 15, from http://www.gametheorysociety.org/
http://www.gametheorysociety.org/...
, a program to find Nash equilibria is a useful tool for those who want to find the theoretical results of their game theoretical models and compare them with the experimental results.
Available programs for finding Nash equilibria include Gambit, aimed at expert users, Game Theory Explorer, whose differential is its graphical interface and GamePlan, able to find all Nash equilibria in games with perfect or imperfect information, among others. However, none of the available programs can be easily integrated within a spreadsheet environment, which would make it easier the application of game theory for a wide range of problemsolving context. In this context, the aims of this research are twofold: (i) firstly, it was to identify and to discuss about the available programs for finding Nash equilibria; and (ii) secondly, to present a program for finding all pure Nash equilibria in games with “n” players and “m” strategies (“n” and “m” being finite numbers) as a Macro tool for Microsoft Excel®, a widespread spreadsheet software.
With the same goal of that the Microsoft Excel Solver® reached by “introducing students to optimization” (Fylstra et al., 1998Fylstra, D., Lasdon, L., Watson, J., & Waren, A. (1998). Design and use of the Microsoft Excel Solver. Interfaces, 28(5), 2955. http://dx.doi.org/10.1287/inte.28.5.29.
http://dx.doi.org/10.1287/inte.28.5.29...
), it is expected that the practitioners from industry and academy can use this new tool that can facilitate the use of game theory concepts in group decision making scenarios.
2 Available software for finding Nash equilibria
Although there are several algorithms for finding Nash equilibria, applying them manually becomes a timeconsuming task. In this way, a program is needed to quickly and perfectly apply the developed algorithms. In the literature, it can be found software for performing this task, including Gambit (McKelvey et al., 2006McKelvey, R. D., McLennan, A. M., & Turocy, T. L. (2006). Gambit: Software tools for game theory. Dover Publications.), Game Theory Explorer (GTE) (Egesdal et al., 2014Egesdal, M., Jordana, A. G., Prause, M., Savani, R., & Stengel, B. V. (2014). Game Theory Explorer. Retrieved in 2014, October 15, from http://www.gametheoryexplorer.org/
http://www.gametheoryexplorer.org/...
) and GamePlan (Langlois, 2005Langlois, J. P. (2005) An introduction to Game Theory Using the GamePlan Software. Retrieved in 2014, October 15, from https://www.researchgate.net/profile/JeanPierre_Langlois/publication/238098439_An_Introduction_to_Game_Theory_Using_the_GamePlan_Software/links/02e7e52d5a9cc8d3ac000000.pdf
https://www.researchgate.net/profile/Jea...
), among others programs.
2.1 Gambit
Developed over 25 years, Gambit (http://www.gambitproject.org/) is an opensource software whose purpose is to find Nash equilibria. The programming language used in the last version was Python. The program can be used in Windows, Linux or Mac systems. Through Gambit, finite games can be constructed and analyzed extensively and strategically for noncooperative games.
Gambit uses several algorithms to find Nash equilibria, presenting a command line interface for each of them (McKelvey et al., 2006McKelvey, R. D., McLennan, A. M., & Turocy, T. L. (2006). Gambit: Software tools for game theory. Dover Publications.). Among the command line interfaces, are: (i) Gambitenumpoly, which finds Nash equilibria solving systems of polynomial equations; (ii) Gambitenummixed, which solves 2player games using the enumeration of extreme points; (iii) Gambitgnm, which uses Newton’s Global Method; (iv) Gambitipa, which uses the iterative method of multimatrix approximation; (v) Gambitlcp, which solves 2player games and uses the linear complementarity method; (vi) Gambitlp, which solves 2player games and finds equilibria through linear programming; (vii) Gambitliap that uses a minimization function approach; and (viii) Gambitsimpdiv, which uses the subdivision approach.
Although this software has evolved significantly, Gambit depends on the inclusion of data through its interface (Figure 1), which might be a timeconsuming task when the number of strategies or players increase. Alternatively, a Gambit’s extension “.gbt” file could be considered for inputting the data. However, it should be noted that it depends on the user’s programming abilities.
Gambit’s screen with a game model for two players and two strategies and the results found by the software.
2.2 Game Theory Explorer
Game Theory Explorer, GTE (http://www.gametheoryexplorer.org) was developed with the objective of being integrated into the Gambit modules, being an opensource software in which, through a graphical interface for web browser, it enables extensive strategic iterative construction of games and ways for finding the equilibria for them (Egesdal et al., 2014Egesdal, M., Jordana, A. G., Prause, M., Savani, R., & Stengel, B. V. (2014). Game Theory Explorer. Retrieved in 2014, October 15, from http://www.gametheoryexplorer.org/
http://www.gametheoryexplorer.org/...
). GTE focuses in providing a userfriendly interface for the use of nonspecialists in such a way that visualization of the games becomes intuitive. Graphic shapes, such as treeshaped games, can be customized, for example, vertically and/or horizontally. Games can be recorded as image format for later use in presentations. Within GTE it is possible to find all Nash equilibria for two players. On the other hand, it is noteworthy that the program’s processing grows exponentially with the increase in the number of possible strategies. Thus, the number of strategies in GTE is restricted to around 15 to 20 per player. The program was written in ActionScript and JavaScript language and can be accessed via web. The Figure 2 presents the main screen of the software.
2.3 GamePlan
GamePlan (http://userwww.sfsu.edu/langlois/) was developed to create and solve a wide range of games in normal and/or extensive forms, with perfect or imperfect information, and static or repetitive games (Langlois, 2005Langlois, J. P. (2005) An introduction to Game Theory Using the GamePlan Software. Retrieved in 2014, October 15, from https://www.researchgate.net/profile/JeanPierre_Langlois/publication/238098439_An_Introduction_to_Game_Theory_Using_the_GamePlan_Software/links/02e7e52d5a9cc8d3ac000000.pdf
https://www.researchgate.net/profile/Jea...
). According to Langlois (2005)Langlois, J. P. (2005) An introduction to Game Theory Using the GamePlan Software. Retrieved in 2014, October 15, from https://www.researchgate.net/profile/JeanPierre_Langlois/publication/238098439_An_Introduction_to_Game_Theory_Using_the_GamePlan_Software/links/02e7e52d5a9cc8d3ac000000.pdf
https://www.researchgate.net/profile/Jea...
the development of GamePlan sought to achieve four objectives. The first was to be a friendly software, that is, it should be easy to create, edit and solve the games. Thus, the program features various colors to differentiate the players, payments and other information in order to facilitate distinguishing the data. The second goal was to be flexible. Thus, the program was sought to be capable of supporting virtually every type of game structure, limited only by the computer’s memory capacity and speed. The third goal was to be exhaustive in relation to the possibilities of algorithms for calculating Nash equilibria. Finally, the fourth objective was to be fast. Figure 3 shows the software main screen in constructing a treeshaped decision 3player game, with two strategies each.
2.4 Other approaches
Dickhaut & Kaplan (1993)Dickhaut, J., & Kaplan, T. (1993). A program for finding Nash equilibria. The Mathematica Journal, 1, 8793. programmed the algorithm called “Nash.m” with the purpose of finding Nash equilibria in bimatrix games. The program converts any normal game into a symmetric game by creating equivalent solutions that are unlikely to be played, and search for pure and mixed Nash equilibria for two person games with a finite number of strategies. According to the authors, the program is useful for beginners to the process of finding Nash equilibria. However, because the program was designed to run with only two players, there is a clearly limitation on the use for both research and real cases. Regarding performance, the program also has the common feature with some other programs, that is, the time needed to find the equilibria grows exponentially in relation to the number of strategies per player.
Knight & Campbell (2018)Knight, V. A., & Campbell, J. (2018). Nashpy: A Python library for the computation of Nash equilibria. Journal Open Source Software, 3(30), 904. http://dx.doi.org/10.21105/joss.00904.
http://dx.doi.org/10.21105/joss.00904...
developed a Python library for the computation of equilibria of two player strategic games called “Nashpy”. The library includes three algorithms for finding Nash equilibria, namely support enumeration, vertex enumeration, and Lemke Howson algorithm, as proposed in Nisan et al. (2007)Nisan, N., Roughgarden, T., Tardos, E., & Vazirani, V. V. (2007). Algorithmic game theory (vol. 1). Cambridge: Cambridge University Press. http://dx.doi.org/10.1017/CBO9780511800481.
http://dx.doi.org/10.1017/CBO97805118004...
. According to Knight & Campbell (2018)Knight, V. A., & Campbell, J. (2018). Nashpy: A Python library for the computation of Nash equilibria. Journal Open Source Software, 3(30), 904. http://dx.doi.org/10.21105/joss.00904.
http://dx.doi.org/10.21105/joss.00904...
, Nashpy is simple to install, which is an alternative to Gambit for games with up to two players, since Gambit might be of difficult installation and, according to the authors, it is not portable. In addition, the implementation of Nashpy was designed in such a way to reduce the complexity of the algorithms and to bring the results with greater speed by not necessary finding all the equilibria.
Spaniel (2014)Spaniel, W. (2014). Game theory 101: the complete textbook. CreateSpace. proposed the Game Theory Calculator, which is a Microsoft Excel® spreadsheet that search for pure strategy and mixed strategy Nash equilibrium for bimatrix games. However, although it’s a practical environment of application, the spreadsheet is limited in number of players and strategies.
Krawczyk & Zuccollo (2006)Krawczyk, J., & Zuccollo, J. (2006). NIRA3: An improved MATLAB package for finding Nash equilibria in infinite games. Victoria University of Wellington. presented a MATLAB package for finding Nash equilibria in finite games with nplayers and mstrategies. However, this package was developed for specific game types. The MATLAB package only finds single equilibrium within the games. As the authors state, games that bring only a single equilibrium are important in cases of regulatory economics and management. However, it is the same limitation as Nash.m, that is, the difficult to apply the program in research with a variety of real cases.
Finally, there are other contributions to the problem of finding Nash equilibrium that can be found in the literature. It can be cited the contributions of Lemke & Howson (1964)Lemke, C., & Howson, J. Jr (1964). Equilibrium points of bimatrix games. Journal of the Society for Industrial and Applied Mathematics, 12(2), 413423. http://dx.doi.org/10.1137/0112033.
http://dx.doi.org/10.1137/0112033...
, Herings & Peeters (2001)Herings, P. J. J., & Peeters, R. J. (2001). A differentiable homotopy to compute Nash equilibria of nperson games. Economic Theory, 18(1), 159185. http://dx.doi.org/10.1007/PL00004129.
http://dx.doi.org/10.1007/PL00004129...
, Govindan & Wilson (2003Govindan, S., & Wilson, R. (2003). A global Newton method to compute Nash equilibria. Journal of Economic Theory, 110(1), 6586. http://dx.doi.org/10.1016/S00220531(03)00005X.
http://dx.doi.org/10.1016/S00220531(03)...
, 2004Govindan, S., & Wilson, R. (2004). Computing Nash equilibria by iterated polymatrix approximation. Journal of Economic Dynamics and Control, 28(7), 12291241. http://dx.doi.org/10.1016/S01651889(03)001088.
http://dx.doi.org/10.1016/S01651889(03)...
), Echenique (2007)Echenique, F. (2007). Finding all equilibria in games of strategic complements. Journal of Economic Theory, 135(1), 514532. http://dx.doi.org/10.1016/j.jet.2006.06.001.
http://dx.doi.org/10.1016/j.jet.2006.06....
, and Porter et al. (2008)Porter, R., Nudelman, E., & Shoham, Y. (2008). Simple search methods for finding a Nash equilibrium. Games and Economic Behavior, 63(2), 642662. http://dx.doi.org/10.1016/j.geb.2006.03.015.
http://dx.doi.org/10.1016/j.geb.2006.03....
. However, the mentioned studies provided only the algorithm for the search of the Nash equilibrium, which need to be programmed in order to be applied.
3 Methodology
Given the fact that available programs might be difficult to install or to make it portable and that they are either for specific uses or have the input of values as a tiring and timeconsuming task it is proposed here a program for finding all pure Nash equilibria in noncooperative games with “n” players and “m” strategies (“n” and “m” finite numbers) as a Macro to Microsoft Excel® using Visual Basic for Applications (VBA) programming language. The program was named Nash Equilibria Finder – NEFinder
The algorithm that supports the search of Nash equilibria in the NEFinder is a trivial method that exhaustively verifies all possible arrangements of strategies that satisfies the theoretical proprieties of the Nash equilibrium solution. The flowchart in Figure 4 summarizes the logical of the proposed algorithm.
Briefly, the procedure begins by defining the variables that will receive the input values, i.e.: number of players, number of possible strategies (alternatives), and matrix of payoffs of all the players, etc. In step 2, the payoff values are assigned to all players and to all strategies (this can be done very easily in a spreadsheet environment). In step 3, an arrangement of strategies must be fixed for all players except one, since this player will be free to choose the best strategy based on the strategies set to the other players. Therefore, in step 4, the strategy with highest payoff for this player will be searched, considering the arrangement of strategies previously fixed to the other players. If more than one highest payoff to this player is found, these other strategies with the same payoff must be stored. This is done in step 5. From step 6 to step 8, the procedure for finding Nash equilibria is run based on the theoretical proprieties of the Nash equilibrium solution. Specifically, a strategy arrangement ${s}^{*}$ will be a Nash equilibrium of a strategic game with “n” players if, and only if, for every player $i$ and an arbitrary strategy ${s}_{i}$, ${u}_{i}\left({s}_{1}^{*},{s}_{2}^{*},\dots ,{s}_{i1}^{*},{s}_{i}^{*},{s}_{i+1}^{*},\dots ,{s}_{n}^{*}\right)\ge {u}_{i}\left({s}_{1}^{*},{s}_{2}^{*},\dots ,{s}_{i1}^{*},{s}_{i},{s}_{i+1}^{*},\dots ,{s}_{n}^{*}\right)$, where ${u}_{i}$ is the utility of player $i$ (Osborne & Rubinstein, 1994Osborne, M. J., & Rubinstein, A. (1994). A course in game theory. Cambridge: MIT press.). In other words, a strategy arrangement ${s}^{*}$ will be a Nash equilibrium of a strategic game if, and only if, every player’s strategy ${s}_{i}^{*}$ is a best response to the other players’ strategies $\left({s}_{1}^{*},{s}_{2}^{*},\dots ,{s}_{i1}^{*},{s}_{i+1}^{*},\dots ,{s}_{n}^{*}\right)$. In this way, all possible arrangements of choices for the players should be verified. In step 6, each player, except the one that was firstly set to having his choice free, will choose their best strategies, but with one restriction imposed, namely: the player $i$ must choose a strategy while other players remain with their strategies fixed. In step 7, it is verified whether the strategies chosen in step 6 are the same as those set in the step 3. If so, a Nash equilibrium was found and it is stored (step 8). Otherwise: (i) if more than one strategy has been stored in step 5, the procedures go back to step 6 and check all them (step 9); or (ii) if no strategy have been stored in step 5, then the procedure goes back to the step 3 and set another arrangement of strategies to the players, except the one that was firstly set to having his choice free, until all possible arrangements of strategies have been verified. The algorithm is detailed in the pseudocode bellow.
Pseudocode for exhaustively find all pure Nash equilibria within NEFinder
Begin
Step (1):
set number of player = nplayer
set number of payoffs per player = npay
set payments = payments(0 to npay1, 0 to nplayer1)
set chosen alternative = chosenalternative (0 to nplayer1)
set alternatives= alternatives (0 to number of alternatives  1)
Step (2)
For n = 0 to nplayer  1
For i = 0 to njog  1
payments(i,n) = value of i payment for n player
next i
Next n
Step (3)
For n = 0 to nplaer  2
chosenalternative (n) = set one alternative for each n
Next n
Step (4)
n = nplayer  1
downpayment = 0
For i = 0 to nplayer  1
If payments (i, n) > downpayments Then
For m = 0 to nplayer  2
If “chosenalternative (m) <> fixed alternative plyer m” Then
m = nplayer
End if
Next m
If m = nplayer  2 Then
chosenalternative (n) = alternative (i)
downpayments = payments(i, n)
End if
End if
Next i
Step (5)
If two or more alternatives exist that satisfy the above condition Then
should store them
End if
Step (6)
For i = 0 until nplayer  1
For the player i check which alternative is chosen in the case of the other choose the alternative fixed and the player n choose the “chosenalternative”
Next i
Step (7)
If “all players choose the previously established alternatives” Then
The set of choices form a equilibrium
End if
Setp (8)
If in step(5) there is more than one option Then
repeat the step (6) and (7) for all options
End if
Step (9)
If all possible alternatives have been fixed Then
end
Else
back to the step (3) and fix other alternative for a different player
End if
Output (found equilibria)
End
To illustrate the logic of the algorithm, a game with three players and two strategies is presented here. All possible arrangements for a game with three players and two strategies are presented in Table 1. In the first time that the algorithm arrives at step 3 the strategy “A” will be set for all players except to the last. In the next iterations, the algorithm will set some other possible arrangement described, for example, the stragtegy “B” for Player 1 and strategy “A” for Player 2. At each iteration a new arrangement must be chosen to set the strategies to the players until all possible arrangements have been verified.
To calibrate the NEFinder, tests with random games were performed. As can be seen in Figure 5, tests were performed with payoffs being random real numbers ranging from 0 to 1, rounding to four decimal places, and the same tests were performed with the payoffs as natural random numbers ranging from 0 to 10, since it was necessary to calculate the efficiency of the NEFinder for situations where there is more chance to find strict Nash equilibria (in the tests with natural numbers) than to those where few strict Nash equilibria are possible (in the tests with real numbers). Tests were also performed by varying the number of players and keeping the number of strategies constant and then varying the number of strategies and keeping the number of players constant. For calculating the processing time of NEFinder, the computer screen was recorded in the Camtasia Studio 8 (video editor software) with the program running together with the Windows chronometer and, afterward, the video was analyzed by slowmotion play for verifying the time of begin and ending of process for calculating the overall time consumed in each test. All tests were performed using an Intel i74790 CPU with 3.60 Ghz and 16 GB RAM in a Windows 10 Pro environment. The Microsoft Excel® version was the one from Microsoft Office Professional Plus 2013.
Finally, in order to validate the calculations of NEFfinder, Gambit software was used for comparisons and verification.
4 Results and discussion
Some of the main differences between the available programs in the literature are related to the handling of the software and to their interface. For instance, while for Gambit it is possible to download the software, GTE must be used online. This means that, in order to use Gambit, certain software installation technical experience is necessary. On the other hand, GTE is more userfriendly, since the focus of the program was precisely to be easily handled by the users. In its turn, GamePlan can be downloaded and installed in a desktop.
Particularly, none of these programs can be used together with Microsoft Excel®, which is a very disseminate tool, commonly used by analysts. Furthermore, the process for including payoffs is manual and it is on the basis of one per time, which makes the integration of the programs with other applications very difficult. Therefore, the main innovation of NEFinder is the searching of Nash equilibria within a spreadsheet environment. The NEFinder program was written in Visual Basic for Application (VBA) language. The VBA language was chosen to be possible to execute NEFinder as a Macro of Microsoft Excel®.
For using NEFinder in the Microsoft Excel® environment, it is necessary, previously of opening the spreadsheet that is going to be manipulated, to open the Macro containing the algorithm of NEFinder, which is the file “NEFinderV1P.xlam” for the Portuguese version of the program or the file “NEFinderV1E.xlam” for the English version of the program. The NEFinder algorithm then will create a menu in the Microsoft Excel® addin tab containing three menu buttons. The first leads to the presentation of the program, as can be seen in the Figure 6.
The second opens the window related to the creation of the game. Through this window it is possible to set the number of players, strategies and the name of the new spreadsheet where the game will be created. The NEFinder demands the number of players and strategies to be at least two, as the bimatrix format is the basic setting for running game theory frameworks. There is no upper limit on the number of players or alternatives, although the computational nature of the problem might restrict it significantly in terms of processing time and, therefore, should be considerate by the user. Additionally, Microsoft Excel® has a limit of up to a million rows, which should be also considered as a limitation, since the number of rows demanded by NEFinder will be the same of the possible arrangements given by the equation $arrangements={m}^{n}$, where “n” is the number of players and “m” is the number of strategies (alternatives). Figure 7 shows NEFinder’s game creation screen.
After setting the number of players and strategies, a new game can be created in the strategic form by clicking “Criar o jogo”. Each player is represented by a column and all arrangements of strategy are shown in the rows. Figure 8 shows the configuration for a twoplayers game with two strategies each. The columns on the left side of the gray square shows the possible strategies with different colors, each color representing the strategy of one player. For example, row 4 contains the arrangement of strategies in which both players opt for strategy “1”, while in row 5, Player 1 (red) chooses strategy “2” and Player 2 (green) chooses strategy “1”. The colors for each player are automatically defined by the program to facilitate visualization for the user.
The cells within the grey square will receive the payoff values for each player associated to each arrangement of strategies, with a validation that prevents the user from entering texts instead numbers. For example, if a row contains the number two in red and the number one in green it means that the Player 1 has chosen strategy “2” and the Player 2 has chosen strategy “1”. Suppose that the payoff for Player 1, in the event that both players choose strategy one, is “two”, then where the Player 1 column intersects with the row for the corresponding strategy the cell will receive the value equal to “two”. Suppose also that when both players choose strategy one, the payoff for Player 2 is “one”. Thus, in the same row, but in the column related to Player 2 it is inserted the value equal to “one”. Accordingly, the payoff value for Player 1 should be inserted into cell C4, while the payoff value for Player 2 should be inserted into cell D4, when both choose strategy “1” as their strategies (row 4). The same logic is applied until all the payoffs are inserted into the grey cells. Figure 9 contains these and other arbitrary values for illustration.
The third button opens the window of NEFinder that is concerned with the calculation of equilibria (Figure 10). One need only to select the grey area in which the payoffs were entered and to click at “Encontrar equilíbrios” for finding all pure Nash equilibria based on the payoffs values. After selecting the payoffs and clicking “Encontrar equilíbrios”, the program will run the trivial and exhaustive searching algorithm and the Nash equilibria found (if any) and their respective payoffs are displayed for each equilibrium on the same page in which the game was created (Figure 11). One can verify that the Nash equilibria found to the game presented in the Figure 9 would be when the Player 1 chooses the strategy “1” as the best response to the choice of Player 2 for strategy “1” and when the Player 1 chooses the strategy “2” as the best response to the choice of Player 2 for strategy “2”, since ${u}_{1}\left(\mathrm{1,1}\right)>{u}_{1}\left(\mathrm{2,1}\right)$, and ${u}_{1}\left(\mathrm{1,2}\right)<{u}_{1}\left(\mathrm{2,2}\right)$, and the same logic to the Player 2.
Finally, random simulations were performed for evaluating the performance of NEFinder with natural and real numbers. The average processing time was evaluated firstly by maintaining the number of strategies fixed and varying the number of players. Subsequently, average processing time was also measured, however, varying the number of strategies and keeping the number of players constant. Figure 12 shows the average times obtained with the games in which the number of strategies were fixed, varying the number of players, using randomly payoffs with positive natural numbers from 0 up to 10. The blue line represents the games with two strategies where the numbers of players varied from four players up to nine. The red line represents average times obtained in the simulations of games with three strategies, with players varying between four and seven. Finally, the same procedure was conducted for games with four strategies in which the number of players varyies from four to six (green line). In the second stage of the tests with natural numbers, the number of players was kept constant and the number of strategies varying. Figure 13 shows the average processing time elapsed to find Nash equilibria in games with four players, varying the number of strategies from three to six (blue line) and the average processing time of games for five players by varying the number of strategies, also from three to five (red line).
As expected by the nature of the problem (Garey & Johnson, 1977Garey, M. R., & Johnson, D. S. (1977). Computers and intractability: A guide to the theory of NPcompleteness. The Freeman), in both first and second sets of tests exponential behavior was noticed and can be seen, in most of cases, in the graph, although some are not noticeable by the limitation of the number of strategies used. The exponential behavior was expected due to the fact that the algorithm used for NEFinder checks all possible arrangements of choices, verifying if each of the arrangement forms a Nash equilibrium. Thus, the processing time increases exponentially with the increase in the number of either the number of players or the number of strategies.
The same performance tests were repeated, but this time with the values of the payoffs being real numbers varying randomly from 0 up to 1. The Figure 14 presents average processing times for the games varying the number of players from four to nine and keeping the number of strategies fixed at two (blue line), varying the number of players from four to seven and keeping the number of strategies fixed at three (red line) and varying the number of players from four to six and keeping the number of strategies fixed at four (green line). In the second stage of the tests the number of players was kept fixed and the number of strategies varied. Tests were performed with four players and varying the number of strategies from three to five and with five players (red line), also varying the number of strategies from three to six with four players (blue line). The average processing time of these tests are shown in the Figure 15.
It can be noted that NEFinder speed is always faster when using real numbers. It should be explained by the fact that the number of required loops that NEFinder algorithm run for situations where too many nonstrict Nash equilibria are present might be high, as the case for the games with natural numbers. Nevertheless, it should be noted that, for natural or real numbers, the performance of games with two players and two strategies were always very fast, meaning that NEFinder is very suitable for the majority of situations modeled by the use of game theory approach.
For validating the results found in NEFinder, the payoffs that were randomly generated in the Microsoft Excel® spreadsheet were converted into the “.GBT” format, which is the format of files manipulated by Gambit. All the tests were performed by using the Gambit’s algorithm to compute as many Nash equilibria as possible by looking for pure strategy equilibria, which has similar purpose of NEFinder. The comparison analysis of NEFinder and Gambit showed perfect convergence of results.
5 Conclusions
Through a literature review, it was possible to identify available programs aimed at finding Nash equilibria. Here is proposed another option for practitioners, the NEFinder. In relation to comprehensive programs, such as Gambit or GamePlan, NEFinder is clearly disadvantageous with relation to possible results that can be found (pure and mixed equilibria). On the other hand, NEFinder has advantages, including the possibility of using a spreadsheet environment without a preliminary setup phase and the possibility of allowing several games simulations without the need to reinsert data, which can be automatized through other Microsoft Excel® Macros. It is also noted that NEFinder is able to find Nash equilibria for games with “n” players and “m” strategies, which is an advantage over programs such as Game Theory Explorer, Nash.m, Nashpy, and Game Theory Calculator. Finally, in relation to speed of calculation, NEFinder demonstrated to be faster when manipulating real numbers between zero and the unity with less probability of the presence of nonstrict Nash equilibria. Due to the fact that NEFinder does not require a preliminary learning phase for using the program, it can increase the efficiency of the program on the overall time for finding Nash equilibria.
Therefore, the main advantage of NEFinder is due to the fact that it can be used in Microsoft Excel® and makes filling up the payoff values very quick, besides Microsoft Excel® being widely used and well known to users. Another advantage of NEFinder is related to the simulation of different games that can be created using different spreadsheets in the same file, which make it possible to run sensitivity analysis for evaluating the results. This feature makes possible the use of NEFinder for instruction of many most common games, including Prisoner’s Dilemma, Stag Hunt game, Chicken game, Battle of the Sexes, and, specially, coordination games. Therefore, NEFinder’s contribution is not based on the complexity of the program, but on its innovative application of easy visualization and practicality in handling. It is expected that NEFinder can contribute to the dissemination of game theory by serving as a tool for finding pure Nash equilibria in group decision making, as before Microsoft Excel Solver® has done in optimization area.
It is recommended to use NEFinder rather than other program in cases where it is desirable to obtain only pure equilibria. It is generally an important feature in many decisionmaking cases. When it is necessary to find mixed equilibria, it is suggested to use other programs, since the first version of NEFinder does not have this function.

Financial support: Fundação de Apoio a Pesquisa do Estado de São Paulo (2013/199159); Conselho Nacional de Desenvolvimento Científico e Tecnológico (458511/2014–5).

How to cite: Sugiyama, R. H. C., & Leoneti, A. B. (2021). A program to find all pure Nash equilibria in games with nplayers and mstrategies: the Nash Equilibria Finder – NEFinder. Gestão & Produção, 28(3), e5640. https://doi.org/10.1590/180696492021v28e5640
References
 Angeloni, M. T. (2003). Elementos intervenientes na tomada de decisão. Ciência da Informação, 32(1), 1722. http://dx.doi.org/10.1590/S010019652003000100002
» http://dx.doi.org/10.1590/S010019652003000100002  Dickhaut, J., & Kaplan, T. (1993). A program for finding Nash equilibria. The Mathematica Journal, 1, 8793.
 Egesdal, M., Jordana, A. G., Prause, M., Savani, R., & Stengel, B. V. (2014). Game Theory Explorer Retrieved in 2014, October 15, from http://www.gametheoryexplorer.org/
» http://www.gametheoryexplorer.org/  Echenique, F. (2007). Finding all equilibria in games of strategic complements. Journal of Economic Theory, 135(1), 514532. http://dx.doi.org/10.1016/j.jet.2006.06.001
» http://dx.doi.org/10.1016/j.jet.2006.06.001  Fylstra, D., Lasdon, L., Watson, J., & Waren, A. (1998). Design and use of the Microsoft Excel Solver. Interfaces, 28(5), 2955. http://dx.doi.org/10.1287/inte.28.5.29
» http://dx.doi.org/10.1287/inte.28.5.29  Game Theory Society. (2019). Retrieved in 2014, October 15, from http://www.gametheorysociety.org/
» http://www.gametheorysociety.org/  Garey, M. R., & Johnson, D. S. (1977). Computers and intractability: A guide to the theory of NPcompleteness. The Freeman
 Govindan, S., & Wilson, R. (2003). A global Newton method to compute Nash equilibria. Journal of Economic Theory, 110(1), 6586. http://dx.doi.org/10.1016/S00220531(03)00005X
» http://dx.doi.org/10.1016/S00220531(03)00005X  Govindan, S., & Wilson, R. (2004). Computing Nash equilibria by iterated polymatrix approximation. Journal of Economic Dynamics and Control, 28(7), 12291241. http://dx.doi.org/10.1016/S01651889(03)001088
» http://dx.doi.org/10.1016/S01651889(03)001088  Herings, P. J. J., & Peeters, R. J. (2001). A differentiable homotopy to compute Nash equilibria of nperson games. Economic Theory, 18(1), 159185. http://dx.doi.org/10.1007/PL00004129
» http://dx.doi.org/10.1007/PL00004129  Krawczyk, J., & Zuccollo, J. (2006). NIRA3: An improved MATLAB package for finding Nash equilibria in infinite games Victoria University of Wellington.
 Knight, V. A., & Campbell, J. (2018). Nashpy: A Python library for the computation of Nash equilibria. Journal Open Source Software, 3(30), 904. http://dx.doi.org/10.21105/joss.00904
» http://dx.doi.org/10.21105/joss.00904  Lemke, C., & Howson, J. Jr (1964). Equilibrium points of bimatrix games. Journal of the Society for Industrial and Applied Mathematics, 12(2), 413423. http://dx.doi.org/10.1137/0112033
» http://dx.doi.org/10.1137/0112033  Luce, R. D., & Raiffa, H. (1957). Games and decisions: Introduction and critical survey New York: Wiley.
 McKelvey, R. D., McLennan, A. M., & Turocy, T. L. (2006). Gambit: Software tools for game theory Dover Publications.
 Langlois, J. P. (2005) An introduction to Game Theory Using the GamePlan Software Retrieved in 2014, October 15, from https://www.researchgate.net/profile/JeanPierre_Langlois/publication/238098439_An_Introduction_to_Game_Theory_Using_the_GamePlan_Software/links/02e7e52d5a9cc8d3ac000000.pdf
» https://www.researchgate.net/profile/JeanPierre_Langlois/publication/238098439_An_Introduction_to_Game_Theory_Using_the_GamePlan_Software/links/02e7e52d5a9cc8d3ac000000.pdf  Myerson, R. (1996). John Nash’s Contribution to Economics. Games and Economic Behavior, 14(2), 287295. http://dx.doi.org/10.1006/game.1996.0053
» http://dx.doi.org/10.1006/game.1996.0053  Nisan, N., Roughgarden, T., Tardos, E., & Vazirani, V. V. (2007). Algorithmic game theory (vol. 1). Cambridge: Cambridge University Press. http://dx.doi.org/10.1017/CBO9780511800481
» http://dx.doi.org/10.1017/CBO9780511800481  Osborne, M. J., & Rubinstein, A. (1994). A course in game theory Cambridge: MIT press.
 Parsons, S., & Wooldridge, M. (2002). Game theory and decision theory in multiagent systems. Autonomous Agents and MultiAgent Systems, 5(3), 243254. http://dx.doi.org/10.1023/A:1015575522401
» http://dx.doi.org/10.1023/A:1015575522401  Porter, R., Nudelman, E., & Shoham, Y. (2008). Simple search methods for finding a Nash equilibrium. Games and Economic Behavior, 63(2), 642662. http://dx.doi.org/10.1016/j.geb.2006.03.015
» http://dx.doi.org/10.1016/j.geb.2006.03.015  Sanfey, A. G. (2007). Social decisionmaking: insights from game theory and neuroscience. Science, 318(5850), 598602. http://dx.doi.org/10.1126/science.1142996 PMid:17962552.
» http://dx.doi.org/10.1126/science.1142996  Spaniel, W. (2014). Game theory 101: the complete textbook CreateSpace.
Publication Dates

Publication in this collection
02 Aug 2021 
Date of issue
2021
History

Received
10 June 2019 
Accepted
28 Dec 2019