tucoopy.games.apex¶
Apex (simple voting) games.¶
An apex game is a weighted voting game with a distinguished apex player \(a\). A coalition \(S\) is winning if it includes the apex and the other members meet the quota:
See Also
tucoopy.games.weighted_voting.weighted_voting_game
Examples:
>>> from tucoopy.games.apex import apex_game
>>> g = apex_game(0, [2, 3], quota=3)
>>> g.value(0b11)
1.0
apex_game ¶
apex_game(
apex_player,
weights,
quota,
*,
player_labels=None,
winning_value=1.0,
losing_value=0.0,
)
Construct an apex game (simple game).
Let \(a\) be the apex player and let \(w_i\) be the weights. A coalition \(S\) is said to be winning if:
- \(a \in S\), and
- \(\sum_{i \in S,\ i \ne a} w_i \ge q\).
The characteristic function is:
where \(w_v\) is the winning value and \(l_v\) is the losing value.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
apex_player | int | Index of the apex player. | required |
weights | Sequence[float] | Weights for each player (excluding apex). | required |
quota | float | Quota required for a coalition to win (excluding apex). | required |
player_labels | list of str | Optional labels for players. | None |
winning_value | float | Value assigned to winning coalitions (default 1.0). | 1.0 |
losing_value | float | Value assigned to losing coalitions (default 0.0). | 0.0 |
Returns:
| Type | Description |
|---|---|
Game | Cooperative game instance representing the apex game. |
Raises:
| Type | Description |
|---|---|
InvalidParameterError | If fewer than 2 players are provided or |
Examples:
>>> from tucoopy.games.apex import apex_game
>>> g = apex_game(0, [2, 3], 3)
>>> g.n_players
2
>>> g.value(1)
0.0
>>> g.value(3)
1.0