tucoopy.properties.simple_games¶
Recognizers for simple games and weighted voting representations.¶
A simple game is a TU game where every coalition is either losing or winning and the worth is binary:
\(v(S) \in \{0, 1\}\) for all coalitions \(S\).
This module provides:
is_simple_game/validate_simple_game(binary-valued check),find_integer_weighted_voting_representation(small-n brute force),is_weighted_voting_game.
Examples:
>>> from tucoopy.base.game import Game
>>> from tucoopy.properties.simple_games import is_simple_game
>>> # 3-player majority: any coalition of size >= 2 is winning.
>>> values = {(): 0.0, (0, 1): 1.0, (0, 2): 1.0, (1, 2): 1.0, (0, 1, 2): 1.0}
>>> game = Game.from_coalitions(n_players=3, values=values)
>>> is_simple_game(game)
True
find_integer_weighted_voting_representation ¶
find_integer_weighted_voting_representation(
game, *, max_weight=10, max_players=10
)
Try to find an integer weighted voting representation \((w, q)\). This is an exact brute-force search intended for small \(n\). Returns (weights, quota) if successful, else None.
is_simple_game ¶
is_simple_game(game, *, tol=0.0, max_players=20)
Return True iff \(v(S)\) is (approximately) in \(\{0, 1\}\) for all coalitions \(S\).
is_weighted_voting_game ¶
is_weighted_voting_game(
game, *, max_weight=10, max_players=10
)
Recognize whether a complete simple game can be represented as a weighted voting game. For now this is an exact brute-force test for small \(n\) only.
validate_simple_game ¶
validate_simple_game(game, *, tol=0.0, max_players=20)
Validate that game is a (TU) simple game: \(v(S) \in \{0,1\}\) for all \(S\).