tucoopy.games.market¶
Market games (buyers vs sellers).¶
In a market game, players are divided into buyers and sellers. A coalition's worth is the maximum trade surplus it can realize by matching its internal buyers and sellers.
Notes
- Players \(0 \ldots B-1\) are buyers and players \(B \ldots B+S-1\) are sellers.
- This implementation uses a greedy matching strategy and is intended as a lightweight generator for examples and demos.
See Also
tucoopy.games.assignment.assignment_game
Examples:
>>> from tucoopy.games.market import market_game
>>> g = market_game([10, 8], [3])
>>> g.n_players
3
>>> g.value(0b111) # grand coalition
7.0
market_game ¶
market_game(buyers, sellers, *, player_labels=None)
Generate a market game (buyers vs sellers).
Coalition value equals the maximum trade surplus achievable by matching buyers and sellers inside the coalition.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
buyers | Sequence[float] | Buyer valuations. | required |
sellers | Sequence[float] | Seller costs. | required |
player_labels | list[str] | None | Optional labels. | None |
Returns:
| Type | Description |
|---|---|
Game | Market cooperative game. |
Notes
- Players \(0 \ldots B-1\) are buyers, \(B \ldots B+S-1\) are sellers.
- Value is computed by greedy matching of highest surplus pairs.
Examples:
>>> from tucoopy.games.market import market_game
>>> g = market_game([10, 8], [3])
>>> g.value(0b111)
7.0