pygambit.nash.gnm_solve#

pygambit.nash.gnm_solve(perturbation: Game | MixedStrategyProfile, end_lambda: float = -10.0, steps: int = 100, local_newton_interval: int = 3, local_newton_maxits: int = 10, nash_callback: Callable[[MixedStrategyProfileDouble], None] | None = None, event_callback: Callable[[GNMPerturbationEvent | GNMStartEvent | GNMStepEvent | GNMTerminationEvent], None] | None = None) GNMResult#

Compute Nash equilibria of a game using a global Newton method.

Parameters:
  • perturbation (Game or MixedStrategyProfile) –

    The perturbation vector to apply to the game. If a Game is passed, the perturbation vector is set to be 1 for the first strategy for each player and 0 for all other strategies. If a MixedStrategyProfileRational is given, it is converted to floating-point precision first.

    Changed in version 16.2.0: Allow selection of the perturbation vector

    Changed in version 17.0.0: Accept a MixedStrategyProfileRational, converted to floating-point via ~MixedStrategyProfile.as_float.

  • end_lambda (float, default -10.0) –

    The value of the perturbation magnitude lambda at which to terminate tracing. This must be a negative number. This sets the point at which the algorithm assumes no further equilibria will be found along this ray.

    Added in version 16.2.0.

  • steps (int, default 100) –

    The number of steps to take within a support cell. Lqrger values trade off speed for security in tracing the path.

    Added in version 16.2.0.

  • local_newton_interval (int, default 3) –

    The frequency to run a local Newton method step. This is a correction step that reduces accumulated errors in the path-following.

    Added in version 16.2.0.

  • local_newton_maxits (int, default 10) –

    The maximum number of iterations in a local Newton method step.

    Added in version 16.2.0.

  • nash_callback (Callable[[MixedStrategyProfileDouble], None], optional) –

    If specified, called with each equilibrium as it is found, before the method continues tracing the path.

    Added in version 17.0.0.

  • event_callback (Callable[[GNMPerturbationEvent | GNMStartEvent | GNMStepEvent | GNMTerminationEvent], None], optional) –

    If specified, called with each event of the path-following run: the perturbation vector traced from (GNMPerturbationEvent), the point reached after following the perturbation ray (GNMStartEvent), each predictor-corrector step taken while tracing the path (GNMStepEvent), and, once, why the run terminated (GNMTerminationEvent). Distinguish which occurred with isinstance or match.

    Added in version 17.0.0.

Raises:

ValueError – If the perturbation vector does not have a unique maximizer for each player, or arguments controlling the behavior of the numerical tracing are not valid.

Returns:

res – The result represented as a GNMResult object.

Return type:

GNMResult