Pular para conteúdo

tucoopy.games.assignment

Assignment games.

An assignment game is defined from a bipartite value matrix. Coalitions can form matches between the two sides, and their worth is the maximum total matching value attainable by a one-to-one assignment.

See Also

tucoopy.games.market.market_game

Examples:

>>> from tucoopy.games.assignment import assignment_game
>>> g = assignment_game([[1, 2], [3, 4]])
>>> g.n_players
4
>>> g.value(0b1111)  # grand coalition
5.0

assignment_game

assignment_game(values_matrix, *, player_labels=None)

Construct an assignment game (TU) from a bipartite value matrix.

Players are split into two sides:

  • left players: \(0 \ldots m-1\)
  • right players: \(m \ldots m+n-1\)

For a coalition \(S\), let \(L(S)\) be the left players in \(S\) and \(R(S)\) the right players in \(S\). The coalition worth is the maximum total assignment value achievable by matching \(L(S)\) to \(R(S)\) (one-to-one), using the given value matrix.

Parameters:

Name Type Description Default
values_matrix Sequence[Sequence[float]]

Biadjacency matrix (m x n) of the bipartite value graph.

required
player_labels list of str

Optional labels for players.

None

Returns:

Type Description
Game

Cooperative game instance representing the assignment game.

Raises:

Type Description
InvalidParameterError

If the matrix is empty, not rectangular, or has zero rows/columns.

Examples:

>>> from tucoopy.games.assignment import assignment_game
>>> g = assignment_game([[1, 2], [3, 4]])
>>> g.n_players
4
>>> g.value(3)
0.0
>>> g.value(15)
5.0