The different classes of games

The following game classes are implemented:

  • abstractgame: An abstract class from which all other game classes inherit.

  • normalformgame: The class of normal form games.

  • polymatrixgame: The class of polymatrix games.

  • hypergraphicalgame: The clas of hypergraphical games.

  • bayesiangame: The class of bayesian games.

  • bayesian_hypergraphicalgame: The class of bayesian hypergraphical games.

These classes are documented here:

Abstract games class

class abstractgame.AbstractGame

This is the abstract game class from which all other classes derive.

property n_players

Number of players of input game (@property).

Parameters:

self (object) – Input game object.

Returns:

self._n_play, the number of players of self.

Return type:

int.

property players_actions

Actions of every players of input game (@property).

Parameters:

self (object) – Input game object.

Returns:

self._players_act, the actions of each player of self.

Return type:

list of lists.

property utilities

Utilities of every players of input game (@property).

Parameters:

self (object) – Input game object.

Returns:

self._util, utilities of every actions/players of self.

Return type:

list of lists.

Normal form games class

class normalformgame.NFG(players_actions, utilities, index_to_player={})

Normal-form game class, attributes and methods.

Parameters:
  • players_actions (list of lists) – Actions of every players of input game.

  • utilities (list of lists) – Utilities of every players of input game.

  • index_to_player (list) – Players’ numbering.

all_response_of_player(player_ind, action)

Generates all the possible joint strategies obtained by fixing joint strategy action and varying only the strategies of player player_ind.

Parameters:
  • player_ind (int) – Index of the player whose action is not fixed.

  • action (list) – Arbitrary joint strategy of players.

Returns:

A matrix which rows are the obtained joint strategies.

Return type:

np.matrix.

build_subgame(partial_mixed_strategy)
Builds a subgame of a normal form game by fixing the mixed

strategies of some arbitrary players.

Parameters:

partial_mixed_strategy (dict) – partial_mixed_strategy[n] is a probability distribution over actions of player n (a list).

Returns:

Normal form subgame nfg_out.

Return type:

NFG.

disutil_of_joint_action(player_id, jact)
Returns the disutility of joint action jact for

player player_id.

Parameters:
  • player_id (int) – Index of the player whose disutility is computed.

  • jact (list) – Arbitrary joint strategy of players.

Returns:

Disutility.

Return type:

int.

disutil_of_row(player_id, action_value)
Returns the disutility of joint strategies where the

strategy is action_value for player player_id.

Parameters:
  • player_id (int) – Index of the player whose disutilities are computed.

  • action_value (int) – Arbitrary strategy of player player_id.

Returns:

list of integers .

Return type:

list.

error_equilibrium(mixed_joint_strategy)

Returns the maximum utility gaps to any player of mixed_joint_strategy. This measures how far mixed_joint_strategy is from being an equilibrium.

Parameters:

mixed_joint_strategy (dict) – mixed_joint_strategy[play] is the mixed strategy of player play (a list).

Returns:

the maximal gaps of the expected utilities to players of any deviation from mixed_joint_strategy.

Return type:

list of float.

expected_utilities(mixed_joint_strat)

Returns the expected utilities of mixed_joint_strategy for all players.

Parameters:

mixed_joint_strat (dict) – mixed_joint_strategy[play] is the mixed strategy of player play (a list).

Returns:

List of the expected utilities to players of mixed_joint_strategy.

Return type:

list of floats.

expected_utilities_of_n(n, mixed_joint_strat)

Returns the expected utilities of mixed_joint_strategy for player n.

Parameters:
  • n (int) – Index of a player

  • mixed_joint_strat (dict) – mixed_joint_strategy[play] is the mixed strategy of player play (a list).

Returns:

List of the expected utilities to players of mixed_joint_strategy.

Return type:

list of floats.

first_pne()

Returns the first encountered pure Nash equilibrium. Returns the empty dictionary if the game admits no pure Nash equilibrium.

Returns:

The first encountered Nash equilibrium (if any), represented as a dictionary.

Return type:

dict.

generate_joint_actions(players_actions)

Generates all the possible joint strategies.

Parameters:

players_actions (list of lists) – The list of all lists of actions available to every players.

Returns:

A matrix which rows are the joint strategies.

Return type:

np.matrix of int.

get_all_PNE()

Returns every existing pure Nash equilibrium. Returns the empty dictionary if the game admits no pure Nash equilibrium.

Returns:

The list of encountered Nash equilibria (if any), represented as dictionaries.

Return type:

list of dict.

get_sub_jointact_of_n(player_ind)
For player player_ind, get the indices of every joint actions

of the other player, for every strategies of player_ind.

Parameters:

player_ind (int) – The player of interest.

Returns:

A list of lists of joint actions, ordered by actions of player player_ind.

Return type:

list of lists of integers.

get_subgame_fixed_strat(played_strat)

For a given partial pure strategy, returns the subgame where this is played.

Parameters:

played_strat (dict) – Partial strategy represented as a dictionary (integer values). played_strat[n] is the pure strategy played by player n.

Returns:

Normal form subgame.

Return type:

NFG.

get_subgame_level(proba)

Given a joint mixed strategy, returns the subgame with the last player’s mixed strategy fixed.

Parameters:

proba (dict) – Joint mixed strategy represented as a dictionary. proba[n] is the mixed strategy played by player n.

Returns:

Normal form subgame with one player less.

Return type:

NFG.

get_subgame_without_n(proba, player_ind)
Given a joint mixed strategy and a player’s index,

returns the subgame with the indexed player’s mixed strategy fixed.

Parameters:
  • proba (dict) – Joint mixed strategy represented as a dictionary. proba[n] is the mixed strategy played by player n.

  • player_ind (int) – Player which strategy is fixed.

Returns:

Normal form subgame with player player_ind removed.

Return type:

NFG.

is_equilibrium(mixed_joint_strategy, gap=0.0001)

Checks whether mixed_joint_strategy is a Nash equilibrium.

Parameters:
  • mixed_joint_strategy (dict) – mixed_joint_strategy[play] is the mixed strategy of player play (a list).

  • gap (float) – maximum deviation to equilibrium allowed.

Returns:

True if mixed_joint_strategy is a mixed Nash equilibrium and False if not.

Return type:

boolean.

joint_action_except_i(player_ind)

Generates all the possible joint pure strategies excluding player player_ind’s action.

Parameters:

player_ind (int) – Index of the player whose action is excluded.

Returns:

A matrix which rows are all the pure joint strategies excluding player player_ind’s action.

Return type:

np.matrix.

pne_exist()

Checks whether there is a PNE in the game

Returns:

True if there exists a pure Nash equilibrium and False if not.

Return type:

boolean.

readNFGoutcome(file_path)

Using a .nfg game file (outcome version), creates the corresponding utilities table.

Warning

Note that currently the order of players is the reverse of that in the utilities table (Player 1 in the .nfg file is the “last” player in the utilites table).

Parameters:

file_path (string) – Path of the .nfg file to read.

Returns:

utilities table.

Return type:

list of lists of integers.

classmethod readNFGpayoff(file_path)
Using a .nfg game file (payoff version),

creates the corresponding utilities table.

Warning

Note that currently the order of players is the reverse of that in the utilities table (Player 1 in the .nfg file is the “last” player in the utilites table).

Parameters:

file_path (string) – Path of the .nfg file to read.

Returns:

utilities table.

Return type:

list of lists of integers.

read_GameFile(file_path)

Using a .nfg game file (whichever version), creates the corresponding utilities table.

Warning

Note that currently the order of players is the reverse of that in the utilities table (Player 1 in the .nfg file is the “last” player in the utilites table).

Parameters:

file_path (string) – Path of the .nfg file to read.

Returns:

utilities table.

Return type:

list of lists of integers.

row_where_p_is_i(player_id, action_value)
Get all the rows’ indices in the list of joint strategies

where player player_id plays strategy action_value.

Parameters:
  • player_id (int) – Index of the player whose utilities are computed.

  • action_value (int) – Arbitrary strategy of player player_id.

Returns:

rows’ indices of the joint strategies list.

Return type:

list of integers.

transform_utilities()

Computes the disutility matrix of the utility matrix of the considered game.

util_of_joint_action(player_id, jact)
Returns the utility of joint action jact for

player player_id.

Parameters:
  • player_id (int) – Index of the player whose utility is computed.

  • jact (list) – Arbitrary joint strategy of players.

Returns:

Utility.

Return type:

int.

util_of_row(player_id, action_value)

Returns the utility of joint strategies where the strategy is action_value for player player_id.

Parameters:
  • player_id (int) – Index of the player whose utilities are computed.

  • action_value (int) – Arbitrary strategy of player player_id.

Returns:

list of integers .

Return type:

list.

writeNFGoutcome(file_path)

Using a utilities table, creates the corresponding .nfg game file (payoff version).

Warning

Note that currently the order of players is the reverse of that in the utilities table (Player 1 in the .nfg file is the “last” player in the utilites table).

Parameters:

file_path (string) – Path where the .nfg file should be written.

writeNFGpayoff(file_path)
Using a utilities table, creates the

corresponding .nfg game file (payoff version).

Warning

Note that currently the order of players is the reverse of that in the utilities table (Player 1 in the .nfg file is the “last” player in the utilites table).

Parameters:

file_path (string) – Path where the .nfg file should be written.

write_GameFile(file_path)

Using a utilities table, writes the corresponding .nfg game file (payoff version).

Warning

Note that currently the order of players is the reverse of that in the utilities table (Player 1 in the .nfg file is the “last” player in the utilites table).

Parameters:

file_path (string) – Path where the .nfg file should be written.

Polymatrix games class

class polymatrixgame.PMG(players_actions, utilities, hypergraph)

Polymatrix game class, attributes and methods. This class heritates from the hypergraphicalgames class.

Parameters:
  • players_actions (list of lists) – Actions of every players of the polymatrix game.

  • utilities (list of lists of lists) – Utilities of every players of input game. utilities[g][n][a] is the local utility of player n in local game g if the local joint action’s index is a.

  • hypergraph (list of lists) – List of sublist containing all the players’ indices of all local games. hypergraph[g] is the list of players’ indices involved in local game g.

read_GameFile(file_path)

Using a .hgg game file (polymatrix games are specific hypergraphical games), creates the corresponding utilities table.

Warning

Note that currently the order of players is the reverse of that in the utilities table (Player 1 in the .nfg file is the “last” player in the utilites table).

Parameters:

file_path (string) – Path of the .nfg file to read.

Returns:

A polymatrix game.

Return type:

list of lists of integers.

Hypergraphical games class

class hypergraphicalgame.HGG(players_actions, utilities, hypergraph, index_to_player={})

Hypergraphical game class, attributes and methods.

Parameters:
  • players_actions (list of lists) – Actions of every players of input game

  • utilities (list of lists of lists) – Utilities of every players of input game. utilities[g][n][a] is the local utility of player n in local game g if the local joint action’s index is a.

  • hypergraph (list of lists) – List of sublist containing all the players’ indices of all local games. hypergraph[g] is the list of players’ indices involved in local game g.

  • index_to_player (list) – Players’ numbering.

build_subgame(partial_mixed_strategy)

Builds a subgame of a hypergraphical game by fixing the mixed strategies of some arbitrary players.

Parameters:

partial_mixed_strategy (dict) – partial_mixed_strategy[n] is a probability distribution over actions of player n (a list).

Returns:

Hypergraphical subgame hgg_out.

Return type:

HGG.

static convert_to_HGG(nfgame)

Converts a normal form game to an hypergraphical game.

Parameters:

nfgame (NFG) – A normal-form game.

Returns:

Hypergraphical game hypergraphical_game.

Return type:

HGG.

convert_to_NFG()

Converts the hypergraphical game to a normal form game.

Returns:

Normal form subgame.

Return type:

NFG.

expected_utilities(mixed_joint_strat)

Returns the expected utilities of mixed_joint_strategy for all players.

Parameters:

mixed_joint_strat (dict) – mixed_joint_strategy[play] is the mixed strategy of player play (a list).

Returns:

List of the expected utilities to players of mixed_joint_strategy.

Return type:

list of floats.

expected_utilities_of_n(n, mixed_joint_strat)

Returns the expected utilities of mixed_joint_strategy for the player n.

Parameters:
  • n (int) – Index of the player whose utility is computed

  • mixed_joint_strat (dict) – mixed_joint_strategy[play] is the mixed strategy of player play (a list).

Returns:

Value of the expected utility of the player n

Return type:

float.

first_pne()

Returns the first encountered pure Nash equilibrium. Returns the empty dictionary if the game admits no pure Nash equilibrium.

Returns:

The first encountered Nash equilibrium (if any), represented as a dictionary.

Return type:

dict.

game_as_int()

Transforms an hypergraphical game with fractional utilities into one where all the utilities are integer.

Returns:

Hypergraphical game with integer utilities.

Return type:

HGG.

Warning

Not sure that it works when utilities are of type float. Maybe use Python’s fractions class to convert floats into fractions?

generate_local_normalformgame(index_hyper_edge)

Generates a local normal form game associated to the input hyperedge index.

Parameters:

index_hyper_edge (int) – the index of the hyperedge in the hypergraph list.

Returns:

Normal-form game normal_forme_game.

Return type:

NFG.

get_all_PNE()

Returns every existing pure Nash equilibrium. Returns the empty dictionary if the game admits no pure Nash equilibrium

Returns:

The list of encountered Nash equilibria (if any), represented as dictionaries.

Return type:

list of dict.

get_max_value_of_player_n(player_ind)

Computes the highest utility of a given player of the hypergraphical game.

Parameters:

player_ind (int) – The index of the player

Returns:

The maximum utility of the player.

Return type:

int.

get_player_except_e(hyper_e)

Computes the list of all the players of the hypergraphical game, except those in the local hyperedge given as input.

Parameters:

hyper_e (list) – List of players in the input hyperedge.

Returns:

List of the players not belonging to the hyperedge.

Return type:

list.

get_player_interact(player_index)

Computes the list of all players in the game interacting with a given player.

Parameters:

player_index (int) – Index of the player of interest.

Returns:

List of the players interacting with the player of interest (present in a common hyperedge).

Return type:

list.

get_player_interact_except_e(player_index, hyper_e)

Computes the list of all players in the game interacting with a given player in all hyperedges except the one given in parameter.

Parameters:
  • player_index (int) – Index of the player of interest.

  • hyper_e (int) – Index of the excluded hyperedge.

Returns:

List of the players interacting with the player of interest (present in a common hyperedge, apart from hyperedge of index hyper_e).

Return type:

list.

get_subgame_fixed_strat(played_strat)

Computes the hypergraphical game resulting from a given hypergraphical game, when only subsets of the initial allowed actions are allowed for every players.

Parameters:

played_strat (dict) – A dictionary associating a list of allowed actions (1 if allowed, 0 else) to every player.

Returns:

Reduced hypergraphical game.

Return type:

HGG.

get_subgame_level(proba)

Returns a hypergraphical subgame without the last player, fixing its mixed strategy

Parameters:

proba (dict) – The mixed strategy of the “last” player.

Returns:

Resulting hypergraphical game without the “last” player.

Return type:

HGG.

get_subgame_without_n(proba, player_ind)

Returns a hypergraphical subgame without the player which index is given as input, fixing its mixed strategy

Parameters:
  • proba (dict) – The mixed strategy of the “removed” player.

  • player_ind (int) – The index of the “removed” player.

Returns:

Resulting hypergraphical game without the “removed” player.

Return type:

HGG.

index_of_player_in_local(player_ind)

Returns the indices of the player player_ind in the local games he participates in.

Parameters:

player_ind (int) – Global index of the player in the hypergraphical game.

Returns dict index_game_to_local_index_player:

A dictionary associating the local index of player player_ind to every indices of local games the player participates in.

Return type:

dict.

is_GG()

Checks whether the hypergraphical game is a graphical game.

Returns:

True if the hypergraphical game is a graphical game and False, otherwise.

Return type:

bool.

is_PMG()

Checks whether the hypergraphical game is a polymatrix game.

Returns:

True if the hypergraphical game is a polymatrix game and False, otherwise.

Return type:

bool.

is_equilibrium(mixed_joint_strategy, gap=0.0001)

Checks whether mixed_joint_strategy is a Nash equilibrium.

Parameters:
  • mixed_joint_strategy (dict) – mixed_joint_strategy[play] is the mixed strategy of player play (a list).

  • gap (float) – maximum deviation to equilibrium allowed.

Returns:

True if mixed_joint_strategy is a mixed Nash equilibrium and False if not.

Return type:

boolean.

is_pure_equilibrium(pure_joint_strategy, gap=0.0001)

Checks whether pure_joint_strategy is a Pure Nash equilibrium.

Parameters:
  • pure_joint_strategy (list) – List of the actions played by each player.

  • gap (float) – maximum deviation to equilibrium allowed.

Returns:

False if the joint strategy is not an equilibrium, True otherwise.

Return type:

boolean.

joint_action_except_i(player_ind)

Generates all the possible joint pure strategies excluding player player_ind’s action.

Parameters:

player_ind (int) – Index of the player whose action is excluded.

Returns:

A matrix which rows are all the pure joint strategies excluding player player_ind’s action.

Return type:

np.matrix.

local_game_of_player_n(player_ind)
Returns the list of local games,

player player_ind participates in.

Parameters:

player_ind (int) – Index of the player.

Returns:

Indices of the subgames player player_ind participates in.

Return type:

list.

pne_exist()

Checks whether the hypergraphical game has a pure Nash equilibrium.

Returns:

True if the hypergraphical game has a pure Nash equilibrium and False, otherwise.

Return type:

bool.

classmethod random(nplayers, nactions, size_edges, nminedges, utilmax)

Random hypergraphical game generator.

Parameters:
  • nplayers (int) – Number of players of the hypergraphical game.

  • nactions (int) – Number of actions (identical for every players).

  • size_edges (int) – Number of players per local game (identical for every local games).

  • nminedges (int) – Minimum number of local games (hyperedges).

  • utilmax (int) – Maximal utility (utilities are between 0 and utilmax).

Returns:

Hypergraphical game.

Return type:

HGG.

classmethod read_GameFile(file_path)

Using a .hgg game file, creates the corresponding utilities table.

Warning

Note that currently the order of players is the reverse of that in the utilities table (Player 1 in the .nfg file is the “last” player in the utilites table).

Parameters:

file_path (string) – Path of the .nfg file to read.

Returns:

Hypergraphical game.

Return type:

HGG.

simplify_subgame()

Simplifies a hypergraphical game obtained using method build_subgame. The sub-hypergraphical game is cleaned-up, by removing the players which strategies are fixed.

Returns:

Hypergraphical game hgg_simple, where players with empty action set (represented by list [-1]) have been removed.

Return type:

HGG.

util_of_joint_action(n, jact)

Return the utility of the player n for a given joint action

Parameters:
  • n (int) – Index of the player whose utility is computed

  • jact (list) – List of the actions played

Returns:

Value of the utility of n

Return type:

int.

util_of_player(player)

Computes the utilities of the input player in every games it participates in.

Parameters:

player (int) – The index of a player of the hypergraphical game.

Returns:

A dictionary, util, associating the list of utilities of player player to the indices of the local games, player participates in.

Return type:

dict.

write_GameFile(file_path)

Using a utilities table, writes the corresponding .hgg game file.

Warning

Note that currently the order of players is the reverse of that in the utilities table (Player 1 in the .nfg file is the “last” player in the utilites table).

Parameters:

file_path (string) – Path where the .hgg file should be written.

Bayesian games class

class bayesiangame.BG(players_actions, utilities, theta, p_unorm)

Bayesian games class, attributes and methods.

Parameters:
  • players_actions (list of lists) – Actions of every players.

  • utilities (list of lists) – List of utilities of each player for every possible joint types.

  • theta (list of list) – theta[n] is the list of types of player n.

  • p_unorm (list) – List of unnormalized probabilities (integers, for example) of joint types.

conditional_probabilities(known_player, type_known_player)

Returns the conditionnal probabilities of other players’ types, given that player known_player is of type type_known_player.

Parameters:
  • known_player (int) – Index of the player.

  • type_known_player (int) – Type index of the player.

Returns:

prob_cond, the conditional probabilities of every joint types (given that type[known_player]=type_known_player).

Return type:

dict.

convert_to_HGG()

Converts a bayesian game to an hypergraphical game.

Parameters:

self (BG) – A bayesian game.

Returns:

Hypergraphical game or polymatrix game.

Return type:

HGG or PMG.

dico_utilities()

Returns the dictionary that associate to each joint type index, the appropriate utilities

Returns:

dico, a dictionary representing the utilities tables associated to every joint types indices.

Return type:

dict.

expected_utilities(bayes_mixed_joint_strat)

Computes the expected utilities of every pair (player,type), for a given joint mixed bayesian strategy.

Parameters:

bayes_mixed_joint_strat (dict) – bayes_mixed_joint_strat[(n, t_n)] is a probability distribution (list) over player n’s startegies.

Returns:

expected_util, where expected_util[(n,t_n)] is the utility for player n of type t_n of the bayesian joint mixed strategy bayes_mixed_joint_strat.

Return type:

dict.

generate_joint_matrix(into_mat)

Returns a matrix which rows are all the possible (types,strategies) combinations of every players.

Parameters:

into_mat (list of lists) – each sublist is either the set of types or the set of strategies of a player.

Returns:

Matrix of joint (types/strategies).

Return type:

mat.

generate_local_normalformgame(hypergraph_temp, index_hyper_edge)

Returns a normal form game corresponding to a joint type/nfg.

Warning

Is this function used? Is it the correct class? If so, variables names are obscure (hypergraphical??).

get_index_of_type(type_theta)

Returns the index of a given joint type in a bayesian game.

Parameters:

type (np.array joint) – An arbitrary joint type.

Returns:

The index of the joint type.

Return type:

int.

is_equilibrium(bayes_mixed_joint_strat, gap=0.0001)

Checks whether bayes_mixed_joint_strategy is a Nash equilibrium of the bayesian game.

Parameters:
  • bayes_mixed_joint_strategy (dict) – bayes_mixed_joint_strategy[(n,t_n)] is the mixed strategy of player n of type t_n (a list).

  • gap (float) – maximum deviation to equilibrium allowed.

Returns:

True if bayes_mixed_joint_strategy is a bayesian mixed Nash equilibrium and False if not.

Return type:

boolean.

proba_type()

Returns the probabilities of all joint types

Returns:

The dictionary dico of probabilities of every joint types of a bayesian game. dico[i] is the probability of the joint type indexed by i.

Return type:

dict.

classmethod random_bayesian(n_player, n_action, n_type, u_max)

Random bayesian game generation.

Warning

There are two bayesian games generator. Which is correct?

classmethod random_game(n_players, n_actions, n_type, u_max)

Random bayesian game generation.

Warning

There are two bayesian games generator. Which is correct?

classmethod read_GameFile(file_path)

Using a .bg game file, creates the corresponding utilities table.

Warning

Note that currently the order of players is the reverse of that in the utilities table (Player 1 in the .bg file is the “last” player in the utilites table).

Parameters:

file_path (string) – Path of the .bg file to read.

Returns:

utilities table.

Return type:

list of lists of lists of integers.

write_GameFile(file_path)

Using a utilities table, writes the corresponding .bg game file.

Warning

Note that currently the order of players is the reverse of that in the utilities table (Player 1 in the .bg file is the “last” player in the utilites table).

Parameters:

file_path (string) – Path where the .bg file should be written.

Bayesian hypergraphical games class

class bayesian_hypergraphicalgame.BHGG(players_actions, utilities, hypergraph, theta, p, index_to_player={})

Bayesian hypergraphical games class, attributes and methods.

Parameters:
  • players_actions (list of sublists) – List of sublists containing all the strategies of every players.

  • utilities (list of sublists) – List of sublists containing the utilities of players.

  • hypergraph (list) – List of sublists containing all the players’ indices of every local games.

  • theta (list of sublists) – List of sublists containing the set of types of every players.

  • p (list of sublists) – List (for every local games) of sublists of probabilities of joint types of the local games. The probabilities may be unnormalized (integers), in which case they will be normalized as fractions at instanciation.

  • index_to_player (dict) – A dictionary of identifiers of players.

convert_to_HGG()

Converts a bayesian hypergraphical game to an hypergraphical game.

Parameters:

self (BHGG) – A bayesian hypergraphical game.

Returns:

Hypergraphical game or polymatrix game.

Return type:

HGG or PMG.

convert_to_NFG()

Converts the bayesian hypergraphical game to a normal form game.

Returns:

Normal form subgame.

Return type:

NFG.

expected_utilities(bayes_mixed_joint_strat)

Computes the expected utilities of every pair (player,type), for a given joint mixed bayesian strategy.

Parameters:

bayes_mixed_joint_strat (dict) – bayes_mixed_joint_strat[(n, t_n)] is a probability distribution (list) over player n’s strategies.

Returns:

expected_util, where expected_util[(n,t_n)] is the utility for player n of type t_n of the bayesian joint mixed strategy bayes_mixed_joint_strat.

Return type:

dict.

generate_local_bayesiangame(index_game)

Returns the local bayesian game which index is index_game.

Parameters:

index_game (int) – Index of the local bayesian game.

Returns:

bayesian_local_game, the corresponding bayesian local game.

Return type:

BG

is_equilibrium(bayes_mixed_join_strat, gap=0.0001)

Checks whether bayes_mixed_join_strat is a Nash equilibrium of the bayesian game.

Parameters:
  • bayes_mixed_join_strat (dict) – bayes_mixed_join_strat[(n,t_n)] is the mixed strategy of player n of type t_n (a list).

  • gap (float) – maximum deviation to equilibrium allowed.

Returns:

True if bayes_mixed_joint_strategy is a bayesian mixed Nash equilibrium and False if not.

Return type:

boolean.

local_game_of_player_n(player_ind)

Returns the list of local games player player_ind participates in.

Parameters:

player_ind (int) – Index of the player.

Returns:

Indices of the subgames player player_ind participates in.

Return type:

list.

classmethod random_bayesian_hyper(n_players, n_actions, n_type, size_edges, connect, u_max)

Random bayesian hypergraphical game generation.

Parameters:
  • n_players (int) – Number of players of the BHGG.

  • n_actions (int) – Number of actions (identical for every players).

  • n_type (int) – Number of types (identical for every players).

  • size_edges (int) – Number of players per local game (identical for every local games).

  • connect (float) – hypergraph connectivity.

  • u_max (int) – Maximal utility (utilities are between 0 and utilmax).

Returns:

Hypergraphical game.

Return type:

BHGG.

classmethod read_GameFile(file_path)

Using a .bhgg game file, creates the corresponding utilities table.

Warning

Note that currently the order of players is the reverse of that in the utilities table (Player 1 in the .bhgg file is the “last” player in the utilites table).

Parameters:

file_path (string) – Path of the .bhgg file to read.

Returns:

A bayesian hypergraphical game.

Return type:

BHGG.

write_GameFile(file_path)

Writes .bhgg game file corresponding to a bayesian hypergrap. game.

Warning

Note that currently the order of players is the reverse of that in the utilities table (Player 1 in the .nfg file is the “last” player in the utilites table).

Parameters:

file_path (string) – Path where the .bhgg file should be written.