pygambit.gambit.MixedStrategyProfile.__setitem__#
- MixedStrategyProfile.__setitem__()#
Sets the mixed strategy for the player with label player.
distribution need not specify a weight for every one of the player’s strategies: strategies it omits are treated as having weight zero. Use set_mixed_strategy if you want that to be an error instead.
- Parameters:
player (str) – The label of the player whose mixed strategy is to be set.
distribution (Mapping[str, Any]) – A non-negative weight for some or all of the player’s strategies, keyed by strategy label; strategies it omits are treated as having weight zero. A weight may be any value Gambit can interpret as a number (int, float, str, Decimal, or Rational). Weights need not sum to one, and at least one must be nonzero.
- Raises:
KeyError – If no player in the game has the label player.
TypeError – If player is not a str, or distribution is not a Mapping.
ValueError – If any key of distribution is not one of the player’s strategy labels, if any weight cannot be interpreted as a number, if any weight is negative, or if the weights are all zero.
See also
set_mixed_strategyEquivalent, but can require a weight for every strategy instead of silently defaulting omitted ones to zero.
