Source files¶
Subpackages¶
Submodules¶
nashpy.game module¶
A class for a normal form game

class
nashpy.game.
Game
(*args)[source]¶ Bases:
object
A class for a normal form game.
Parameters:  A, B () – non zero sum games.
 A () – zero sum game.

lemke_howson
(initial_dropped_label)[source]¶ Obtain the Nash equilibria using the Lemke Howson algorithm implemented using integer pivoting.
Algorithm implemented here is Algorithm 3.6 of [Nisan2007].
 Start at the artificial equilibrium (which is fully labeled)
 Choose an initial label to drop and move in the polytope for which the vertex has that label to the edge that does not share that label. (This is implemented using integer pivoting)
 A label will now be duplicated in the other polytope, drop it in a similar way.
 Repeat steps 2 and 3 until have Nash Equilibrium.
Parameters: initial_dropped_label (int) – Returns: equilibria Return type: A tuple.

lemke_howson_enumeration
()[source]¶ Obtain Nash equilibria for all possible starting dropped labels using the lemke howson algorithm. See Game.lemke_howson for more information.
Note: this is not guaranteed to find all equilibria.
Returns: equilibria Return type: A generator

support_enumeration
(non_degenerate=False, tol=1e16)[source]¶ Obtain the Nash equilibria using support enumeration.
Algorithm implemented here is Algorithm 3.4 of [Nisan2007].
 For each k in 1…min(size of strategy sets)
 For each I,J supports of size k
 Solve indifference conditions
 Check that have Nash Equilibrium.
Returns: equilibria Return type: A generator.

vertex_enumeration
()[source]¶ Obtain the Nash equilibria using enumeration of the vertices of the best response polytopes.
Algorithm implemented here is Algorithm 3.5 of [Nisan2007].
 Build best responses polytopes of both players
 For each vertex pair of both polytopes
 Check if pair is fully labelled
 Return the normalised pair
Returns: equilibria Return type: A generator.