localint¶
-
class
quantecon.game_theory.localint.LocalInteraction(payoff_matrix, adj_matrix)[source]¶ Bases:
objectClass representing the local interaction model.
Parameters: - payoff_matrixarray_like(float, ndim=2)
The payoff matrix of the symmetric two-player game played in each interaction.
- adj_matrixarray_like(float, ndim=2)
The adjacency matrix of the network. Non constant weights and asymmetry in interactions are allowed.
Attributes: - playerslist(Player)
The list consisting of all players with the given payoff matrix.
- adj_matrixscipy.sparse.csr.csr_matrix(float, ndim=2)
See Parameters.
- Nscalar(int)
The number of players.
- num_actionsscalar(int)
The number of actions available to each player.
Methods
play([revision, actions, player_ind_seq, ...])Return a new action profile which is updated by playing the game num_reps times. time_series(ts_length[, revision, actions, ...])Return an array representing time series of each player's actions. -
play(revision='simultaneous', actions=None, player_ind_seq=None, num_reps=1, **options)[source]¶ Return a new action profile which is updated by playing the game num_reps times.
Parameters: - revisionstr, optional(default=’simultaneous’)
The way to revise the action profile. If simulataneous, all players’ actions will be updated simultaneously. If asynchronous, only designated players’ actions will be updated. str in {‘simultaneous’, ‘asynchronous’}.
- actionstuple(int) or list(int), optional(default=None)
The action profile in the first period. If None, selected randomly.
- player_ind_seqarray_like(int), optional(default=None)
The index of players who take actions. If None, all players take actions.
- num_repsscalar(int), optional(default=1)
The number of iterations.
- **optionsKeyword arguments passed to the best response method and
other methods.
Returns: - tuple(int)
The action profile after iterations.
-
time_series(ts_length, revision='simultaneous', actions=None, player_ind_seq=None, **options)[source]¶ Return an array representing time series of each player’s actions.
Parameters: - ts_lengthscalar(int)
The number of iterations.
- revision{‘simultaneous’, ‘asynchronous’}(default=’simultaneous’)
The way to revise the action profile. If simulataneous, all players’ actions will be updated simultaneously. If asynchronous, only designated players’ actions will be updated. str in {‘simultaneous’, ‘asynchronous’}.
- actionstuple(int), optional(default=None)
The action profile in the first period. If None, selected randomly.
- player_ind_seqarray_like, optional(default=None)
The sequence of player_ind`(see `play Parameters) when the revision is ‘asynchronous’. If None, selected randomly.
- **optionsKeyword arguments passed to the best response method and
other methods.
Returns: - Array_like(int)
The array representing time series of each player’s actions.