gameanalysis.reduction module

Module for computing player reductions

class gameanalysis.reduction.deviation_preserving[source]

Bases: object

static expand_deviation_profiles(full_game, rest, red_players, role_index=None)[source]

Expand all deviation profiles from a restriction

Parameters:
  • full_game (Game) – The game the deviations profiles will be valid for.
  • rest ([bool]) – The restriction to get deviations from.
  • red_players ([int]) – The number of players in each role in the reduced game.
  • role_index (int, optional) – If specified , only expand deviations for the role selected.
static expand_profiles(full_game, profiles, *, return_contributions=False)[source]

Expand profiles using dpr

Parameters:
  • full_game (Game) – Game that expanded profiles will be valid for.
  • profiles (ndarray-like) – The profiles to expand
  • return_contributions (bool, optional) – If specified, returns a boolean array matching the shape is returned indicating the payoffs that are needed for the initial profiles.
static reduce_game(full_game, red_players)[source]

Reduce a game using deviation preserving reduction

Parameters:
  • full_game (Game) – The game to reduce.
  • red_players (ndarray-like) – The reduced number of players for each role. This will be coerced into the proper shape if necessary.
static reduce_profiles(red_game, profiles, *, return_contributions=False)[source]

Reduce profiles using dpr

Parameters:
  • red_game (Game) – Game that reduced profiles will be profiles for.
  • profiles (ndarray-like) – The profiles to reduce.
  • return_contributions (bool, optional) – If true return ancillary information about where the payoffs come from.
class gameanalysis.reduction.hierarchical[source]

Bases: object

static expand_deviation_profiles(full_game, rest, red_players, role_index=None)[source]

Expand all deviation profiles from a restricted game

Parameters:
  • full_game (Game) – The game the deviations profiles will be valid for.
  • rest ([bool]) – The restriction to get deviations from.
  • red_players (ndarray-like) – The number of players in each role in the reduced game.
  • role_index (int, optional) – If specified , only expand deviations for the role selected.
static expand_profiles(full_game, profiles)[source]

Expand profiles hierarchically

Parameters:
  • full_game (Game) – Game that expanded profiles will be valid for.
  • profiles (ndarray-like) – The profiles to expand
static reduce_game(full_game, red_players)[source]

Reduce a game using hierarchical reduction

Parameters:
  • full_game (Game) – The game to reduce.
  • red_players (ndarray-like) – The reduced number of players for each role. This will be coerced into the proper shape if necessary.
static reduce_profiles(red_game, profiles)[source]

Reduce profiles hierarchically

Parameters:
  • red_game (Game) – Game that reduced profiles will be profiles for.
  • profiles (ndarray-like) – The profiles to reduce.
class gameanalysis.reduction.identity[source]

Bases: object

static expand_deviation_profiles(full_game, rest, red_players=None, role_index=None)[source]

Expand all deviation profiles from a restriction

Parameters:
  • full_game (Game) – The game the deviations profiles will be valid for.
  • rest ([bool]) – The restriction to get deviations from.
  • red_players ([int], optional) – The number of players in each role in the reduced game.IF specified, it must match the number for full_game.
  • role_index (int, optional) – If specified , only expand deviations for the role selected.
static expand_profiles(full_game, profiles)[source]

Return input profiles

Parameters:
  • full_game (Game) – Game that all profiles must be valid for.
  • profiles (ndarray-like) – The profiles.
  • axis (int, optional) – The axis the profiles lie on.
static reduce_game(full_game, red_players=None)[source]

Return original game

Parameters:
  • full_game (Game) – The game to reduce.
  • red_players (ndarray-like, optional) – If specified, this must match the number of players per role in full_game.
static reduce_profiles(red_game, profiles)[source]

Return original profiles

Parameters:
  • red_game (Game) – Game that all profiles must be valid for.
  • profiles (ndarray-like) – The profiles.
  • axis (int, optional) – The axis the profiles are on.
class gameanalysis.reduction.twins[source]

Bases: object

static expand_deviation_profiles(full_game, rest, red_players=None, role_index=None)[source]

Expand all deviation profiles from a restriction

Parameters:
  • full_game (Game) – The game the deviations profiles will be valid for.
  • rest ([bool]) – The restriction to get deviations from.
  • red_players ([int], optional) – The number of players in each role in the reduced game.IF specified, it must match the expected number for twins reduction.
  • role_index (int, optional) – If specified , only expand deviations for the role selected.
static expand_profiles(full_game, profiles)[source]

Expand profiles using twins reduction

Parameters:
  • full_game (Game) – Game that expanded profiles will be valid for.
  • profiles (ndarray-like) – The profiles to expand
static reduce_game(full_game, red_players=None)[source]

Reduce a game using twins reduction

Parameters:
  • full_game (Game) – The game to reduce.
  • red_players (ndarray-like, optional) – The reduced number of players for each role. This must be None or the reduced number of players for the twins reductions.
static reduce_profiles(red_game, profiles)[source]

Reduce profiles using twins

Parameters:
  • red_game (Game) – Game that reduced profiles will be profiles for. This game must have the valid twins reduction number of players.
  • profiles (ndarray-like) – The profiles to reduce.