Back to articles
I spent 8 weeks building a Nash Equilibrium calculator from scratch in Python

I spent 8 weeks building a Nash Equilibrium calculator from scratch in Python

via Dev.toVyas Barath Krishnan

Hey everyone, I am someone who has been wanting to apply computer science into economics and mathematics and hence I decided to build a Nash Equilibrium calculator of sorts using Python and other libraries in Python like numpy and scipy.optimize. The solver calculates all pure and mixed nash equilibria using the support enumeration algorithm. It also uses linear programming, which I did through the HiGHS solver, for the iterated elimination of strictly dominated strategies. I also built a small sub feature where the tool calculates game values for zero sum games using the Von Neumann Minimax theorem by identifying the Pareto optimal outcomes and hence calculating the social welfare loss. To make it visually easy to read, I used the rich library to build a terminal UI that color-codes the matrices. This project took me almost 8 weeks to complete and I had to force myself to not use AI at all and hence the code might be a bit wonky. Nonetheless, would be great if y'all could check it out

Continue reading on Dev.to

Opens in a new tab

Read Full Article
6 views

Related Articles