pygambit.gambit.MixedBehaviorProfile.__setitem__#

MixedBehaviorProfile.__setitem__()#

Sets the mixed action at the information set containing index.

distribution need not specify a weight for every one of the information set’s actions: actions it omits are treated as having weight zero. Use set_mixed_action if you want that to be an error instead.

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 some or all of the information set’s actions, keyed by action label; actions 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:
  • 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 any weight cannot be interpreted as a number; if any weight is negative; or if the weights are all zero.

See also

set_mixed_action

Equivalent, but can require a weight for every action instead of silently defaulting omitted ones to zero.