tucoopy.games.savings¶
Savings games.¶
Given stand-alone costs \(c_i\) and a dense table of coalition costs \(C(S)\) (length \(2^n\)), the savings game is defined by:
\[ v(S) = \sum_{i \in S} c_i - C(S). \]
See Also
tucoopy.games.cost_sharing.cost_sharing_game
Examples:
>>> from tucoopy.games.savings import savings_game
>>> g = savings_game([2, 3], [0, 2, 3, 4])
>>> g.value(0b11)
1.0
savings_game ¶
savings_game(
individual_costs, coalition_costs, *, player_labels=None
)
Construct a savings game (TU) as a worth game.
Given:
- individual costs \(c_i\)
- coalition costs \(C(S)\) for every coalition mask \(S\) (length \(2^n\))
Define savings:
\[v(S) = \sum_{i \in S} c_i - C(S)\]
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
individual_costs | Sequence[float] | Individual costs for each player. | required |
coalition_costs | Sequence[float] | Costs for each coalition (length \(2^n\)). | required |
player_labels | list of str | Optional labels for players. | None |
Returns:
| Type | Description |
|---|---|
Game | Cooperative game instance representing the savings game. |
Raises:
| Type | Description |
|---|---|
InvalidParameterError | If fewer than 1 player or coalition_costs does not have length \(2^n\). |
Examples:
>>> from tucoopy.games.savings import savings_game
>>> g = savings_game([2, 3], [0, 2, 3, 4])
>>> g.n_players
2
>>> g.value(1)
0.0
>>> g.value(3)
1.0