hisss.calculate_nash_equilibrium#
- hisss.calculate_nash_equilibrium(available_actions, joint_action_list, joint_action_value_arr)[source]#
Calculates the Nash equilibrium for a given game formulation using a C++ backend. The algorithm used here is from Porter et al. (“Simple search methods for finding a Nash equilibrium”). It works for both 2-player as well as N-player games.
- Parameters:
available_actions (
list[list[int]]) – A list where the index represents the player and the value is a list of integer IDs representing their available actions.joint_action_list (
list[tuple[int,...]]) – A list of all possible joint actions, where each tuple represents a combination of actions chosen by all players.joint_action_value_arr (
ndarray) – A 2D numpy array of shape (num_joint_actions, num_players) representing the payoffs. Rows correspond to the joint actions (aligned with joint_action_list) and columns correspond to each player’s payout.
- Returns:
- A tuple containing two elements:
value_list (list[float]): The expected payoff/value for each player at the calculated Nash equilibrium.
policy_list (list[np.ndarray]): The equilibrium strategy for each player, represented as a list of numpy arrays. Each array contains the probability distribution over that player’s available actions.
- Return type:
tuple[list[float],list[ndarray]]- Raises:
ValueError – If the number of columns in joint_action_value_arr does not match the number of players inferred from available_actions.