Population Game

This module defines the main classes used to create and manage population games. It supports both single- and multi-population scenarios.

Multi-Population Game

Supports games with multiple interacting populations, each possibly with a different strategy space.

class popgames.population_game.PopulationGame(num_populations, num_strategies, fitness_function, masses=None, A_eq=None, b_eq=None, A_ineq=None, b_ineq=None, g_ineq=None, Dg_ineq=None, fitness_lipschitz_constant=None)[source]

Bases: object

Multi-Population game.

Initialize the population game object.

Parameters:
  • num_populations (int) – Number of populations.

  • num_strategies (list[int]) – Number of strategies.

  • fitness_function (Callable[[np.ndarray], np.ndarray]) – Fitness function.

  • masses (list[float]) – Population masses.

  • A_eq (np.ndarray) – Matrix A in equality constraints of the form Ax = b.

  • b_eq (np.ndarray) – Vector b in equality constraints of the form Ax = b.

  • A_ineq (np.ndarray) – Matrix A in inequality constraints of the form Ax <= b.

  • b_ineq (np.ndarray) – Vector b in inequality constraints of the form Ax <= b.

  • g_ineq (Callable[[np.ndarray], np.ndarray]) – Function g(x) in inequality constraints of the form g(x) <= 0.

  • Dg_ineq (Callable[[np.ndarray], np.ndarray]) – Jacobian matrix of g(x).

  • fitness_lipschitz_constant (float) – Lipschitz constant of the fitness function.

compute_gne(max_iter=5000, tolerance=1e-06)[source]

Compute a generalized Nash equilibrium (GNE) for the population game, assuming one exists.

The GNE is computed using the Modified Forward-Backward Operator Splitting Method (Tseng, P., 2000).

Parameters:
  • max_iter (int) – Maximum number of iterations.

  • tolerance (float) – Convergence tolerance.

Returns:

The computed GNE (if any).

Return type:

np.ndarray

compute_polyhedron_vertices()[source]

Compute the polyhedron vertices of the feasible set of the population game.

Returns:

The vertices of the feasible set of the population game.

Return type:

list

Single-Population Game

A simplified version of the population game model for single-population settings.

class popgames.population_game.SinglePopulationGame(num_strategies, fitness_function, mass=None, A_eq=None, b_eq=None, A_ineq=None, b_ineq=None, g_ineq=None, Dg_ineq=None, fitness_lipschitz_constant=None)[source]

Bases: PopulationGame

Population game with a single population.

Initialize the single-population game object.

Parameters:
  • num_populations (int) – Number of populations.

  • num_strategies (list[int]) – Number of strategies.

  • fitness_function (Callable[[np.ndarray], np.ndarray]) – Fitness function.

  • masses (list[float]) – Population masses.

  • A_eq (np.ndarray) – Matrix A in equality constraints of the form Ax = b.

  • b_eq (np.ndarray) – Vector b in equality constraints of the form Ax = b.

  • A_ineq (np.ndarray) – Matrix A in inequality constraints of the form Ax <= b.

  • b_ineq (np.ndarray) – Vector b in inequality constraints of the form Ax <= b.

  • g_ineq (Callable[[np.ndarray], np.ndarray]) – Function g(x) in inequality constraints of the form g(x) <= 0.

  • Dg_ineq (Callable[[np.ndarray], np.ndarray]) – Jacobian matrix of g(x).

  • fitness_lipschitz_constant (float) – Lipschitz constant of the fitness function.

  • mass (float)

compute_gne(max_iter=5000, tolerance=1e-06)

Compute a generalized Nash equilibrium (GNE) for the population game, assuming one exists.

The GNE is computed using the Modified Forward-Backward Operator Splitting Method (Tseng, P., 2000).

Parameters:
  • max_iter (int) – Maximum number of iterations.

  • tolerance (float) – Convergence tolerance.

Returns:

The computed GNE (if any).

Return type:

np.ndarray

compute_polyhedron_vertices()

Compute the polyhedron vertices of the feasible set of the population game.

Returns:

The vertices of the feasible set of the population game.

Return type:

list