egttools.games.CRDGameTU¶
- class CRDGameTU(self: egttools.numerical.numerical_.games.CRDGameTU, endowment: SupportsInt | SupportsIndex, threshold: SupportsInt | SupportsIndex, nb_rounds: SupportsInt | SupportsIndex, group_size: SupportsInt | SupportsIndex, risk: SupportsFloat | SupportsIndex, tu: egttools.numerical.numerical_.distributions.TimingUncertainty, strategies: list)¶
Bases:
AbstractGameCollective risk dilemma with timing uncertainty.
- Parameters:
endowment (int) – Initial endowment of each player.
threshold (int) – Collective target required to avoid risk.
nb_rounds (int) – Maximum number of rounds.
group_size (int) – Number of players per group.
risk (float) – Probability of failure if the target is not met.
tu (TimingUncertainty) – Object modeling timing uncertainty.
strategies (list[AbstractCRDStrategy]) – List of strategy instances.
Methods
Computes the fitness of a strategy in a given population state.
Calculates group achievement based on a stationary distribution.
Computes the expected payoffs for each strategy across all group configurations.
Computes contribution polarization in a given population state.
Computes contribution polarization among successful groups.
Calculates group achievement for a given population state.
Returns the payoff of a strategy given a group composition.
Returns the matrix of expected payoffs.
Executes one iteration of the CRD game using a specific group composition.
Saves the payoff matrix to a text file.
Attributes
List of strategy objects participating in the game.
- __init__(self: egttools.numerical.numerical_.games.CRDGameTU, endowment: SupportsInt | SupportsIndex, threshold: SupportsInt | SupportsIndex, nb_rounds: SupportsInt | SupportsIndex, group_size: SupportsInt | SupportsIndex, risk: SupportsFloat | SupportsIndex, tu: egttools.numerical.numerical_.distributions.TimingUncertainty, strategies: list) None¶
Collective risk dilemma with timing uncertainty.
- Parameters:
endowment (int) – Initial endowment of each player.
threshold (int) – Collective target required to avoid risk.
nb_rounds (int) – Maximum number of rounds.
group_size (int) – Number of players per group.
risk (float) – Probability of failure if the target is not met.
tu (TimingUncertainty) – Object modeling timing uncertainty.
strategies (list[AbstractCRDStrategy]) – List of strategy instances.
- __new__(**kwargs)¶
- __str__(self: egttools.numerical.numerical_.games.CRDGameTU) str¶
- calculate_fitness(self: egttools.numerical.numerical_.games.CRDGameTU, player_strategy: SupportsInt | SupportsIndex, pop_size: SupportsInt | SupportsIndex, population_state: Annotated[numpy.typing.NDArray[numpy.uint64], '[m, 1]']) float¶
Computes the fitness of a strategy in a given population state.
- Parameters:
player_strategy (int) – Index of the focal strategy.
pop_size (int) – Total population size.
population_state (numpy.ndarray) – Vector of strategy counts.
- Return type:
- calculate_group_achievement(self: egttools.numerical.numerical_.games.CRDGameTU, population_size: SupportsInt | SupportsIndex, stationary_distribution: Annotated[numpy.typing.NDArray[numpy.float64], '[m, 1]']) float¶
Calculates group achievement based on a stationary distribution.
- calculate_payoffs(self: egttools.numerical.numerical_.games.CRDGameTU) Annotated[numpy.typing.NDArray[numpy.float64], '[m, n]']¶
Computes the expected payoffs for each strategy across all group configurations.
- Returns:
Matrix of expected payoffs.
- Return type:
- calculate_polarization(self: egttools.numerical.numerical_.games.CRDGameTU, population_size: SupportsInt | SupportsIndex, population_state: Annotated[numpy.typing.NDArray[numpy.float64], '[m, 1]']) Annotated[numpy.typing.NDArray[numpy.float64], '[3, 1]']¶
Computes contribution polarization in a given population state.
- calculate_polarization_success(self: egttools.numerical.numerical_.games.CRDGameTU, population_size: SupportsInt | SupportsIndex, population_state: Annotated[numpy.typing.NDArray[numpy.float64], '[m, 1]']) Annotated[numpy.typing.NDArray[numpy.float64], '[3, 1]']¶
Computes contribution polarization among successful groups.
- calculate_population_group_achievement(self: egttools.numerical.numerical_.games.CRDGameTU, population_size: SupportsInt | SupportsIndex, population_state: Annotated[numpy.typing.NDArray[numpy.uint64], '[m, 1]']) float¶
Calculates group achievement for a given population state.
- nb_strategies(self: egttools.numerical.numerical_.games.CRDGameTU) int¶
- payoff(self: egttools.numerical.numerical_.games.CRDGameTU, strategy: SupportsInt | SupportsIndex, group_composition: collections.abc.Sequence[SupportsInt | SupportsIndex]) float¶
Returns the payoff of a strategy given a group composition.
- payoffs(self: egttools.numerical.numerical_.games.CRDGameTU) Annotated[numpy.typing.NDArray[numpy.float64], '[m, n]']¶
Returns the matrix of expected payoffs.
- play(self: egttools.numerical.numerical_.games.CRDGameTU, arg0: collections.abc.Sequence[SupportsInt | SupportsIndex], arg1: collections.abc.Sequence[SupportsFloat | SupportsIndex]) None¶
Executes one iteration of the CRD game using a specific group composition.
- Parameters:
group_composition (numpy.ndarray) – Number of players per strategy in the group.
game_payoffs (numpy.ndarray) – Output vector for player payoffs.
- save_payoffs(self: egttools.numerical.numerical_.games.CRDGameTU, arg0: str) None¶
Saves the payoff matrix to a text file.
- Parameters:
file_name (str) – Path to the output file.
- type(self: egttools.numerical.numerical_.games.CRDGameTU) str¶
- __annotations__ = {}¶
- property endowment¶
- property group_size¶
- property min_rounds¶
- property nb_states¶
- property risk¶
- property strategies¶
List of strategy objects participating in the game.
- property target¶