gameanalysis.agggen module

gameanalysis.agggen.congestion(num_players, num_facilities, num_required, *, degree=2)[source]

Generate a congestion game

A congestion game is a symmetric game, where there are a given number of facilities, and each player must choose to use some amount of them. The payoff for each facility decreases as more players use it, and a players utility is the sum of the utilities for every facility.

In this formulation, facility payoffs are random polynomials of the number of people using said facility.

Parameters:
  • num_players (int > 1) – The number of players.
  • num_facilities (int > 1) – The number of facilities.
  • num_required (0 < int < num_facilities) – The number of required facilities.
  • degree (int > 0, optional) – Degree of payoff polynomials.
gameanalysis.agggen.local_effect(num_players, num_strategies, *, edge_prob=0.2)[source]

Generate a local effect game

In a local effect game, strategies are connected by a graph, and utilities are a function of the number of players playing our strategy and the number of players playing a neighboring strategy, hence local effect.

In this formulation, payoffs for others playing our strategy are negative quadratics, and payoffs for playing other strategies are positive cubics.

Parameters:
  • num_players (int > 1) – The number of players.
  • num_strategies (int > 1) – The number of strategies.
  • edge_prob (float, optional) – The probability that one strategy affects another.
gameanalysis.agggen.normal_aggfn(role_players, role_strats, functions, *, input_prob=0.2, weight_prob=0.2)[source]

Generate a random normal AgfnGame

Each function value is an i.i.d Gaussian random walk.

Parameters:
  • role_players (int or ndarray) – The number of players per role.
  • role_strats (int or ndarray) – The number of strategies per role.
  • functions (int) – The number of functions to generate.
  • input_prob (float, optional) – The probability of a strategy counting towards a function value.
  • weight_prob (float, optional) – The probability of a function producing non-zero payoffs to a strategy.
gameanalysis.agggen.poly_aggfn(role_players, role_strats, functions, *, input_prob=0.2, weight_prob=0.2, degree=4)[source]

Generate a random polynomial AgfnGame

Functions are generated by generating degree zeros in [0, num_players] to serve as a polynomial functions.

Parameters:
  • role_players (int or ndarray) – The number of players per role.
  • role_strats (int or ndarray) – The number of strategies per role.
  • functions (int) – The number of functions to generate.
  • input_prob (float, optional) – The probability of a strategy counting towards a function value.
  • weight_prob (float, optional) – The probability of a function producing non-zero payoffs to a strategy.
  • degree (int or [float], optional) – Either an integer specifying the degree or a list of the probabilities of degrees starting from one, e.g. 3 is the same as [0, 0, 1].
gameanalysis.agggen.sine_aggfn(role_players, role_strats, functions, *, input_prob=0.2, weight_prob=0.2, period=4)[source]

Generate a random sinusodial AgfnGame

Functions are generated by generating sinusoids with uniform random shifts and n periods in 0 to num_players, where n is chosen randomle between min_period and max_period.

Parameters:
  • role_players (int or ndarray) – The number of players per role.
  • role_strats (int or ndarray) – The number of strategies per role.
  • functions (int) – The number of functions to generate.
  • input_prob (float, optional) – The probability of a strategy counting towards a function value.
  • weight_prob (float, optional) – The probability of a function producing non-zero payoffs to a strategy.
  • period (float, optional) – The loose number of periods in the payoff for each function.