pygambit.nash.enumpoly_solve#

pygambit.nash.enumpoly_solve(game: Game, use_strategic: bool = False, stop_after: int | None = None, maxregret: float = 1e-08, max_rectangles: int = 20000, phcpack_path: Path | str | None = None, nash_callback: Callable[[MixedStrategyProfile | MixedBehaviorProfile], None] | None = None, event_callback: Callable[[EnumPolyCandidateSupportEvent | EnumPolySingularSupportEvent | EnumPolyBudgetExceededSupportEvent], None] | None = None) EnumPolyResult#

Compute Nash equilibria by enumerating all support profiles of strategies or actions, and for each support finding all totally-mixed equilibria of the game over that support.

Parameters:
  • game (Game) – The game to compute equilibria in.

  • use_strategic (bool, default False) – Whether to use the strategic form. If True, always uses the strategic representation even if the game’s native representation is extensive.

  • stop_after (int, optional) – Maximum number of equilibria to compute. If not specified, examines all support profiles of the game.

  • maxregret (float, default 1e-8) – The acceptance criterion for approximate Nash equilibrium; the maximum regret of any player must be no more than maxregret times the difference of the maximum and minimum payoffs of the game

  • max_rectangles (int, default 20000) –

    The maximum number of rectangles to examine when searching for equilibria on a single support, before giving up on that support. See the algorithm description for why this is necessary.

    Added in version 17.0.0.

  • phcpack_path (str or pathlib.Path, optional) – If specified, use PHCpack to solve the systems of equations. This argument specifies the path to the PHCpack executable. With this method, only enumeration on the strategic game is supported.

  • nash_callback (Callable[[MixedStrategyProfile | MixedBehaviorProfile], None], optional) –

    If specified, called with each equilibrium as it is found, before the method continues searching for any further equilibria. Not available when phcpack_path is specified.

    Added in version 17.0.0.

  • event_callback (Callable[[EnumPolyCandidateSupportEvent | EnumPolySingularSupportEvent | EnumPolyBudgetExceededSupportEvent], None], optional) –

    If specified, called with each support profile examined as a candidate to contain a totally-mixed equilibrium (EnumPolyCandidateSupportEvent), skipped because its system of equations was singular (EnumPolySingularSupportEvent), or on which the rectangle budget was exhausted before completing the search for roots (EnumPolyBudgetExceededSupportEvent). The support carried by each event is a StrategySupportProfile or BehaviorSupportProfile according to which representation is being solved on. Not available when phcpack_path is specified.

    Added in version 17.0.0.

Returns:

res – The result represented as an EnumPolyResult object.

Return type:

EnumPolyResult

Raises:

ValueError – If either nash_callback or event_callback is specified along with phcpack_path.

Notes

PHCpack is available at https://homepages.math.uic.edu/~jan/PHCpack/phcpack.html