tucoopy.games.additive¶
Additive TU games.¶
An additive game is defined by player weights \((w_i)\) and the characteristic function
\[ v(S) = \sum_{i \in S} w_i. \]
These games are the simplest TU games; notably, the Shapley value equals the weight vector.
See Also
tucoopy.solutions.shapley.shapley_value
Examples:
>>> from tucoopy.games.additive import additive_game
>>> g = additive_game([1.0, 2.0, 3.0])
>>> g.value(0b101) # players {0,2}
4.0
additive_game ¶
additive_game(weights, *, player_labels=None)
Generate an additive TU game.
The characteristic function is:
\[ v(S) = \sum_{i \in S} w_i. \]
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
weights | Sequence[float] | Player weights. | required |
player_labels | list[str] | None | Optional labels for players. | None |
Returns:
| Type | Description |
|---|---|
Game | Additive cooperative game. |
Notes
- This is the simplest class of TU games.
- The Shapley value equals the weight vector.
Examples:
>>> from tucoopy.games.additive import additive_game
>>> g = additive_game([1.0, 2.0, 3.0])
>>> g.n_players
3
>>> g.value(0b011)
3.0