pygambit.nash.ipa_solve#
- pygambit.nash.ipa_solve(perturbation: Game | MixedStrategyProfile, nash_callback: Callable[[MixedStrategyProfileDouble], None] | None = None, event_callback: Callable[[IPAStepEvent | IPATerminationEvent], None] | None = None) IPAResult#
Compute a Nash equilibrium of a game using iterated polymatrix approximation.
- Parameters:
perturbation (Game or MixedStrategyProfile) –
The perturbation vector to apply to the game. If a
Gameis 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.
nash_callback (Callable[[MixedStrategyProfileDouble], None], optional) –
If specified, called with the equilibrium found, if any.
Added in version 17.0.0.
event_callback (Callable[[IPAStepEvent | IPATerminationEvent], None], optional) –
If specified, called with the state of the approximating strategy at the end of each iteration (
IPAStepEvent) and, possibly more than once, with why an iteration terminated (IPATerminationEvent).Added in version 17.0.0.
- Raises:
ValueError – If the perturbation vector does not have a unique maximizer for each player
- Returns:
res – The result represented as an
IPAResultobject.- Return type:
