egttools.utils.transform_payoffs_to_pairwise

transform_payoffs_to_pairwise(nb_strategies, game)[source]

This function transform a payoff matrix in full format to a pairwise format.

The transformation should only be done if it is possible to assume that there will always be at most 2 strategies in a group at a given time. An example of this would be when calculating the Small Mutation Limit (SML) of the Pairwise Moran Process. In this case, we do not need to know the payoffs for each strategy for any group composition (i.e., when there are more than 2 strategies in the group), but only for all possible combinations of each 2 strategies.

To be able to represent this in a nb_strategies x nb_strategies square matrix, we make each entry of the matrix a function, which will return the payoff of the strategy given k players adopting strategy i and N - k players adopting strategy j.

Parameters
Returns

Returns the payoff matrix in shape nb_strategies x nb_strategies, and each entry of the payoff matrix is a function which will return the payoff of a strategy i against strategy j given a group composition with k members of strategy i and N - k members of strategy j.

Return type

numpy.ndarray[numpy.float64[m,m]]