gameanalysis.restrict module

Module for performing actions on restrictions

A restriction is a subset of strategies that are considered viable. They are represented as a bit-mask over strategies with at least one true value per role.

gameanalysis.restrict.additional_strategy_profiles(game, rest, role_strat_ind)[source]

Returns all profiles added by strategy at index

gameanalysis.restrict.deviation_profiles(game, rest, role_index=None)[source]

Return strict deviation profiles

Strict means that all returned profiles will have exactly one player where rest is false, i.e.

np.all(np.sum(profiles * ~rest, 1) == 1)

If role_index is specified, only profiles for that role will be returned.

gameanalysis.restrict.from_id(game, rest_id)[source]

Return a restriction mask from its unique id

gameanalysis.restrict.maximal_restrictions(game)[source]

Returns all maximally complete restrictions

This function returns an array of restrictions, such that no restriction is a sub_restriction (i.e. np.all(sub <= rest)) and that no restriction could be increased, and still contain complete payoff data for the game. This is reducible to clique finding, and as such is NP Hard

gameanalysis.restrict.num_deviation_payoffs(game, rest)[source]

Returns the number of deviation payoffs

This is a closed form way to compute np.sum(deviation_profiles(game, rest) > 0).

gameanalysis.restrict.num_deviation_profiles(game, rest)[source]

Returns the number of deviation profiles

This is a closed form way to compute deviation_profiles(game, rest).shape[0].

gameanalysis.restrict.num_dpr_deviation_profiles(game, rest)[source]

Returns the number of dpr deviation profiles

gameanalysis.restrict.to_id(game, rest)[source]

Return a unique integer representing a restriction

gameanalysis.restrict.translate(profiles, rest)[source]

Translate a strategy object to the full game