Purpose Usage Client/Server Algorithms Future
Game Theory Explorer -Software for the Applied Game Theorist
Bernhard von Stengel
Department of MathematicsLondon School of Economics
July 2013
1
Purpose Usage Client/Server Algorithms Future
Overview
Explain and demonstrate GTE (Game Theory Explorer),
open-source software, under development, for
creating and analyzing non-cooperative games
in strategic form:B
I
II
l
1
4
3
r
6
5
4
2T
3
and extensive form:l
2 4
r r
II
l
6
B
3
3
5
I
T
1
4
2
Purpose Usage Client/Server Algorithms Future
Intended users
Applied game theorists:
• experimental economists (analyze game before runningexperiment)
• game-theoretic modelers in biology, political science, . . .
• in general: non-experts in equilibrium analysis
⇒ design goal: ease of use
Researchers in game theory:
• testing conjectures about equilibria
• as contributors: designers of game theory algorithms
3
Purpose Usage Client/Server Algorithms Future
History: Gambit
GTE now part of the Gambit open-source software development,http://www.gambit-project.org
2011 and 2012 supported by Google Summer of Code (GSoC)
Gambit software started ∼1990 with Richard McKelvey (Caltech)to analyze games for experiments, developed since 1994 withAndy McLennan into C++ package, since 2001 maintained byTed Turocy (Norwich, UK).
• Gambit must be installed on PC/Mac/Linux, with GUI(graphical user interface) using platform-independent wxWidget
• has collection of algorithms for computing Nash equilibria
• offers scripting language, now developed using Python
4
Purpose Usage Client/Server Algorithms Future
Features of GTE
GTE independent browser-based development:
• no software installation needed, low barrier to entry
• nicer GUI than Gambit
• export to graphical formats
Disadvantages:
• manual storing / loading of files for security reasons
• long computations require local server installation (same GUI)
Contributors:
David Avis (lrs), Rahul Savani (PhD 2006), Mark Egesdal (2011),Alfonso Gomez-Jordana, Martin Prause (GSoC 2011, 2012)
5
Purpose Usage Client/Server Algorithms Future
Features of GTE
GTE independent browser-based development:
• no software installation needed, low barrier to entry
• nicer GUI than Gambit
• export to graphical formats
Disadvantages:
• manual storing / loading of files for security reasons
• long computations require local server installation (same GUI)
Contributors:
David Avis (lrs), Rahul Savani (PhD 2006), Mark Egesdal (2011),Alfonso Gomez-Jordana, Martin Prause (GSoC 2011, 2012)
5
Purpose Usage Client/Server Algorithms Future
Features of GTE
GTE independent browser-based development:
• no software installation needed, low barrier to entry
• nicer GUI than Gambit
• export to graphical formats
Disadvantages:
• manual storing / loading of files for security reasons
• long computations require local server installation (same GUI)
Contributors:
David Avis (lrs), Rahul Savani (PhD 2006), Mark Egesdal (2011),Alfonso Gomez-Jordana, Martin Prause (GSoC 2011, 2012)
5
Purpose Usage Client/Server Algorithms Future
Example of a game
2× 2 game in strategic form:
B
I
II
l
1
4
3
r
6
5
4
2T
3
with pure best responses
and equilibrium probabilities
6
Purpose Usage Client/Server Algorithms Future
Example of a game
2× 2 game in strategic form:
B
I
II
l
1
4
3
r
6
5
4
2T
3
with pure best responses
and equilibrium probabilities
6
Purpose Usage Client/Server Algorithms Future
Example of a game
2× 2 game in strategic form:
B
I
II
l
1
4
3
r
6
5
4
2T
3
0
1
0 1
with pure best responses
and equilibrium probabilities
6
Purpose Usage Client/Server Algorithms Future
Extensive (= tree) form of the game
Players move sequentially,
information sets show lack of information about game state:
l
2 4
r r
II
l
6
B
3
3
5
I
T
1
4
7
Purpose Usage Client/Server Algorithms Future
Commitment (leadership) game
Changed game when player I can commit:
2
l
3
r
5
4
II
b
T
1
I
a
II
46
B
3
Subgame perfect equilibrium: (T , l-b)
Other equilibria:
8
Purpose Usage Client/Server Algorithms Future
Commitment (leadership) game
Changed game when player I can commit:
2
l
3
r
5
4
II
b
T
1
I
a
II
46
B
3
Subgame perfect equilibrium: (T , l-b)
Other equilibria:
8
Purpose Usage Client/Server Algorithms Future
Commitment (leadership) game
Changed game when player I can commit:
2
l
3
r
5
4
II
b
T
1
I
a
II
46
B
3
1
B4
I
6 4
l−a
43
2
5
l−b r−a
3
4
5 3
II
2 1
3
T
6
r−b
Subgame perfect equilibrium: (T , l-b)
Other equilibria:
8
Purpose Usage Client/Server Algorithms Future
Commitment (leadership) game
Changed game when player I can commit:
2
l
3
r
5
4
II
b
T
1
I
a
II
46
B
3
1
B4
I
6 4
l−a
43
2
5
l−b r−a
3
4
5 3
II
2 1
3
T
6
r−b
Subgame perfect equilibrium: (T , l-b)
Other equilibria:
8
Purpose Usage Client/Server Algorithms Future
Commitment (leadership) game
Changed game when player I can commit:
2
l
3
r
5
4
II
b
T
1
I
a
II
46
B
3
1
B4
I
6 4
l−a
43
2
5
l−b r−a
3
4
5 3
II
2 1
3
T
6
r−b
0010
1
0
Subgame perfect equilibrium: (T , l-b)
Other equilibria:
8
Purpose Usage Client/Server Algorithms Future
Commitment (leadership) game
Changed game when player I can commit:
2
l
3
r
5
4
II
b
T
1
I
a
II
46
B
3
1
B4
I
6 4
l−a
43
2
5
l−b r−a
3
4
5 3
II
2 1
3
T
6
r−b
1000
0
1
Subgame perfect equilibrium: (T , l-b)
Other equilibria: (B, r -b)
8
Purpose Usage Client/Server Algorithms Future
Commitment (leadership) game
Changed game when player I can commit:
2
l
3
r
5
4
II
b
T
1
I
a
II
46
B
3
1
B4
I
6 4
l−a
43
2
5
l−b r−a
3
4
5 3
II
2 1
3
T
6
r−b
1/201/20
0
1
Subgame perfect equilibrium: (T , l-b)
Other equilibria: (B, r -b), (B, 12 l-b 1
2r -b)
8
Purpose Usage Client/Server Algorithms Future
Commitment (leadership) game
Changed game when player I can commit:
2
l
3
r
5
4
II
b
T
1
I
a
II
46
B
3
1
B4
I
6 4
l−a
43
2
5
l−b r−a
3
4
5 3
II
2 1
3
T
6
r−b
001/21/2
1
0
Subgame perfect equilibrium: (T , l-b)
Other equilibria: (B, r -b), (B, 12 l-b 1
2r -b), (T , 12 l-a 1
2 l-b)
8
Purpose Usage Client/Server Algorithms Future
GTE output for the commitment game
9
Purpose Usage Client/Server Algorithms Future
Demonstration of GTE
Preceding games:
• 2× 2 game in strategic form
• extensive form of that game
• commitment game, extensive and strategic form
Next: create from scratch a more complicated extensive game
• imperfectly observable commitment
10
Purpose Usage Client/Server Algorithms Future
Demonstration of GTE
Preceding games:
• 2× 2 game in strategic form
• extensive form of that game
• commitment game, extensive and strategic form
Next: create from scratch a more complicated extensive game
• imperfectly observable commitment
10
Purpose Usage Client/Server Algorithms Future
Game with imperfectly observable commitment
l
II
6
II
3
r
63
1
1
a
3
4
l
1/100 99/100
a
I
r
b
4
5
B
4
b
2
99/100
5
4
T
1/100
3
2
11
Purpose Usage Client/Server Algorithms Future
Game tree drawn left to right
l
T
,
6
II
,
3
r
,
1
II3 1
,
6
,
3
4
l
1/100
b
a
,
I
r
b
4
5
a
4
,
99/100
2
1/100B
5
4
,
99/100
3
2
12
Purpose Usage Client/Server Algorithms Future
GTE output for imperfectly observable commitment
13
Purpose Usage Client/Server Algorithms Future
More complicated signaling game, 5 equilibria
0
1/2
−2
yifN
1/2
0
8
1
yifY
yifN
yifY
10
−3 −1
1/2
nifY
1/2
Nn
1
0
−3
Yn
2
1
nifN
nifY
1/2
5
1/2
−210
−1
−1
1/2
Ni
0
1/2
0
Yi
1/2
2
0
−2
−1
−5
0
−4
nifN
1/2
−3
14
Purpose Usage Client/Server Algorithms Future
Some more strategic-form games
For studying more complicated games:
generate game matrices as text files, copy and paste intostrategic-form input.
Future extension:
Automatic generation via command lines or “worksheets” forscripting, connection with Python and Gambit
15
Purpose Usage Client/Server Algorithms Future
GTE software architecture
Client (your computer with a browser):
• GUI: JavaScript (Flash’s variant called ActionScript)
• store and load game described in XML format
• export to graphic formats (.png or XFIG→ EPS, PDF)
• for algorithm: send XML game description to server
Server (hosting client program and equilibrium solvers):
• converts XML to Java data structure (similar to GUI)
• solution algorithms as binaries (e.g. C program lrs), sendresults as text back to client
⇒ cannot use restrictive public servers like “Google App Engine”
16
Purpose Usage Client/Server Algorithms Future
GTE software architecture
Client (your computer with a browser):
• GUI: JavaScript (Flash’s variant called ActionScript)
• store and load game described in XML format
• export to graphic formats (.png or XFIG→ EPS, PDF)
• for algorithm: send XML game description to server
Server (hosting client program and equilibrium solvers):
• converts XML to Java data structure (similar to GUI)
• solution algorithms as binaries (e.g. C program lrs), sendresults as text back to client
⇒ cannot use restrictive public servers like “Google App Engine”
16
Purpose Usage Client/Server Algorithms Future
High usage of computation resources
Finding all equilibria takes exponential time
⇒ for large games, server should run on your computer, not apublic one
achieved by local server installation (“Jetty”), requiresinstallation, but offers same user interface.
17
Purpose Usage Client/Server Algorithms Future
Algorithm: Finding all equilibria
For two-player games in strategic form, all Nash equilibria can befound as follows:
• payoffs define inequalities for “best response polyhedra”
• compute all vertices of these polyhedra (using lrs by DavidAvis, requires arbitrary precision integers)
• match vertices for complementarity (LCP)
• find maximal cliques of matching vertices for equilibriumcomponents
18
Purpose Usage Client/Server Algorithms Future
Example
II
B0
1
2
3
1
I
0
l
3
r
2
T
T
2
II1
0
0
3l
B
r
I
2
19
Purpose Usage Client/Server Algorithms Future
Best response polyhedron of player I
B0
1
2
3
1
0
l
3
r
2
T
III
prob(r)10
payoff player I
20
Purpose Usage Client/Server Algorithms Future
Best response polyhedron of player I
B0
1
2
3
1
0
l
3
r
2
T
III
Tprob(r)
10
payoff player I
20
Purpose Usage Client/Server Algorithms Future
Best response polyhedron of player I
B0
1
2
3
1
0
l
3
r
2
T
III
B
prob(r)10
payoff player I
20
Purpose Usage Client/Server Algorithms Future
Best response polyhedron of player I
B0
1
2
3
1
0
l
3
r
2
T
III
B
Tprob(r)
10
payoff player I
20
Purpose Usage Client/Server Algorithms Future
Best response polyhedron of player II
B0
1
2
3
1
0
l
3
r
2
T
III
l
payoff player II
10prob(B)
B
Tprob(r)
10
payoff player I
20
Purpose Usage Client/Server Algorithms Future
Best response polyhedron of player II
B0
1
2
3
1
0
l
3
r
2
T
III
r
payoff player II
10prob(B)
B
Tprob(r)
10
payoff player I
20
Purpose Usage Client/Server Algorithms Future
Best response polyhedron of player II
B0
1
2
3
1
0
l
3
r
2
T
III
r
l
payoff player II
10prob(B)
B
Tprob(r)
10
payoff player I
20
Purpose Usage Client/Server Algorithms Future
Label with best responses and unplayed strategies
B0
1
2
3
1
0
l
3
r
2
T
III
l=0r=0B=0 T=0
r
l
payoff player II
10prob(B)
B
Tprob(r)
10
payoff player I
20
Purpose Usage Client/Server Algorithms Future
Equilibrium = all labels T ,B, l, r present
B0
1
2
3
1
0
l
3
r
2
T
III
l=0r=0B=0 T=0
r
l
payoff player II
10prob(B)
B
Tprob(r)
10
payoff player I
20
Purpose Usage Client/Server Algorithms Future
Equilibrium with multiple label r (degeneracy)
B0
1
2
3
1
0
l
3
r
2
T
III
l=0r=0B=0 T=0
r
l
payoff player II
10prob(B)
B
Tprob(r)
10
payoff player I
20
Purpose Usage Client/Server Algorithms Future
Equilibrium with multiple label B (degeneracy)
B0
1
2
3
1
0
l
3
r
2
T
III
l=0r=0B=0 T=0
r
l
payoff player II
10prob(B)
B
Tprob(r)
10
payoff player I
20
Purpose Usage Client/Server Algorithms Future
⇒ equilibrium component with labels T and B, l, r
B0
1
2
3
1
0
l
3
r
2
T
III
l=0r=0B=0 T=0
r
l
payoff player II
10prob(B)
B
Tprob(r)
10
payoff player I
20
Purpose Usage Client/Server Algorithms Future
Equilibrium components via cliques
In degenerate games (= vertices with zero basic variables, occurfor game trees), get convex combinations of “exchangeable”equilibria. Recognized as cliques of matching vertex pairs:
1 2 3 4
1
2
3
4
v v v v
u
u
u
u
table of extreme equilibria geometry
21
Purpose Usage Client/Server Algorithms Future
Algorithm: Sequence form for game trees
Example of game tree:
10
L
V
2
a
q
C
20
c
U
ts
d
20 50
b
15
t
15
V
s
1
2
D
U
R
20
1
p
10
30
2
DC
5
15 −5
22
Purpose Usage Client/Server Algorithms Future
Exponentially large strategic formStrategy of a player:specifies a move for every information set of that player(except for unspecified moves ∗ at unreachable information sets)
⇒ exponential number of strategies
ap∗ aq∗ b∗∗ c∗s c∗t d∗∗
L∗C 5 5 10 20 50 5L∗D 5 5 20 30 15 5RUC 10 20 10 20 50 5RUD 10 20 20 30 15 5RVC 15 –5 10 20 50 5RVD 15 –5 20 30 15 5
23
Purpose Usage Client/Server Algorithms Future
Sequences instead of strategies
Sequence specifies moves only along path in game tree⇒ linear number of sequences, sparse payoff matrix A
∅ a b c d ap aq cs ct
∅ 5L 5RRU 10 20RV 15 –5C 10 20 50D 20 30 15
Expected payoff x>Ay , play rows with x ≥ 0 subject to Ex = e,
play columns with y ≥ 0 subject to Fy = f .24
Purpose Usage Client/Server Algorithms Future
Play as behavior strategy
Given: x ≥ 0 with Ex = e.
Move L is last move of unique sequence,say PQL, where one row of Ex = e saysxPQL + xPQR = xPQ
⇒ behavior-probability(L) =xPQL
xPQ
P
RL R
1
1
2
L
Q
1
Required assumption of perfect recall[Kuhn 1953, Selten 1975]:Each node in an information set ispreceded by same sequence, here PQ,of the player’s own earlier moves.
25
Purpose Usage Client/Server Algorithms Future
Play as behavior strategy
Given: x ≥ 0 with Ex = e.
Move L is last move of unique sequence,say PQL, where one row of Ex = e saysxPQL + xPQR = xPQ
⇒ behavior-probability(L) =xPQL
xPQ
P
RL R
1
1
2
L
Q
1
Required assumption of perfect recall[Kuhn 1953, Selten 1975]:Each node in an information set ispreceded by same sequence, here PQ,of the player’s own earlier moves.
25
Purpose Usage Client/Server Algorithms Future
Linear-sized sequence form
Input: Two-person game tree with perfect recall.
Theorem [Romanovskii 1962, vS 1996]
The equilibria of a zero-sum game are the solutions to a LinearProgram (LP) of linear size in the size of the game tree.
Theorem [Koller/Megiddo/vS 1996, vS/Elzen/Talman 2002]
The equilibria of a non-zero-sum game are the solutions to aLinear Complementarity Problem (LCP) of linear size.
A sample equilibrium is found by Lemke’s algorithm.
This algorithm mimicks the Harsanyi–Selten tracing procedure andfinds a normal-form perfect equilibrium.
26
Purpose Usage Client/Server Algorithms Future
Linear-sized sequence form
Input: Two-person game tree with perfect recall.
Theorem [Romanovskii 1962, vS 1996]
The equilibria of a zero-sum game are the solutions to a LinearProgram (LP) of linear size in the size of the game tree.
Theorem [Koller/Megiddo/vS 1996, vS/Elzen/Talman 2002]
The equilibria of a non-zero-sum game are the solutions to aLinear Complementarity Problem (LCP) of linear size.
A sample equilibrium is found by Lemke’s algorithm.
This algorithm mimicks the Harsanyi–Selten tracing procedure andfinds a normal-form perfect equilibrium.
26
Purpose Usage Client/Server Algorithms Future
Planned Extensions
Improve and convert GUI to pure JavaScript (Flash is phased out)
Further solution algorithms:
• EEE [Audet/Hansen/Jaumard/Savard 2001], needs exactarithmetic
• Path-following algorithms (Lemke-Howson, variants of Lemke)
• n-player games: simplicial subdivision, polynomial inequalities
Scripting features:
• connect with Gambit and Python
• database of reproducible computational experiments
27
Purpose Usage Client/Server Algorithms Future
Implementation challenges
Demonstrating that an algorithm works (for a publication)
• does not usually create robust and easy-to-use software
Who should write such software?
• MSc thesis: not enough time
• PhD thesis / research grant: not scientific enough
• ideal: researcher creating “showcase” of their work
Example: Rahul Savani’s http://banach.lse.ac.uk/
• student programmers with Google Summer of Code: insecurefunding, but helps find volunteer open-source contributors.
28
Purpose Usage Client/Server Algorithms Future
Implementation challenges
Demonstrating that an algorithm works (for a publication)
• does not usually create robust and easy-to-use software
Who should write such software?
• MSc thesis: not enough time
• PhD thesis / research grant: not scientific enough
• ideal: researcher creating “showcase” of their work
Example: Rahul Savani’s http://banach.lse.ac.uk/
• student programmers with Google Summer of Code: insecurefunding, but helps find volunteer open-source contributors.
28
Purpose Usage Client/Server Algorithms Future
Summary
GTE – Game theory explorer
• helps create, draw, and analyze game-theoretic models
• user-friendly, browser-based, low barriers to entry
• open-source, work in progress, needs contributors
https://github.com/gambitproject/gte/wiki/_pages
Thank you!
29
Purpose Usage Client/Server Algorithms Future
Summary
GTE – Game theory explorer
• helps create, draw, and analyze game-theoretic models
• user-friendly, browser-based, low barriers to entry
• open-source, work in progress, needs contributors
https://github.com/gambitproject/gte/wiki/_pages
Thank you!
29