pygambit.gambit.MixedBehaviorProfile.set_mixed_action#
- MixedBehaviorProfile.set_mixed_action(index: Selector, distribution: Mapping, sparse: bool = False) None#
Sets the mixed action at the information set containing index.
Equivalent to
profile[index] = distribution, except that by default every one of the information set’s actions must be given an explicit weight in distribution. Use this instead of __setitem__ when omitting an action should be an error rather than silently defaulting its weight to zero.Added in version 17.0.0.
- Parameters:
index (Selector) – An H-built expression resolving to a single node belonging to the information set to set.
distribution (Mapping[str, Any]) – A non-negative weight for the information set’s actions, keyed by action label. 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.
sparse (bool, default False) – If False (the default), distribution must specify a weight for every one of the information set’s actions. If True, actions it omits are treated as having weight zero, the same as
profile[index] = distribution.
- Raises:
TypeError – If index is not a
Selector, or distribution is not a Mapping.ValueError – If index resolves to a terminal node, which belongs to no information set, or to a chance event; if any key of distribution is not one of the information set’s action labels; if sparse is False and distribution omits an action; if any weight cannot be interpreted as a number; if any weight is negative; or if the weights are all zero.
See also
