Stable marriage problem
In mathematics, economics, and computer science, the stable marriage problem is the problem of finding a stable matching between two equally sized sets of elements given an ordering of preferences for each element. A matching is a bijection from the elements of one set to the elements of the other set. A matching is not stable if:
In other words, a matching is stable when there does not exist any match which both prefer each other to their current partner under the matching.
The stable marriage problem has been stated as follows:
The existence of two classes that need to be paired with each other distinguishes this problem from the stable roommates problem.
Applications
Algorithms for finding solutions to the stable marriage problem have applications in a variety of real-world situations, perhaps the best known of these being in the assignment of graduating medical students to their first hospital appointments. In 2012, The Sveriges Riksbank Prize in Economic Sciences in Memory of Alfred Nobel was awarded to Lloyd S. Shapley and Alvin E. Roth "for the theory of stable allocations and the practice of market design."An important and large-scale application of stable marriage is in assigning users to servers in a large distributed Internet service. Billions of users access web pages, videos, and other services on the Internet, requiring each user to be matched to one of hundreds of thousands of servers around the world that offer that service. A user prefers servers that are proximal enough to provide a faster response time for the requested service, resulting in a preferential ordering of the servers for each user. Each server prefers to serve users that it can with a lower cost, resulting in a preferential ordering of users for each server. Content delivery networks that distribute much of the world's content and services solve this large and complex stable marriage problem between users and servers every tens of seconds to enable billions of users to be matched up with their respective servers that can provide the requested web pages, videos, or other services.
Different stable matchings
In general, there may be many different stable matchings. For example, suppose there are three men and three women which have preferences of:There are three stable solutions to this matching arrangement:
- men get their first choice and women their third - ;
- all participants get their second choice - ;
- women get their first choice and men their third -.
and this structure leads to efficient algorithms for several problems on stable marriages.
In a uniformly-random instance of the stable marriage problem with men and women, the average number of stable matchings is asymptotically.
In a stable marriage instance chosen to maximize the number of different stable matchings, this number is an exponential function of.
Counting the number of stable matchings in a given instance is #P-complete.
Algorithmic solution
In 1962, David Gale and Lloyd Shapley proved that, for any equal number of men and women, it is always possible to solve the SMP and make all marriages stable. They presented an algorithm to do so.The Gale–Shapley algorithm involves a number of "rounds" :
- In the first round, first a) each unengaged man proposes to the woman he prefers most, and then b) each woman replies "maybe" to her suitor she most prefers and "no" to all other suitors. She is then provisionally "engaged" to the suitor she most prefers so far, and that suitor is likewise provisionally engaged to her.
- In each subsequent round, first a) each unengaged man proposes to the most-preferred woman to whom he has not yet proposed each woman replies "maybe" if she is currently not engaged or if she prefers this man over her current provisional partner. The provisional nature of engagements preserves the right of an already-engaged woman to "trade up".
- This process is repeated until everyone is engaged.
Among all possible different stable matchings, it always yields the one that is best for all men among all stable matchings, and worst for all women.
It is a truthful mechanism from the point of view of men. I.e, no man can get a better matching for himself by misrepresenting his preferences. Moreover, the GS algorithm is even group-strategy proof for men, i.e., no coalition of men can coordinate a misrepresentation of their preferences such that all men in the coalition are strictly better-off. However, it is possible for some coalition to misrepresent their preferences such that some men are better-off and the other men retain the same partner.
The GS algorithm is non-truthful for the women : each woman may be able to misrepresent her preferences and get a better match.
Rural hospitals theorem
The Rural hospitals theorem concerns a more general variant of the stable matching problem, like that applying in the problem of matching doctors to positions at hospitals, differing in the following ways from the basic -to- form of the stable marriage problem:- Each participant may only be willing to be matched to a subset of the participants on the other side of the matching.
- The participants on one side of the matching may have a numerical capacity, specifying the number of doctors they are willing to hire.
- The total number of participants on one side might not equal the total capacity to which they are to be matched on the other side.
- The resulting matching might not match all of the participants.
For this kind of stable matching problem, the rural hospitals theorem states that:
- The set of assigned doctors, and the number of filled positions in each hospital, are the same in all stable matchings.
- Any hospital that has some empty positions in some stable matching, receives exactly the same set of doctors in all stable matchings.
Related problems
The stable roommates problem is similar to the stable marriage problem, but differs in that all participants belong to a single pool.
The hospitals/residents problem – also known as the college admissions problem – differs from the stable marriage problem in that a hospital can take multiple residents, or a college can take an incoming class of more than one student. Algorithms to solve the hospitals/residents problem can be hospital-oriented or resident-oriented. This problem was solved, with an algorithm, in the same original paper by Gale and Shapley, in which the stable marriage problem was solved.
The hospitals/residents problem with couples allows the set of residents to include couples who must be assigned together, either to the same hospital or to a specific pair of hospitals chosen by the couple. The addition of couples to the hospitals/residents problem renders the problem NP-complete.
The assignment problem seeks to find a matching in a weighted bipartite graph that has maximum weight. Maximum weighted matchings do not have to be stable, but in some applications a maximum weighted matching is better than a stable one.
The matching with contracts problem is a generalization of matching problem, in which participants can be matched with different terms of contracts. An important special case of contracts is matching with flexible wages.
Textbooks and other important references not cited in the text
- Kleinberg, J., and Tardos, E. Algorithm Design, Chapter 1, pp 1–12. See companion website for the Text .
- Knuth, D. E.. Mariages stables. Montreal: Les Presses de l'Universite de Montreal.
- Knuth, D.E. Stable Marriage and Its Relation to Other Combinatorial Problems: An Introduction to the Mathematical Analysis of Algorithms, English translation,, American Mathematical Society.
- Pittel, B.. "On likely solutions of a stable marriage problem", The Annals of Applied Probability 2; 358-401.
- Roth, A. E.. "The evolution of the labor market for medical interns and residents: A case study in game theory", Journal of Political Economy 92: 991–1016.
- Roth, A. E., and Sotomayor, M. A. O. Two-sided matching: A study in game-theoretic modeling and analysis Cambridge University Press.
- See Section 10.6.4; .
- .