from matching.games import StableMarriage
= {
suitor_preferences "A": ["X", "Y", "Z"],
"B": ["Y", "Z", "X"],
"C": ["Y", "X", "Z"],
}
= {
reviewer_preferences "X": ["B", "C", "A"],
"Y": ["A", "C", "B"],
"Z": ["A", "B", "C"],
}
Choose party-optimality
Many two-sided matching games allow for the optimality of its stable matching to be chosen. This is done using the optimal
parameter in the corresponding class’ solve
method where the party for whom the solution should be optimal is specified.
To see how this may change things, consider the example below.
In the case of SM, the choices are "suitor"
or "reviewer"
.
= StableMarriage.create_from_dictionaries(
game
suitor_preferences, reviewer_preferences
)
="suitor") game.solve(optimal
{A: X, B: Z, C: Y}
= StableMarriage.create_from_dictionaries(
game
suitor_preferences, reviewer_preferences
)
="reviewer") game.solve(optimal
{A: Y, B: Z, C: X}