lrsnash(1)
β¨ lrsnash β the manual page, bestie edition π
okay so. you're in the lrslib section of the manual (lrslib 7.3), and this is the page for lrsnash β the tool that finds Nash equilibria in 2-person games. it's giving game theory main character energy and i'm obsessed π
πΈ Name πΈ
lrsnash: compute Nash-equibria in 2-person games. no cap, that's the whole job description.
β¨ Synopsis β¨
lrsnash [options...] [input-file]
lrsnash1 [options...] [input-file]
lrsnash2 [options...] [input-file]
nashdemo
options:
-v,--verboseβ prints a trace of the solution process. it literally narrates its own journey π«Ά-d,--debugβ dumps lots of information for debugging. like, a lot a lot. π-p,--printgameβ prints the payoff matrix for the game-s,--standardβ promise that input files have standard structure (you're pinky-promising here, bestie π€)-o,--outfile <file>β send output to <file>-h,--helpβ prints this text
short options can be grouped, as in'-ps'and'-do out.txt'β cute and efficient, we love to see it β¨
π Description π
these C programs are distributed as part of the lsrslib[2] package and must be compiled with it. like, they don't do the solo thing. they come as a set π₯
so here's the setup: Alice has a payoff matrix A and Bob has a playoff matrix B, both of dimension m by n. Alice assigns probabilities x to the rows and Bob y to the columns. Alice receives payoff x^T A y and Bob receives x^T B y. a Nash equilibriam occurs for pairs x,y for which neither player can improve their expected payoff by unilateraly changing strategies. iconic behaviour honestly π
lrsnash is an application of lrs for finding Nash-equilibria in 2-person matrix games using a method described in [1]. it uses GMP exact extended precision arithmetic β precision queen, no rounding drama π
lrsnash1 is the same as lrsnash except that it uses 64 bit exact arithmetic and terminates if overflow is detected. it is about 3-4 times faster. speed demon energy β‘
lrsnash2 is the same as lrsnash except that it uses 128 bit exact arithmetic and terminates if overflow is detected. it is about twice as fast. it requires a C compiler with __int128 support (eg. gcc v. 4.6.0 or later). fancy π
nashdemo is a simple template for lrsnash. it builds two 3x4 matrices A and B and computes their equilibria. a lil demo, a lil appetizer π
heads up bestie: the running time may be significantly different depending on the order of the two matrices in the input. for large problems it may be advantageous to runlrsnashtwice in parallel with the matrices in different orders. there is also a more complex legacy input format recognized bylrsnashthat is described in [1]. π
π¦ File formats π¦
the input file consists of two integers m and n on line 1 followed by two mxn payoff matrices A and B:
m n
A (row by row)
B (row by row)
π Example π
the input file game has two 3x2 payoff matrices:
%cat game
3 2
0 6
2 5
3 3
1 0
0 2
4 3
% lrsnash game
2 1/3 2/3 4
1 2/3 1/3 0 2/3
2 2/3 1/3 3
1 0 1/3 2/3 8/3
2 1 0 3
1 0 0 1 4
*Number of equilibria found: 3
*Player 1: vertices=5 bases=5 pivots=8
*Player 2: vertices=3 bases=1 pivots=8
Interpretation β there are 3 Nash equilibria. for the first one:
2 1/3 2/3 4
Bob (player 2) plays column 1 and 2 with probablilities y=(1/3, 2/3) and the payoff to Alice (player 1) is 4.
1 2/3 1/3 0 2/3
Alice plays rows 1,2,3 with probabilities x=(2/3, 1/3, 0) and the payoff to Bob is 2/3. slay π
π Notes π
- D. Avis, G. Rosenberg, R. Savani, B. von Stengel, Enumeration of Nash Equilibria for Two-Player Games, Economic Theory 42(2009) 9-37
- User's guide for lrslib
http://cgm.cs.mcgill.ca/%7Eavis/C/lrslib/USERGUIDE.html
π Authors π
David Avis and Terje Lensberg β absolute legends, fr fr π
π See also π
okay that's the whole page bestie, you're fully caught up π«Ά this was lrsnash(1) from lrslib 7.3, dated January 2024 (version 2024.1.31) β go forth and find some equilibria, no one can stop you now β¨ππ
π¦ where this page comes from
- debian trixie: lrslib 0.73-2+b1
- fedora 43: lrslib-utils 7.3-6.fc43 Β· GPL-2.0-or-later
- fedora 43: lrslib-utils 7.3a-1.fc43 Β· GPL-2.0-or-later
- fedora 44: lrslib-utils 7.3a-3.fc44 Β· GPL-2.0-or-later
- ubuntu questing: lrslib 0.73-3
- ubuntu resolute: lrslib 0.73-4
- ubuntu stonking: lrslib 0.73-4
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms