It’s Not Easy Being Three: The Approximability of Three-Dimensional Stable Matching Problems
In 1976, Knuth  asked if the stable marriage problem (SMP) can be generalized to marriages consisting of 3 genders. In 1988, Alkan  showed that the natural generalization of SMP to 3 genders (GSM) need not admit a stable marriage. Three years later, Ng and Hirschberg  proved that it is NP-complete to determine if given preferences admit a stable marriage. They further prove an analogous result for the 3 person stable assignment (PSA) problem.
In light of Ng and Hirschberg’s NP-hardness result for GSM and PSA, we initiate the study of approximate versions of these problems. In particular, we describe two optimization variants of GSM and PSA: maximally stable marriage/matching (MSM) and maximum stable submarriage/submatching (MSS). We show that both variants are NP-hard to approximate within some fixed constant factor. Conversely, we describe a simple polynomial time algorithm which computes constant factor approximations for the maximally stable marriage and matching problems. Thus both variants of MSM are APX-complete.
Since Gale and Shapley first formalized and studied the stable marriage problem (SMP) in 1962 , many variants of the SMP have emerged (see, for example, ). While many of these variants admit efficient algorithms, two notably do not
In the case of incomplete preferences with ties, it is NP-hard to find a maximum cardinality stable marriage . The intractability of exact computation for this problem led to the study of approximate versions of the problem. These investigations have resulted in hardness of approximation results  as well as constant factor approximation algorithms .
In GSM, players are one of three genders: women, men, and dogs (as suggested by Knuth). Each player holds preferences over the set of pairs of players of the other two genders. The goal is to partition the players into families, each consisting of one man, one woman, and one dog, such that no triple mutually prefer one another to their assigned families. In 1988, Alkan showed that for this natural generalization of SMP to three genders, there exist preferences which do not admit a stable marriage . In 1991, Ng and Hirschberg showed that, in fact, it is NP-complete to determine if given preferences admit a stable marriage . They further generalize this result to the three person stable assignment problem (PSA). In PSA, each player ranks all pairs of other players without regard to gender. The goal is to partition players into disjoint triples where again, no three players mutually prefer each other to their assigned triples.
Despite the advances for stable marriages with incomplete preferences and ties (see  for an overview of relevant work), analogous approximability results have not been obtained for gender variants of the stable marriage problem. In this paper, we achieve the first substantial progress towards understanding the approximability of GSM and PSA.
1.2Overview of our results
gender stable marriages (Gsm)
We formalize two optimization variants of GSM: maximally stable marriage (G-MSM) and maximum stable submarriage (G-MSS). For G-MSM, we seek a perfect ( dimensional) marriage which minimizes the number of unstable triples—triples of players who mutually prefer each other to their assigned families. For G-MSS, we seek a largest cardinality submarriage which contains no unstable triples among the married players. Exact computation of both of these problems is NP-hard by Ng and Hirschberg’s result . Indeed, exact computation of either allows one to detect the existence of a stable marriage.
We obtain the following inapproximability result for G-MSM and G-MSS.
In fact, we prove a slightly stronger result for G-MSM and G-MSS. We show that the problem of determining if given preferences admit a stable marriage or if all marriages are “far from stable” is NP-hard. See Section ? and Theorem ? for the precise statements. In the other direction, we describe a polynomial time constant factor approximation algorithm for G-MSM.
Three person stable assignment (Psa)
We also consider the three person stable assignment problem (PSA). In this problem, players rank all pairs of other players and seek a ( dimensional) matching—a partition of players into disjoint triples. Notions of stability, maximally stable matching, and maximum stable submatching are defined exactly as the analogous notions for GSM. We show that Theorems ? and ? have analogues with PSA:
Our proofs of the lower bounds in Theorems ? and ? use a reduction from the dimensional matching problem (DM) to G-MSM. Kann  showed that Max-DM is Max-SNP complete. Thus, by the PCP theorem  and , it is NP-complete to approximate Max-DM to within some fixed constant factor. Our hardness of approximation results then follow from a reduction from DM to G-MSM.
Theorems ? and ? follow from a simple greedy algorithm. Our algorithm constructs marriages (or matchings) by greedily finding triples whose members are guaranteed to participate in relatively few unstable triples. Thus, we are able to efficiently construct marriages (or matchings) with a relatively small fraction of blocking triples.
2Background and Definitions
2.13 Gender Stable Marriage (Gsm)
In the 3 gender stable marriage problem, there are disjoint sets of women, men, and dogs denoted by (for Alice), (for Bob), and (for Dog), respectively. We assume , and we denote the collection of players by . A family is a triple consisting of one woman , one man , and one dog . A submarriage is a set of pairwise disjoint families. A marriage is a maximal submarriage—that is, one in which every player is contained in some (unique) family so that . Given a submarriage , we denote the function which assigns each player to their partners in , with if is not contained in any family in .
Each player has a preference, denoted over pairs of members of the other two genders. That is, each woman holds a total order over , and similarly for men and dogs. We assume that each player prefers being in some family to having no family. For example, for all , and . An instance of the three gender stable marriage problem (GSM) consists of , , and together with a set of preferences for each .
Given a submarriage , a triple is an unstable triple if , and each prefer the triple to their assigned families in . That is, is unstable if and only if , , and . A triple which is not unstable is stable. In particular, is stable if at least one of , and prefers their family in to . Let , and be the sets of women, men and dogs (respectively) which have families in . A submarriage is stable if there are no unstable triples in .
Unlike the two gender stable marriage problem, this three gender variant arbitrary preferences need not admit a stable marriage. In fact, for some preferences, every marriage has many unstable triples (see Section 3.1). Thus we consider two optimization variants of the three gender stable marriage problem.
Maximally Stable Marriage (G-Msm)
The maximally stable marriage problem (G-MSM) is to find a marriage with the maximum number of stable triples with respect to given preferences . For fixed preferences and marriage , the stability of with respect to is the number of stable triples in :
Thus, is stable if and only if . Dually, we define the instability of by . For fixed preferences , we define
For preferences and fixed , we define Gap-G-MSM to be the problem of determining if or .
Maximum Stable Submarriage
The maximum stable submarriage problem (G-MSS) is to find a maximum cardinality stable submarriage . We denote
Note that admits a stable marriage if and only if . For fixed , we define Gap-G-MSS to be the problem of determining if or if .
2.2Three person stable assignment (Psa)
In the three person stable assignment problem (PSA), there is a set of players who wish to be partitioned into disjoint triples. For a set , we denote the set of -subsets of by . A submatching is a set of disjoint triples in . A matching is a maximal submatching—a submatching with . Given a submatching , is the set of players contained in some triple in :
Each player holds preferences among all pairs of potential partners. That is, each holds a linear order on . We assume that each player prefers every pair to an empty assignment. Given a set of preferences for all the players and a submatching , we call a triple unstable if each of , and prefer the triple to their assigned triples in . Otherwise, we call stable. A submatching is stable if it contains no unstable triples in . We define the stability of by
Dually, the instability of is .
The maximally stable matching problem (PSA-MSM) is to find a matching which maximizes . The maximum stable submatching problem (PSA-MSS) is to find a stable submatching of maximum cardinality.
2.3Hardness of Gap-Dm-
Our proofs of Theorems ? and ? use a reduction from the three dimensional matching problem (DM). In this section, we briefly review DM, and state the approximability result we require for our lower bound results.
Let , and be finite disjoint sets with . Let be a set of edges. A matching is a set of disjoint edges. The maximum dimensional matching problem (Max-DM) is to find (the size of) a matching of largest cardinality in . Max-DM- is the restriction of Max-DM to instances where each element in is contained in at most edges. For a fixed constant , we define Gap-DM- to be the problem of determining if an instance of Max-DM- has a perfect matching (a matching of size ) or if every matching has size at most .
Kann showed that Max-DM- is Max-SNP complete
3Hardness of Approximation
In this section, we prove the main hardness of approximation results. Specifically, we will prove the following theorems.
3.1Preferences for GSM with Many Unstable Triples
We describe preferences for which every marriage has blocking triples below. Assuming is even, we partition each gender into two equal sized sets , , and
The sets appearing in the preferences indicate that the player prefers all pairs in that set (in any order) followed by the remaining preferences. For example, all prefer all partners , followed by all partners in , followed by all other pairs in arbitrary order. Within and , ’s preferences are arbitrary. The full proof of Theorem ? is given in Appendix B.
We now describe an embedding of DM- into G-MSM. Our embedding is a modification of the embedding described by Ng and Hirschberg . Let be an instance of DM- with ground sets and edge set . We assume . We will construct an instance of G-MSM with sets and of women, men and dogs of size and suitable preferences . We divide each gender into two sets , and where for . Let , and , and denote
Without loss of generality, we assume each is contained in exactly edges by possibly increasing the multiplicity of edges containing . For , we form sets
for . We now define preferences for each set of players, beginning with those in .
The players in have preferences given by
The preferences for are given by
The sets , and in the preferences described above indicate that all players in these sets appear consecutively in some arbitrary order in the preferences. Ellipses indicate that all remaining preferences may be completed arbitrarily. For example, most prefers , followed by and . She then prefers all remaining pairs in in any order, followed by all pairs in , followed by the remaining pairs in any order.
To prove the first claim assume, without loss of generality, that is a perfect matching in . It is easy to verify the marriage
contains no blocking triples, hence is a stable marriage.
For the second claim, let be an arbitrary marriage in . We observe that there are at least players and players that are not matched with pairs from their top three choices. Suppose to the contrary that players are matched with their top choices. This implies that more than women are matched in triples of the form with , implying that contains a matching of size , a contradiction. Thus at least women in are matched below their top three choices.
Let denote the set of women matched below their top three choices, and and the sets of partners of in . By the previous paragraph, . Further, the relative preferences of players in , and are precisely those described in Theorem ?. Thus, by Theorem , any marriage among these players induces at least blocking triples. Hence must contain at least
The reduction DM-GSM is easily seen to be polynomial time computable. Thus, by Lemma ?, is a polynomial time reduction from Gap-DM- to Gap-G-MSM where . The NP hardness of Gap-G-MSM is then an immediate consequence of Theorem ?.
The hardness of Gap-G-MSS is a consequence of the hardness Gap-G-MSM. Consider an instance of GSM with preferences . We make the following observations.
if and only if .
If for , then .
The first observation is clear. To prove the second, suppose that , and let be a maximum stable submarriage. We can form a marriage by arbitrarily adding disjoint families to . Since each new family can induce at most blocking triples, has at most blocking triples, hence . The two observations above imply that any decider for Gap-G-MSS is also a decider for Gap-G-MSM. Thus, the NP-hardness of Gap-G-MSM immediately implies the analogous result for Gap-G-MSS.
A sketch of the proof of analogous lower bounds for PSA is given in Appendix C.1.
In this section, we describe a polynomial time approximation algorithm for MSM, thereby proving Theorem ?. Consider an instance of GSM with preferences , and as before , , and . Given a triple , we define its stable set to be the set of (indices of) triples which cannot form unstable triples with . Specifically, we have
The idea of our algorithm is to greedily form families that maximize . Pseudocode is given in Algorithm ?.
It is easy to see that AMSM can be implemented in polynomial time. The naive algorithm for computing for fixed by iterating through all triples and querying each player’s preferences can be implemented in time . The maximal such can then be found by iterating through all . Thus the first step in AMSM can be accomplished in time . Finally, the recursive step of AMSM terminates after iterations, as each iteration decreases the size of , , and by one.
We will show that there exists a triple such that at least two of , , and respectively rank , , and among their top choices. Note that this occurs precisely when at least two of the the following inequalities are satisfied
Mark each triple which satisfies one of the above inequalities. Each induces marks, so we get marks from all . Similarly, we get marks from and . Thus, marks are placed on at least triples. By the pigeonhole principle, at least one triple is marked twice.
We claim that the triple satisfying two of the above inequalities satisfies equation ( ?). Without loss of generality, assume that satisfies the first two equations. Thus, and must each contribute at least stable triples with respect to . Further, at most such triples can be contributed by both and , as such triples must be of the form for . Thus ( ?) is satisfied, as desired.
We are now ready to prove that AMSM gives a constant factor approximation for the maximally stable marriage problem.
Let be the marriage found by AMSM, and suppose
where is the first triple found by AMSM, is the second, et cetera. By Lemma ?, . Therefore, the players , , and can be contained in at most unstable triples in any marriage containing the family . Similarly, for the th family can contribute at most new unstable triples (not containing any , , or for ). Thus, the total number of unstable triples in is at most
Thus, we have as desired.
A proof of the analogous result for PSA (Theorem ?) is given in Appendix C.2.
5Concluding Remarks and Open Questions
While AMSM gives a simple approximation algorithm for G-MSM, we do not generalize this result to G-MSS. Indeed, even the first two families output by AMSM may include blocking triples. We leave the existence of an efficient approximation for G-MSS as a tantalizing open question.
Finding an approximation algorithm for maximally stable marriage was made easier by the fact that any preferences admit a marriage/matching with stable triples. However, for G-MSS, it is not clear whether every preference structure admits stable submarriages of size . We feel that understanding the approximability of G-MSS is a very intriguing avenue of further exploration.
In our hardness of approximation results (Theorems ? and ?), we do not state explicit values of for which Gap-G-MSM and Gap-G-MSS (and the corresponding problems for three person stable assignment) are NP-complete. The value implied by our embedding of SAT- via DM- is quite close to . It would be interesting to find a better (explicit) factor for hardness of approximation. Conversely, is it possible to efficiently achieve a better than -factor approximation for maximally stable marriage/matching problems?
The preference structure described in the proof of Theorem ? (upon which our hardness of approximation results rely), there exist many quartets of pairs , , , and such that and . Thus does not consistently prefer pairs including to those including or vice versa. Ng and Hirschberg describe such preferences as inconsistent, and asked whether consistent preferences always admit a ( gender) stable marriage. Huang  showed that consistent preferences need not admit stable marriages, and indeed it is NP-complete to determine whether or not given consistent preferences admit a stable marriage.
AHardness of Gap-Dm-
The goal of this section is to prove Theorem ?, the NP hardness of Gap-DM-. In the first subsection, we review Kann’s reduction from Max-SAT- to Max--. In the following subsection, we describe how to modify Kann’s reduction in order to obtain Theorem ?.
Let be an instance of SAT-. Specifically, consists of a set of Boolean variables,
and a set of clauses
Each clause is a disjunction of at most literals, and each variable or its negation appears in at most clauses. For each , let denote the number of clauses in which or appears, where . Kann’s construction begins with the classical reduction from SAT to DM used to show the NP-completeness of DM, as described in . Each variable gets mapped to a ring of edges. The points of the ring correspond alternatingly to and . A maximal matching on the ring corresponds to a choice a truth value of : if the edges containing the vertices labeled are in the matching, this corresponds to having the value true; if the edges containing are chosen, this corresponds to taking the value false. See Fig ?.
In the classical construction, the points of the ring corresponding to are connected to clause vertices via clause edges which encode the clauses in . This is done in such a way that the formula is satisfiable if and only if the corresponding matching problem admits a perfect matching. The problem with this embedding, however, is that even if a relatively small fraction of clauses in can be simultaneously satisfied, the corresponding matching problem may still admit a nearly perfect matching.
To remedy this problem, Kann’s reduction maps each Boolean variable to many rings. The rings are then connected via a tree structure whose roots correspond to instances of in the clauses of . This tree structure imposes a predictable structure on the maximal matchings.
We denote the parameter
which is the number of rings to which each variable maps. We denote the “free elements”—the points on the rings—associate to by the variables
These vertices are connected to rings as in Figure ?. The rings are connected via tree edges in binary trees, such that for each fixed , are the leaves of a tree, and similarly for the . We label the root of this tree by or depending on the labels of the leaves. See Figure ?. We refer to the resulting structure for as the ring of trees corresponding to .
The root vertices are connected via clause edges to clause vertices. For each , we associate two clause vertices and . If is ’s -th clause in , then we include the edge
depending if or its negation appears in and the parity of the of the tree of rings. We denote the resulting instance of DM by . It is readily apparent from this construction that is in fact an instance of DM-: all vertices in the rings of trees are contained in exactly edges, while clause vertices are contained in at most edges. Further, the vertex set can be partitioned into a disjoint union such that each edge contains one vertex from each of these sets. Kann makes the following observations about the structure of optimal (maximum) matchings in .
As a consequence of Kann’s analysis of the optimal matchings in , he is able to show that is an -reduction from SAT- to DM-.
a.2Modification of Kann’s reduction
In this section, we describe a reduction SAT-DM- such that for each satisfiable instance of SAT-, admits a perfect matching. In the reduction above, even if is satisfiable, there may be many root vertices that are not in an optimal matching, . In particular, if a clause is satisfied by and , then at most one of the edges
can appear in . Hence, at most one of and can appear in . To remedy this problem, we define to be the disjoint union of three copies of
We then add an edge for each root vertex in that contains the corresponding root vertices in each disjoint copy of . Specifically, if , , and are the three copies in of a root vertex in , then we include the edge
in . We now describe the structure of optimal matchings in . Let , , and be the restrictions of an optimal matching for to , , and respectively. Thus, we can write
where contains those edges in of the form (Equation 1).
Suppose is an optimal matching for . We may assume without loss of generality that the matchings , and are all identical to some matching on . Indeed, if, say is the largest of the three matchings, we can increase the size of by replacing and with identical copies of . Since the only edges between , , and are edges of the form (Equation 1), replacing and with copies of cannot decrease the size of . Thus, we may assume that
where is some matching on , and consists of edges of the form (Equation 1).
We will now argue that is indeed an optimal matching on , hence has the form described in Lemma ?. Notice that if is optimal for , then by including all edges in containing uncovered root vertices, covers every ring, tree, and root vertex. Thus, the only way to obtain a larger matching would be to include more clause edges. However, by Lemma ?, including more clause edges cannot increase the size of the matching . Thus, we may assume is an optimal matching for .
We bound the number of ring, tree, and clause vertices separately. Since the vertex set of consists of three disjoint copies of the vertices in , it suffices to bound the number of vertices in .
- Ring vertices
For each variable , there are rings, each consisting of . Thus there are ring vertices for each variable , hence a total of ring vertices in .
- Tree vertices
Since each ring vertex of the form is the leaf of a complete binary tree whose internal nodes and root are tree vertices, there are tree vertices in .
- Clause vertices
There two vertices and associated to each of clauses, hence there are clauses in total.
Therefore, the total number of vertices in and hence is . Clearly, we may assume that , so that there are vertices in .
Theorem ? follows immediately from Corollary ? and the following incarnation of the PCP theorem.
BPreferences with Many Unstable Triples
We first consider the case where . We denote , , and . Consider preference lists as described in the following table, where most preferred partners are listed first.
The ellipses indicate that the remaining preferences are otherwise arbitrary. Suppose is a stable marriage for . We must have either or , for otherwise the triple is unstable. However, if , then is unstable. On the other hand, if then is unstable. Therefore, no such stable exists. In particular, every marriage contains at least one unstable triple.
The idea of the proof of Theorem ? is to choose preferences such that when restricted to many sets of two women, two men and two dogs, the preferences are as above. Thus any marriage containing families consisting of these players must induce unstable triples.
We partition the sets , and each into two sets of equal size: , , . Consider the preferences described in Section 3.1. We will prove that for , every matching contains at least unstable triples. Let be an arbitrary marriage, and suppose . We consider two cases separately.
- Case 1: .
Let , and be the subsets of , and respectively of players not in triples contained in . By the hypothesis, . Let . Notice that if , then is unstable for all , . Since fewer than triples in are unstable, at least dogs must have families .
Since , we must have . Thus, there must be at least women with partners not in . However, every such forms an unstable triple with every and which are not in families in . Since there at least such and , there are at least
blocking triples, a contradiction.
- Case 2: .
In this case, we must have . This implies that
for otherwise triples with form more than unstable triples. But (Equation 3) contradicts the Case 2 hypothesis, as .
Since both cases lead to a contradiction, we may conclude that any contains at least unstable triples, as desired.
CResults for Psa
In this appendix, we prove our main results for PSA, Theorems ? and ?.
c.1PSA hardness of approximation
As noted in Remark ?, we may view GSM as a special case of PSA with incomplete preferences. The NP-hardness of approximation of PSA with incomplete preferences is analogous to the proof of Theorem ?. Given an instance of GSM with sets , , and and preferences , take and form PSA preferences by appending the remaining pairs to arbitrarily. Analogues of Theorem ? and Lemma ? hold for this instance of PSA, whence Theorem ? follows. We leave details to the reader.
can easily be adapted for PSA. Let be a set of players with , and let be a set of complete preferences for the players in . Given a triple , we form the stable set consisting of triples that at least one of , , does not prefer to . The approximation algorithm ASA for PSA is analogous to AMSM: form a matching by finding a triple that maximizes , then recursing. The following lemma and its proof are analogous to Lemma ?.
Using Lemma ?, we prove Theorem ? analogously to Theorem ?.
Each triple can intersect at most blocking triples. Thus, by Lemma ?, the total number blocking triples in the matching found by ASA is at most
as the total number of triples in is . Hence is a -approximation to a maximally stable matching, as desired.
- Assuming, of course, PNP!
- The complexity class Max-SNP was introduced by Papadimitriou and Yannakakis in , where the authors also show that Max-SAT- is Max-SNP complete.
- Nonexistence of stable threesome matchings.
Ahmet Alkan. Mathematical Social Sciences, 16(2):207–209, 1988.
- Proof Verification and the Hardness of Approximation Problems.
Sanjeev Arora, Carsten Lund, Rajeev Motwani, Madhu Sudan, and Mario Szegedy. J. ACM, 45(3):501–555, 1998.
- Probabilistic Checking of Proofs: A New Characterization of NP.
Sanjeev Arora and Shmuel Safra. J. ACM, 45(1):70–122, 1998.
- The PCP theorem by gap amplification.
Irit Dinur. Journal of the ACM (JACM), 54(3):12, 2007.
- College Admissions and the Stability of Marriage.
D Gale and L S Shapley. The American Mathematical Monthly, 69(1):pp. 9–15, 1962.
- Computers and Intractability: A Guide to the Theory of NP-Completeness.
Michael R. Garey and David S. Johnson. W. H. Freeman & Co., New York, NY, USA, 1979.
- The stable marriage problem: structure and algorithms, volume 54.
Dan Gusfield and Robert W Irving. MIT press Cambridge, 1989.
- Two’s Company, Three’s a Crowd: Stable Family and Threesome Roommates Problems.
Chien-Chung Huang. In Lars Arge, Michael Hoffmann, and Emo Welzl, editors, Algorithms – ESA 2007, pages 558–569. Springer Berlin Heidelberg, 2007.
- Stable marriage with ties and bounded length preference lists.
Robert W Irving, David F Manlove, and Gregg O’Malley. Journal of Discrete Algorithms, 7(2):213–219, 2009.
- Stable marriage with incomplete lists and ties.
Kazuo Iwama, Shuichi Miyazaki, Yasufumi Morita, and David Manlove. In Automata, Languages and Programming, pages 443–452. Springer, 1999.
- Maximum bounded 3-dimensional matching is MAX SNP-complete.
Viggo Kann. Information Processing Letters, 37(1):27–35, 1991.
- Better and simpler approximation algorithms for the stable marriage problem.
Zoltán Király. Algorithmica, 60(1):3–20, 2011.
- Linear time local approximation algorithm for maximum stable marriage.
Zoltán Király. Algorithms, 6(3):471–484, 2013.
- Stable marriage and its relation to other combinatorial problems: An introduction to the mathematical analysis of algorithms, volume 10.
Donald Ervin Knuth. American Mathematical Soc., 1997.
- Algorithmics of matching under preferences.
David Manlove. World Scientific Publishing, 2013.
- Three-Dimensional Stabl Matching Problems.
Cheng Ng and Daniel S Hirschberg. SIAM Journal on Discrete Mathematics, 4(2):245–252, 1991.
- Faster and simpler approximation of stable matchings.
Katarzyna Paluch. Algorithms, 7(2):189–202, 2014.
- Optimization, approximation, and complexity classes.
Christos H Papadimitriou and Mihalis Yannakakis. In Proceedings of the Twentieth Annual ACM Symposium on Theory of Computing, pages 425–440, New York, NY, USA, 1991. ACM.
- Two-sided matching: A study in game-theoretic modeling and analysis.
Alvin E Roth and Marilda A Oliveira Sotomayor. Cambridge University Press, 1992.
- Approximation algorithms for stable marriage problems.
Hiroki Yanagisawa. PhD thesis, Kyoto University, Graduate School of Informatics, 2007.