egttools.games.NormalFormNetworkGame¶
- class NormalFormNetworkGame(*args, **kwargs)¶
Bases:
AbstractSpatialGameOverloaded function.
__init__(self: egttools.numerical.numerical_.games.NormalFormNetworkGame, nb_rounds: typing.SupportsInt | typing.SupportsIndex, payoff_matrix: typing.Annotated[numpy.typing.NDArray[numpy.float64], “[m, n]”, “flags.c_contiguous”]) -> None
Normal-form network game.
- Parameters:
nb_rounds (int) – Number of repeated rounds for each pairwise encounter.
payoff_matrix (numpy.ndarray) – Payoff matrix specifying the outcomes for all strategy pairs.
__init__(self: egttools.numerical.numerical_.games.NormalFormNetworkGame, nb_rounds: typing.SupportsInt | typing.SupportsIndex, payoff_matrix: typing.Annotated[numpy.typing.NDArray[numpy.float64], “[m, n]”, “flags.c_contiguous”], strategies: list) -> None
Normal-form game with custom strategy list.
- Parameters:
nb_rounds (int) – Number of rounds of interaction.
payoff_matrix (numpy.ndarray) – Payoff matrix used for each pairwise encounter.
strategies (list[AbstractNFGStrategy]) – List of strategy instances.
Methods
Calculates the level of cooperation in a given neighborhood.
Computes fitness of a strategy given a neighborhood configuration.
Recalculates the expected payoff matrix based on current strategies.
Returns the expected payoffs for each strategy.
List of strategies currently active in the game.
- __init__(*args, **kwargs)¶
Overloaded function.
__init__(self: egttools.numerical.numerical_.games.NormalFormNetworkGame, nb_rounds: typing.SupportsInt | typing.SupportsIndex, payoff_matrix: typing.Annotated[numpy.typing.NDArray[numpy.float64], “[m, n]”, “flags.c_contiguous”]) -> None
Normal-form network game.
- Parameters:
nb_rounds (int) – Number of repeated rounds for each pairwise encounter.
payoff_matrix (numpy.ndarray) – Payoff matrix specifying the outcomes for all strategy pairs.
__init__(self: egttools.numerical.numerical_.games.NormalFormNetworkGame, nb_rounds: typing.SupportsInt | typing.SupportsIndex, payoff_matrix: typing.Annotated[numpy.typing.NDArray[numpy.float64], “[m, n]”, “flags.c_contiguous”], strategies: list) -> None
Normal-form game with custom strategy list.
- Parameters:
nb_rounds (int) – Number of rounds of interaction.
payoff_matrix (numpy.ndarray) – Payoff matrix used for each pairwise encounter.
strategies (list[AbstractNFGStrategy]) – List of strategy instances.
- __new__(**kwargs)¶
- __str__(self: egttools.numerical.numerical_.games.NormalFormNetworkGame) str¶
- calculate_cooperation_level_neighborhood(self: egttools.numerical.numerical_.games.NormalFormNetworkGame, strategy_index: SupportsInt | SupportsIndex, state: Annotated[numpy.typing.NDArray[numpy.uint64], '[m, 1]']) float¶
Calculates the level of cooperation in a given neighborhood.
- Parameters:
strategy_index (int) – Focal strategy.
state (numpy.ndarray) – Neighbor strategy counts.
- Returns:
Level of cooperation.
- Return type:
- calculate_fitness(self: egttools.numerical.numerical_.games.NormalFormNetworkGame, strategy_index: SupportsInt | SupportsIndex, state: Annotated[numpy.typing.ArrayLike, numpy.uint64, '[m, 1]']) float¶
Computes fitness of a strategy given a neighborhood configuration.
- Parameters:
strategy_index (int) – Strategy whose fitness will be computed.
state (numpy.ndarray) – Vector representing neighborhood strategy counts.
- Returns:
Fitness value.
- Return type:
- calculate_payoffs(self: egttools.numerical.numerical_.games.NormalFormNetworkGame) None¶
Recalculates the expected payoff matrix based on current strategies.
- expected_payoffs(self: egttools.numerical.numerical_.games.NormalFormNetworkGame) Annotated[numpy.typing.NDArray[numpy.float64], '[m, n]']¶
Returns the expected payoffs for each strategy.
- nb_rounds(self: egttools.numerical.numerical_.games.NormalFormNetworkGame) int¶
- nb_strategies(self: egttools.numerical.numerical_.games.NormalFormNetworkGame) int¶
- strategies(self: egttools.numerical.numerical_.games.NormalFormNetworkGame) list¶
List of strategies currently active in the game.
- __annotations__ = {}¶