Use Introspection DynamicsΒΆ

Introspection dynamics is implemented in Nashpy as a method on the Game class:

>>> import nashpy as nash
>>> import numpy as np
>>> A = np.array([[3, 1], [1, 2]])
>>> B = np.array([[3, 6], [5, 2]])
>>> game = nash.Game(A, B)

The introspection_dynamics method returns a generator of a given collection of generations:

>>> np.random.seed(0)
>>> steps = game.introspection_dynamics(number_of_iterations=50, beta=.2)
>>> for actions in steps:
...     print(actions)
[0 1]
[0 1]
[0 1]
...
[1 1]
[1 0]
[1 1]

Note that this process is stochastic:

>>> np.random.seed(2)
>>> steps = game.introspection_dynamics(number_of_iterations=50, beta=.2)
>>> for actions in steps:
...     print(actions)
[0 1]
[0 1]
[0 1]
...
[0 1]
[0 1]
[0 1]