gameanalysis.aggfn module

An action graph game with additive function nodes

gameanalysis.aggfn.aggfn(num_role_players, num_role_strats, action_weights, function_inputs, function_table, offsets=None)[source]

Create an Aggfn with default names

Parameters
  • num_role_players (ndarray) – The number of players per role.

  • num_role_strats (ndarray) – The number of strategies per role.

  • action_weights (ndarray, float) – The action weights.

  • function_inputs (ndarray, bool) – The input mask for each function.

  • function_table (ndarray, float) – The function value relative to number of incoming edges.

  • offsets (ndarray, float, optional) – A constant offset for each strategies payoff. Constant functions are not allowed in the function table as they are clutter, instead, constant functions can be specified here.

gameanalysis.aggfn.aggfn_funcs(num_role_players, num_role_strats, action_weights, function_inputs, functions, offsets=None)[source]

Construct and Aggfn with functions

This is generally less efficient than just constructing the function table using vectorized operations or an existing function table.

Parameters
  • num_role_players (ndarray) – The number of players per role.

  • num_role_strats (ndarray) – The number of strategies per role.

  • action_weights (ndarray, float) – The action weights.

  • function_inputs (ndarray, bool) – The input mask for each function.

  • functions ([(nr1, nr2, ..) -> float]) – List of functions that maps the player per role activations to a single value. The number of ordered arguments will be inferred from each function.

gameanalysis.aggfn.aggfn_json(json)[source]

Read an Aggfn from json

Json versions of the game will generally have ‘type’: ‘aggfn…’ in them, but as long as the proper fields exist, this will succeed.

gameanalysis.aggfn.aggfn_names(role_names, num_role_players, strat_names, action_weights, function_inputs, function_table, offsets=None)[source]

Create an Aggfn with specified names

Parameters
  • role_names ([str]) – The name of each role.

  • num_role_players (ndarray) – The number of players for each role.

  • strat_names ([[str]]) – The name of each strategy for each role.

  • action_weights (ndarray) – The mapping of each function to the strategy weight for a player.

  • function_inpits (ndarray) – The mask indicating which strategies are inputs to which function.

  • offsets (ndarray, float, optional) – A constant offset for each strategies payoff. Constant functions are not allowed in the function table as they are clutter, instead, constant functions can be specified here.

gameanalysis.aggfn.aggfn_replace(copy_game, action_weights, function_inputs, function_table, offsets=None)[source]

Replace an existing game with an Aggfn

Parameters
  • copy_game (RsGame) – The game to take game structure from.

  • action_weights (ndarray-like) – The weights of each function to player payoffs.

  • function_inputs (ndarray-like) – The mask of each strategy to function.

  • function_table (ndarray-like) – The lookup table of number of incoming edges to function value.

  • offsets (ndarray, float, optional) – A constant offset for each strategies payoff. Constant functions are not allowed in the function table as they are clutter, instead, constant functions can be specified here.