pygambit.nash.lp_solve#
- pygambit.nash.lp_solve(game: Game, rational: bool = True, use_strategic: bool = False, nash_callback: Callable[[MixedStrategyProfile | MixedBehaviorProfile], None] | None = None) LpResult#
Compute Nash equilibria of a two-player constant-sum game using linear programming.
- Parameters:
game (Game) – The game to compute equilibria in.
rational (bool, default True) – Compute using rational numbers. If False, using floating-point arithmetic. Using rationals is more precise, but slower.
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.
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.
Added in version 17.0.0.
- Returns:
res – The result represented as an
LpResultobject.- Return type:
- Raises:
RuntimeError – If game has more than two players or is not constant sum.
