Stable marriage problem

Last updated

In mathematics, economics, and computer science, the stable marriage problem (also stable matching 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:

Contents

  1. There is an element A of the first matched set which prefers some given element B of the second matched set over the element to which A is already matched, and
  2. B also prefers A over the element to which B is already matched.

In other words, a matching is stable when there does not exist any pair (A, B) which both prefer each other to their current partner under the matching.

The stable marriage problem has been stated as follows:

Given n men and n women, where each person has ranked all members of the opposite sex in order of preference, marry the men and women together such that there are no two people of opposite sex who would both rather have each other than their current partners. When there are no such pairs of people, the set of marriages is deemed stable.

The existence of two classes that need to be paired with each other (heterosexual men and women in this example) 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. [1] In 2012, the Nobel Memorial Prize in Economic Sciences was awarded to Lloyd S. Shapley and Alvin E. Roth "for the theory of stable allocations and the practice of market design." [2]

An important and large-scale application of stable marriage is in assigning users to servers in a large distributed Internet service. [3] Billions of users access web pages, videos, and other services on the Internet, requiring each user to be matched to one of (potentially) 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 (partial) preferential ordering of the servers for each user. Each server prefers to serve users that it can with a lower cost, resulting in a (partial) 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. [3]

The Gale-Shapley algorithm for stable matching is used to assign rabbis who graduate from Hebrew Union College to Jewish congregations. [4]

Different stable matchings

In general, there may be many different stable matchings. For example, suppose there are three men (A,B,C) and three women (X,Y,Z) which have preferences of:

A: YXZ   B: ZYX   C: XZY  
X: BAC   Y: CBA   Z: ACB

There are three stable solutions to this matching arrangement:

All three are stable, because instability requires both of the participants to be happier with an alternative match. Giving one group their first choices ensures that the matches are stable because they would be unhappy with any other proposed match. Giving everyone their second choice ensures that any other match would be disliked by one of the parties. In general, the family of solutions to any instance of the stable marriage problem can be given the structure of a finite distributive lattice, and this structure leads to efficient algorithms for several problems on stable marriages. [5]

In a uniformly-random instance of the stable marriage problem with n men and n women, the average number of stable matchings is asymptotically . [6] In a stable marriage instance chosen to maximize the number of different stable matchings, this number is an exponential function of n. [7] Counting the number of stable matchings in a given instance is #P-complete. [8]

Algorithmic solution

Animation showing an example of the Gale-Shapley algorithm Gale-Shapley.gif
Animation showing an example of the Gale–Shapley algorithm

In 1962, David Gale and Lloyd Shapley proved that, for any equal number of men and women, it is always possible to solve the stable marriage problem and make all marriages stable. They presented an algorithm to do so. [9] [10]

The Gale–Shapley algorithm (also known as the deferred acceptance algorithm) involves a number of "rounds" (or "iterations"):

This algorithm is guaranteed to produce a stable marriage for all participants in time where is the number of men or women. [11]

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. [12]

It is a truthful mechanism from the point of view of men (the proposing side), 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. [13] 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. [14] The GS algorithm is non-truthful for the women (the reviewing side): 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 n-to-n form of the stable marriage problem:

In this case, the condition of stability is that no unmatched pair prefer each other to their situation in the matching (whether that situation is another partner or being unmatched). With this condition, a stable matching will still exist, and can still be found by the Gale–Shapley algorithm.

For this kind of stable matching problem, the rural hospitals theorem states that:

In stable matching with indifference , some men might be indifferent between two or more women and vice versa.

The stable roommates problem is similar to the stable marriage problem, but differs in that all participants belong to a single pool (instead of being divided into equal numbers of "men" and "women").

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 (as the NRMP was before 1995) [15] 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. [9]

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 (e.g., a married couple want to ensure that they will stay together and not be stuck in programs that are far away from each other). The addition of couples to the hospitals/residents problem renders the problem NP-complete. [16]

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. [17] An important special case of contracts is matching with flexible wages. [18]

See also

Related Research Articles

<span class="mw-page-title-main">Approximate string matching</span> Finding strings that approximately match a pattern

In computer science, approximate string matching is the technique of finding strings that match a pattern approximately. The problem of approximate string matching is typically divided into two sub-problems: finding approximate substring matches inside a given string and finding dictionary strings that match the pattern approximately.

In mathematics, economics and computer science, particularly in the fields of combinatorics, game theory and algorithms, the stable-roommate problem (SRP) is the problem of finding a stable matching for an even-sized set. A matching is a separation of the set into disjoint pairs ("roommates"). The matching is stable if there are no two elements which are not roommates and which both prefer each other to their roommate under the matching. This is distinct from the stable-marriage problem in that the stable-roommates problem allows matches between any two elements, not just between classes of "men" and "women".

<span class="mw-page-title-main">Alvin E. Roth</span> American academic (born 1951)

Alvin Eliot Roth is an American academic. He is the Craig and Susan McCaw professor of economics at Stanford University and the Gund professor of economics and business administration emeritus at Harvard University. He was President of the American Economic Association in 2017.

<span class="mw-page-title-main">Market design</span>

Market design is an interdisciplinary, engineering-driven approach to economics and a practical methodology for creation of markets of certain properties, which is partially based on mechanism design. In market design, the focus is on the rules of exchange, meaning who gets allocated what and by what procedure. Market design is concerned with the workings of particular markets in order to fix them when they are broken or to build markets when they are missing. Practical applications of market design theory has included labor market matching, organ transplantation, school choice, university admissions, and more.

The National Resident Matching Program (NRMP), also called The Match, is a United States–based private non-profit non-governmental organization created in 1952 to place U.S. medical school students into residency training programs located in United States teaching hospitals. Its mission has since expanded to include the placement of U.S. citizen and non-U.S. citizen international medical school students and graduates into residency and fellowship training programs. In addition to the annual Main Residency Match that in 2021 encompassed more than 48,000 applicants and 38,000 positions, the NRMP conducts Fellowship Matches for more than 60 subspecialties through its Specialties Matching Service (SMS). The NRMP is sponsored by a board of directors that includes medical school deans, teaching hospital executives, graduate medical education program directors, medical students and residents, and one public member.

In mathematics, economics, and computer science, the Gale–Shapley algorithm is an algorithm for finding a solution to the stable matching problem. It is named for David Gale and Lloyd Shapley, who published it in 1962, although it had been used for the National Resident Matching Program since the early 1950s. Shapley and Alvin E. Roth won the 2012 Nobel Prize in Economics for work including this algorithm.

In computational complexity theory, CC (Comparator Circuits) is the complexity class containing decision problems which can be solved by comparator circuits of polynomial size.

Top trading cycle (TTC) is an algorithm for trading indivisible items without using money. It was developed by David Gale and published by Herbert Scarf and Lloyd Shapley.

Daniel Mier Gusfield is an American computer scientist, Distinguished Professor of Computer Science at the University of California, Davis. Gusfield is known for his research in combinatorial optimization and computational biology.

The rural hospitals theorem (RHT) is a fundamental theorem in the theory of stable matching. It considers the problem of matching doctors to hospitals for residency, where each doctor is matched to a single hospital but each hospital has several positions for doctors. The total number of positions is larger than the total number of doctors, so some hospitals inevitably remain with unfilled positions. Usually, rural hospitals are less wanted than urban hospitals, so they often remain with many empty positions. This raised the question of whether the mechanism used to match doctors to hospitals can be changed in order to help these rural hospitals.

Stable marriage with indifference is a variant of the stable marriage problem. Like in the original problem, the goal is to match all men to all women such that no pair of man and woman who are unmarried to each other, would simultaneously like to leave their present partners and pair with each other instead.

In mathematics, economics, and computer science, the lattice of stable matchings is a distributive lattice whose elements are stable matchings. For a given instance of the stable matching problem, this lattice provides an algebraic description of the family of all solutions to the problem. It was originally described in the 1970s by John Horton Conway and Donald Knuth.

In mathematics, economics, and computer science, the stable matching polytope or stable marriage polytope is a convex polytope derived from the solutions to an instance of the stable matching problem.

Two-Sided Matching: A Study in Game-Theoretic Modeling and Analysis is a book on matching markets in economics and game theory, particularly concentrating on the stable marriage problem. It was written by Alvin E. Roth and Marilda Sotomayor, with a preface by Robert Aumann, and published in 1990 by the Cambridge University Press as volume 18 in their series of Econometric Society monographs. For this work, Roth and Sotomayor won the 1990 Frederick W. Lanchester Prize of the Institute for Operations Research and the Management Sciences.

Course allocation is the problem of allocating seats in university courses among students. Many universities impose an upper bound on the number of students allowed to register to each course, in order to ensure that the teachers can give sufficient attention to each individual student. Since the demand for some courses is higher than the upper bound, a natural question is which students should be allowed to register to each course.

<span class="mw-page-title-main">Stable matching theory</span> Field of market economics

In economics, stable matching theory or simply matching theory, is the study of matching markets. Matching markets are distinguished from Walrasian markets in the focus of who matches with whom. Matching theory typically examines matching in the absence of search frictions, differentiating it from search and matching theory. In 2012, the Nobel Memorial Prize in Economic Sciences was awarded to Alvin E. Roth and Lloyd Shapley for their work on matching theory.

In economics and social choice theory, a no-justified-envy matching is a matching in a two-sided market, in which no agent prefers the assignment of another agent and is simultaneously preferred by that assignment.

The Marriage Pact is an annual matchmaking activity that takes place on American college campuses, by which students fill out compatibility surveys in order to find a partner among fellow participants, who they agree will be their backup "safety" spouse in the future in case they are then unmarried.

In mechanism design, a regret-free truth-telling mechanism is a mechanism in which each player who reveals his true private information does not feel regret after seeing the mechanism outcome. A regret-free mechanism incentivizes agents who want to avoid regret to report their preferences truthfully.

The Aphrodite Project is an annual matchmaking event that takes place on university campuses in Canada, Hong Kong, Singapore, and the United States. Students fill out a questionnaire built on psychology research to be matched with their most ideal date on campus using classical and machine learning algorithms.

References

  1. Stable Matching Algorithms
  2. "The Prize in Economic Sciences 2012". Nobelprize.org. Retrieved 2013-09-09.
  3. 1 2 Bruce Maggs and Ramesh Sitaraman (2015). "Algorithmic nuggets in content delivery" (PDF). ACM SIGCOMM Computer Communication Review. 45 (3).
  4. Bodin, Lawrence; Panken, Aaron (June 2003). "High Tech for a Higher Authority: The Placement of Graduating Rabbis from Hebrew Union College—Jewish Institute of Religion". Interfaces. 33 (3): 1–11. doi:10.1287/inte.33.3.1.16013. ISSN   0092-2102.
  5. Gusfield, Dan (1987). "Three fast algorithms for four problems in stable marriage". SIAM Journal on Computing . 16 (1): 111–128. doi:10.1137/0216010. MR   0873255.
  6. Pittel, Boris (1989). "The average number of stable matchings". SIAM Journal on Discrete Mathematics . 2 (4): 530–549. doi:10.1137/0402048. MR   1018538.
  7. Karlin, Anna R.; Gharan, Shayan Oveis; Weber, Robbie (2018). "A simply exponential upper bound on the maximum number of stable matchings". In Diakonikolas, Ilias; Kempe, David; Henzinger, Monika (eds.). Proceedings of the 50th Symposium on Theory of Computing (STOC 2018). Association for Computing Machinery. pp. 920–925. arXiv: 1711.01032 . doi:10.1145/3188745.3188848. ISBN   978-1-4503-5559-9. MR   3826305.
  8. Irving, Robert W.; Leather, Paul (1986). "The complexity of counting stable marriages". SIAM Journal on Computing . 15 (3): 655–667. doi:10.1137/0215048. MR   0850415.
  9. 1 2 Gale, D.; Shapley, L. S. (1962). "College Admissions and the Stability of Marriage". American Mathematical Monthly . 69 (1): 9–14. doi:10.2307/2312726. JSTOR   2312726. Archived from the original on September 25, 2017.
  10. Harry Mairson: "The Stable Marriage Problem", The Brandeis Review 12, 1992 (online).
  11. Iwama, Kazuo; Miyazaki, Shuichi (2008). "A Survey of the Stable Marriage Problem and Its Variants". International Conference on Informatics Education and Research for Knowledge-Circulating Society (ICKS 2008). IEEE. pp. 131–136. doi:10.1109/ICKS.2008.7. hdl: 2433/226940 . ISBN   978-0-7695-3128-1.
  12. Erickson, Jeff (June 2019). "4.5 Stable matching" (PDF). Algorithms. University of Illinois. pp. 170–176. Retrieved 2023-12-19.
  13. Dubins, L. E.; Freedman, D. A. (1981). "Machiavelli and the Gale–Shapley algorithm". American Mathematical Monthly . 88 (7): 485–494. doi:10.2307/2321753. JSTOR   2321753. MR   0628016.
  14. Huang, Chien-Chung (2006). "Cheating by men in the Gale-Shapley stable matching algorithm". In Azar, Yossi; Erlebach, Thomas (eds.). Algorithms - ESA 2006, 14th Annual European Symposium, Zurich, Switzerland, September 11-13, 2006, Proceedings. Lecture Notes in Computer Science. Vol. 4168. Springer. pp. 418–431. doi:10.1007/11841036_39. ISBN   978-3-540-38875-3. MR   2347162.
  15. Robinson, Sara (April 2003). "Are Medical Students Meeting Their (Best Possible) Match?" (PDF). SIAM News (3): 36. Retrieved 2 January 2018.
  16. Gusfield, D.; Irving, R. W. (1989). The Stable Marriage Problem: Structure and Algorithms. MIT Press. p. 54. ISBN   0-262-07118-5.
  17. Hatfield, John William; Milgrom, Paul (2005). "Matching with Contracts". American Economic Review . 95 (4): 913–935. doi:10.1257/0002828054825466. JSTOR   4132699.
  18. Crawford, Vincent; Knoer, Elsie Marie (1981). "Job Matching with Heterogeneous Firms and Workers". Econometrica . 49 (2): 437–450. doi:10.2307/1913320. JSTOR   1913320.

Further reading