Matching under preferences is a rich topic central to both economics and computer science, which has been consistently and intensively studied for over several decades. One of the main reasons for interest in this topic stems from the observation that it is extremely relevant to a wide variety of practical applications modeling situations where the objective is to match agents to other agents (or to resources). In the most general setting, a matching is defined as an allocation (or assignment) of agents to resources that satisfies some predefined criterion of compatibility/acceptability. Here, the (arguably) best known model is the two-sided model, where the agents on one side are referred to as men, and the agents on the other side are referred to as women. A few illustrative examples of real life situations where this model is employed in practice include matching hospitals to residents, students to colleges, kidney patients to donors and users to servers in a distributed Internet service. At the heart of all of these applications lies the fundamental Stable Marriage (SM) problem. In particular, the Nobel Prize in Economics was awarded to Shapley and Roth in 2012 “for the theory of stable allocations and the practice of market design.” Moreover, several books have been dedicated to the study of SM as well as optimization versions of this classical problem [17, 31, 33].
In this paper, we conduct a comprehensive study of four well-known NP-hard optimization versions of SM, namely the Sex-Equal SM (SESM), Balanced SM (BSM), max-SM with Ties (max-SMT) and min-SM with Ties (min-SMT) problems, from the viewpoint of Parameterized Complexity. Readers unfamiliar with the definitions of these problems are referred to Section 2. The sizes of the solutions to all of these problems can often be as large as the instances themselves. Furthermore, as these problems are NP-hard when preference lists are restricted to have a fixed constant length, the maximum length of a preference list is not a sensible parameter (see Appendix A). Thus, we parameterize these problems by the treewidth of the primal graph as well as the treewidth of the rotation digraph. Arguably, the parameter treewidth is the most natural one. Moreover, parameterization by treewidth is a standard practice in Parameterized Complexity. Indeed, from a practical point of view, networks often tend to resembles trees, and from a theoretical point of view, treewidth is often a parameter with respect to which it is possible to derive “fast” parameterized algorithms. Accordingly, books on Parameterized Complexity devote several complete chapters solely to the study of treewidth (see [5, 8, 40, 11]). Nevertheless, our work is the first to study the parameterized complexity of optimization versions of SM with respect to treewidth, although SM is a basic problem to both economics and computer science. In this sense, our work fills a fundamental knowledge gap. We obtain tight upper and (conditional) lower bounds for the running times of algorithms for all of the problems that we study. Moreover, each set of results (W-hardness, XP-algorithms, FPT-algorithms and tight conditional lower bounds under SETH) is derived in a novel systematic way that may apply not only to other optimization versions of SM, but also to other parameterization of the problems studied in the paper.
1.1 Related Work
Sex-Equality. The egalitarian measure, which minimizes the sum of the amount of dissatisfaction of men and that amount of dissatisfaction of women, is arguably the simplest notion of the quality of a stable matching. A stable matching minimizing this measure is known as an egalitarian stable matching, which is notably computable in polynomial time . Gusfield and Irving  noted that in the context of egalitarian stable matchings, it may be the case that members of one sex are considerably better off than the members of the opposite sex. Knuth discussed an example [31, pg 56] that had 10 stable matchings, each having an egalitarian function value of 20. However, the sex-equality function value (see Section 2.2) ranged from -12 to +12, with the optimal being 0. This motivated the definition of a sex-equal stable matching as a stable matching that minimizes the sex-equality function value. Gusfield and Irving  then asked whether there is a polynomial-time algorithm for SESM. Kato  was the first to show that SESM is NP-hard by showing a reduction from Partially Ordered Knapsack, one of the classical problems listed by Garey and Johnson . McDermid and Irving  proved that given an instance of SM, where the length of each preference list is at most 3, deciding whether or not there exists a stable matching whose sex-equal function value is 0, is NP-complete. Contrastingly, if the length of each preference list is at most 2 on one side while the length of each preference lists on the other side may be unbounded, then SESM is solvable in time , where denotes the number of men/women in the instance.
McDermid and Irving  also studied exact exponential-time algorithms for NP-hard special cases of SESM. Specifically, if the preference lists on one side have length at most and there is no upper bound on the length of the preference lists on the other side, then they showed that given any , SESM can be solved in time , where and . For small enough values of , the time complexity is close to for , for and for . Curiously, Romero-Medina  gave an exact algorithm for SESM where there are no restrictions on the preference lists and claimed without proof that the algorithm runs in polynomial time. While Romero-Medina did not cite Kato’s work , the claim is an obvious contradiction to Kato’s proof of NP-hardness (unless NP=P). Also, the time complexity of Romero-Medina’s algorithm is likely to be worse than McDermid and Irving’s when the length of the preference lists are bounded.
In the context of the approximability of SESM, for a given instance of SM, let and denote the man-optimal and woman-optimal stable matchings (see Section 2.1), respectively. We define , where denotes the sex-equal function value of the matching . Iwama et al.  gave a polynomial-time algorithm that finds a near-optimal solution to SESM. Formally, they showed that given some fixed , there is an time algorithm that returns a stable matching such that , or returns that no such exists. Furthermore, they exhibited an instance with two near-optimal stable matchings that have different egalitarian-cost measure. This prompted the authors to define the Minimum Egalitarian Sex-Equal Stable Marriage problem. For this problem, shown to be NP-hard, they gave a polynomial time algorithm whose approximation ratio is smaller than 2.
Balance. The BSM problem was introduced in the influential work of Feder  on stable matchings. Intuitively, it is defined to be a stable matching in the instance that is desirable to both the sexes (see Section 2.2), i.e. it simultaneously minimizes the dissatisfaction of both sexes. It has been noted that it is not trivial to construct an instance of SM in which no balanced stable matching is a sex-equal matching, and vice versa . However, one such example (of infinitely many instances), attributable to Eric McDermid, has been discussed by Manlove in [33, pg 109]. Feder  proved that this problem is NP-hard and that it admits a 2-approximation algorithm. Later, it was shown that this problem also admits a -approximation algorithm where is the maximum size of a set of acceptable partners . O’Malley  phrased the BSM problem in terms of constraint programming. McDermid, as reported in , proved that the measure of balance of BSM is incomparable to the measure of fairness of SESM. Finally, in the thesis of McDermid  and the conclusion of McDermid and Irving , the authors expressed interest in future studies of the BSM problem with respect to treewidth.
Maximum/Minimum Cardinality. When the preference lists have ties, there are three different notions of stability: super stability, strong stability and weak stability (see [23, 32]). Our work is centered around weak stability. In the presence of ties, the existence of a (weakly) stable matching is guaranteed; simply break the ties arbitrarily and run the Gale-Shapley algorithm  on the resulting instance. A stable matching in the new instance is (weakly) stable in the original instance. However, the breaking of ties affects the size of the stable matching produced. Thus, the size of the stable matchings are no longer exactly the same as in the case where preference lists are strict (see Section 2.1). This engenders the study of the computation of a maximum (minimum) cardinality stable matching, known as the max-SMT (min-SMT) problem, which capture scenarios where we would like to maximize (minimize) available resources.
Irving et al.  showed that both max-SMT and min-SMT are NP-hard even if the inputs are restricted to have ties for only one sex, preference lists are of bounded length, and there is symmetry in the preference lists. Irving et al.  showed that max-SMT is solvable in polynomial time if the length of the preference lists of one sex is at most 2, and the length of the preferences of the other sex is unbounded. Furthermore, it is shown that max-SMT is not -approximable unless , for some , even if each man’s preference list is of length at most 3, and each woman’s preference list is of length at most 4. Given the large “gap” in the computational complexity of these results, perhaps it is not surprising that this has led to the study of max-SMT from the perspectives of approximation and parameterized complexity.
In the context of approximation algorithms, note that it is easy to obtain a factor -approximation—break the ties arbitrarily, and return some stable matching in the resulting instance. A breakthrough was achieved by Iwama et al. , who obtained a factor -approximation algorithm for max-SMT using a local search technique. Király  improved upon this result, and introduced a simple effective technique of promotion to break ties in a modified Gale-Shapley algorithm. In particular, he improved the approximation ratio to for max-SMT, and to for the one-sided ties version of max-SMT, that is, the preference lists have to be strict on one side, while ties are permitted in the preference lists of the other side. For the one-sided version of max-SMT, Huang and Kavitha  gave an approximation algorithm with factor , and Dean and Jalasutram  gave an approximation algorithm with factor . The best known approximation algorithm for max-SMT is a factor -approximation algorithm in . References to additional works addressing approximation algorithms and inapproximabilty results for max-SMT can be found in .
Marx and Schlotter  studied max-SMT with several parameters: (i) the maximum number of ties in an instance (); (ii) the maximum length of ties in an instance (); (iii) the total length of the ties in an instance (). The authors showed that max-SMT is W-hard parameterized by , and FPTparameterized by . Furthermore, since it was shown that max-SMT is NP-hard even when the length of each tie is at most 2, we do not hope to have an algorithm with running time , for any functions and that depend only on .
Relatively less work has been done for min-SMT. Beyond what has been mentioned earlier, we would like to mention that lower bounds on the approximability of min-SMT has been discussed in Yanagisawa’s Masters thesis  and in the paper . Finally, we remark that experimental approaches have also been undertaken to study max-SMT. Munera et al.  gave an algorithm based on local search. Moreover, Gent and Prosser  formulated the problem as a constrained optimization problem and gave an algorithm via constrained programming for both decision and optimization version.
1.2 Our Contribution
Our contribution can be summarized in three main theorems, namely Theorems 1, 3 and 4. The proof of Theorem 2 is straightforward (unlike the other theorems), yet we present it for the sake of completeness. The approaches employed to establish each of these theorems are discussed in detail in Section 3. The principles underlying each of these approaches are quite general, and therefore they can be applicable to other parameterizations of these problems as well as to other problems related to SM. Here, we only present the statements of our findings. Our first set of results analyzes the parameterized complexity of the SESM, BSM, max-SMT and min-SMT problems with respect to the treewidth of the primal graph.
The SESM, BSM, max-SMT and min-SMT problems are all W-hard with respect to , the treewidth of the primal graph. Moreover, unless ETH fails, none of these problems can be solved in time for any function that depends only on .
Next, we observe that it is straightforward to derive XP-algorithms whose running times, in light of Theorem 1, are essentially tight.
The SESM, BSM, max-SMT and min-SMT problems are all solvable in time , where is the treewidth of the primal graph.
Due to the barrier posed by Theorem 1, we next turn to analyze the treewidth of the rotation digraph. Here, we only study SESM and BSM, as the rotation digraph is not defined in the context of max-SMT and min-SMT. On the positive side, we establish the following theorem.
The SESM and BSM problems are both solvable in time , where is the treewidth of the rotation digraph.
Finally, we prove that unless SETH fails, Theorem 3 pinpoints precisely the running times of FPT-algorithms for both SESM and BSM.
Unless SETH fails, neither SESM nor BSM is solvable in time for any fixed , where is the treewidth of the rotation digraph.
Thus, we present a comprehensive, complete picture of the behavior of central optimization versions of the SM problem with respect to the parameter treewidth of both the primal graph and the rotation digraph. (We remark that along the way, we thus also resolve open problems posed by McDermid  and McDermid and Irving .)
Standard graph-theoretic terms not explicitly defined here can be found in , and for standard notions in Parameterized Complexity, refer to Appendices A and B. Given a non-negative integer , we use and to denote the sets and , respectively. Given a function , and denote the domain and the image of , respectively.
2.1 Stable Marriage
In the classic Stable Marriage (SM) problem, the input consists of a set of men, , and a set of women, . The set of agents (men and women) is denoted by . The total number of agents, , is denoted by . Each man (woman) has a preference list, which is a list ranking a subset of (). More precisely, each man is assigned a subset and an injective function . Symmetrically, each woman is assigned a subset and an injective function .111Throughout our paper, we do not assume that each person must rank all people of the opposite sex. That is, we deal with the general case where preference lists may be incomplete. For emphasis, some papers add the letter “I” to the abbreviation SM, but for the sake of brevity, we avoid this addition. For all and , it holds that if and only if . The case where for every agent , the function may not be injective, is known as the SM with Ties (SMT) problem. In this generalization of SM, for every agent , the image of is restricted to be of the form for . The formulation of the objectives of SM and SMT relies on the notion of stability.
Given and an injective function , we say that a pair of a man and a woman such that is a blocking pair of if (i) and , or (ii) and , or (iii) and , or (iv) and .
Given and an injective function , we say that is a stable matching if for every , , and has no blocking pair.
Roughly speaking, a stable matching is a matching between a subset of men and a subset of women such that there does not exist a pair of a man and a woman who prefer each other to their matched partners (if at all such partners exist). To simplify our presentation, we use the notation to indicate that and it holds that . Moreover, we let denote the set of all stable matchings. In the seminal paper , Gale and Shapley showed that there always exists at least one stable matching.
Proposition 2.1 ().
The set is non-empty.
Thus, the objective of SM and SMT is to find a stable matching. However, there can be an exponential number of stable matchings . Notably, Gale and Sotomayor  showed that in the absence of ties, stable matchings do not differ in which men and women they match.
Proposition 2.2 ().
In SM, for all , and .
In the absence of ties, we denote and . Note that by Proposition 2.2, we have that and . Finally, we denote .
We also recall the notions of man- and woman-optimal stable matchings.
Proposition 2.3 ().
In SM, there is exactly one stable matching , denoted by , that minimizes . Symmetrically, there is exactly one stable matching , denoted by , that maximizes . Both and can be found in time .
We remark that is also the unique stable matching that maximizes , and is also the unique stable matching that minimizes . From now onwards, by Proposition 2.3, we assume that we have and at hand.
Finally, the primal graph of an instance of SM or SMI is the bipartite graph whose vertex set is and whose edge set is .
2.2 SM and SMT: Optimization
Sex-Equality and Balance. We first discuss the scenario where ties are forbidden, that is, we first present two optimization versions of SM. Here, the set of stable matchings, , can be viewed as a spectrum where the two extremes are the man-optimal stable matching and the woman-optimal stable matching. Naturally, it is desirable to analyze matchings that lie somewhere in the middle, being fair towards both sides or desirable by both sides. Deciding which notion best describes an appropriate outcome depends on the specific situation at hand. Here, the quantity is viewed as the “satisfaction” of in , where a smaller value signifies a greater amount of satisfaction. For a stable matching , the total satisfaction of men from is , and the total satisfaction of women from is .
In the Sex-Equal Stable Marriage (SESM) problem, we seek a stable matching that is fair towards both sides by minimizing the difference between their individual amounts of satisfaction. The formulation of this problem relies on the notion of the sex-equality measure:
The sex-equality measure is the function such that for all ,
The best value that this measure attains is . The objective of the SESM problem is to find a stable matching such that .222We only compute . By backtracking our computations, it is possible to construct a stable matching such that . This remark is also relevant to our algorithms for BSM, max-SMT and min-SMT.
In Balanced Stable Marriage, the objective is to find a stable matching that is desirable by both sides. Here, we rely on the notion of the balance measure, which is defined as follows.
The balance measure is the function such that for all ,
The best value that this measure attains is . The task of BSM is to find a stable matching such that . At first sight, this measure might seem conceptually similar to the previous one, but in fact, the two measures are quite different. Indeed, BSM examines the amount of dissatisfaction of each party individually, and attempts to minimize the worse one among the two. This problem fits the scenario where each party is selfish in the sense that it wishes to minimize its own dissatisfaction irrespective of the dissatisfaction of the other party. Here, our goal is to find a matching desirable by both parties by ensuring that each individual amount of dissatisfaction does not exceed some threshold. In some situations, the minimization of may indirectly also minimize , and vice versa, yet in general, this is not true. Indeed, it is known how to construct a family of instances where there does not exist any matching that is both a sex-equal stable matching and a balanced stable matching .
Maximum/Minimum Size. We now present two optimization versions of SMT. Here, the two (arguably) most natural objectives are to maximize or minimize the size of the outputted stable matching as it might be desirable to maintain stability while either maximizing or minimizing the use of available “resources”. These objectives define the well-known max-SMT and min-SMT problems. Formally, given an instance of SMT, the task of max-SMT is to find a stable matching of maximum size, and the task of min-SMT is to find a stable matching of minimum size. Here, the size of a matching is simply its number of matched pairs. We remark that due to Proposition 2.2, the study of both of these problems only makes sense in the presence of ties.
2.3 Rotation Digraph
First, we stress that the rotation digraph is a notion defined only in the context of SM, that is, in the absence of ties. Let us start by defining a rotation, which is an operation that transforms one stable matching to another. For this purpose, given and , we let denote the first woman succeeding in ’s preference list, such that or prefers over (if such a woman exists). Now, a rotation is defined as follows.
Let . A -rotation is an ordered sequence of pairs for some , such that for all , and . For all , we say that involves and .
When is immaterial or clear from context, the term rotation replaces the term -rotation. Given a -rotation , the elimination of is the operation that modifies by matching each with rather than . This operation results in a stable matching . Let denote the set of all sequences of pairs for which there exists such that is a -rotation. It is known that . Moreover, for all , the agents involved in belong to .
Proposition 2.4 ().
Let . There is a unique subset of , denoted by , such that starting with , there is an order in which the rotations in can be eliminated to obtain .
Irving and Leather  studied the rotation poset . Here, is a partial order on such that if and only if for every such that , as well. We say that is a closed set if there does not exist and such that . Moreover, given , we let denote the smallest closed set that contains . We also say that an order in which the rotations in are eliminated is -compatible if for all such that , is eliminated before . Roughly speaking, the rotation poset describes how every stable matching can be derived from the man-optimal stable matching. More precisely,
Proposition 2.5 ().
Let be a closed set. Starting with , eliminating the rotations in in any -compatible order is valid—at each step, where our current stable matching is some , the rotation that we eliminate next is a -rotation. Moreover, all -compatible orders in which one eliminates the rotations in result in the same stable matching.
Given , let denote the stable matching such that . By Proposition 2.5, this notation is well defined. Moreover, given , let denote the set of all rotations that involve . Our FPT algorithms will crucially rely on the following proposition.
Proposition 2.6 ().
For any , is a total order on .
Irving, Leather and Gusfield  studied digraphs that are a compact representation of . Specifically, we say that a digraph is the rotation digraph of , denoted by , if it is the directed acyclic graph (DAG) of minimum size whose transitive closure is isomorphic to .
Proposition 2.7 ().
The rotation digraph can be computed in time .
We let denote the underlying undirected graph of . In light of Proposition 2.7, when we design our algorithms, we may assume that we have and at hand.
In this section, we explain the main ingredients underlying our results.
W-Hardness Results. Our first set of results, given in Section 4, establishes Theorem 1. The source problem of the reductions developed in this section is the Multicolored Clique problem. Our four constructions share common features, which we believe to be relevant to other reductions meant to prove that optimization versions of SM and SMT are W-hard with respect to various structural parameters. First, all of our reductions introduce the same sets of “basic agents”. Roughly speaking, we introduce two basic men to represent each color class, two basic women to represent each vertex, and one basic woman to represent each edge. Second, the preference lists of the basic men representing color classes are set in a special form, to which we refer as the form of a leader. Informally, the preference lists of the two men representing a color class are distorted mirror images of one another. More precisely, each man among these two men ranks his own set of women representing vertices of the appropriate color class, where if we view the two women representing the same vertex as the same woman, then it is seen that the order in which one ranks these women is opposite to the order in which the other one ranks them. Both of these men “embed” in their preference lists women representing edges between women representing vertices, and both of them prefer a woman representing vertex over all women representing edges incident to . The third common feature is that all of our four reductions then proceed to introduce similar sets of agents that are meant to construct vertex and edge selection gadgets. In particular, in all of our reductions, the only interaction between vertex selector gadgets and edge selector gadgets is via the special men whose preference lists are of the form of a leader. Moreover, all of our reductions introduce quite similar definitions of “enriched” sets of agents who locally interact with basic agents. Hence, in all of our reductions, we ensure in a somewhat similar manner that basic agents, excluding those special men whose preference lists are of the form of a leader, can replace partners in a manner that does not enforce too many other “close-by” men to change partners as well in order to maintain stability.
The principles described above are quite general as we prove that they are useful for two natural “types” of optimization problems that may a priori seem different. The first type is the one where the challenge lies in the output that is enforced to comply with a satisfaction target value, and the second type is the one where the challenge lies in the input that is generalized to include ties while the output only needs to be either large enough or small enough. When we examine each type of problems separately, it is revealed that our reductions to SESM and BSM share many other similar ideas, and the same holds true when we compare our reductions to max-SMT and min-SMT. In fact, our reduction to BSM is a modification of our reduction to SESM where we carefully plug-in different numbers of “dummy agents” into the preference lists of some “central” agents to manipulate the different men to choose partners in a coordinate manner without relying on stability, but merely on subtle analysis of the satisfaction value.
For a concrete illustrative example, let us give a high-level overview of other elements incorporated in one of our reductions, namely, the reduction to SESM. Here, we begin by introducing the so called Original Vertex Selector gadget, which is a structure where one man representing a color class selects one woman representing a vertex of that color class as his partner. The selection of the partners of the women representing all other vertices of that color class is done locally by introducing an enriched set of men. Then, we introduce the Mirror Vertex Selector gadget, which handles the other man representing the same color class in an almost symmetric manner. By embedding dummy agents into the preference lists of the basic agents involved in Original and Mirror Vertex Selector gadgets, we can ensure that in all of these gadgets together, a predetermined number of men would be matched to their most preferred women. We remark that the ability to set such a predetermined value is crucially dependent on the fact that each color class is represented by two gadgets. Next, to ensure that the two gadgets representing a color class are consistent (in the sense that the two men representing the same color class are matched to women representing the same vertex), we introduce a new special gadget per vertex , called the Consistency gadget. This gadget consists of only four agents, where one of the men in this gadget ranks both women (outside the gadget) that represent the vertex . Here, we need to ensure that among all of the gadgets representing the same color class, the “configuration” of exactly one gadget will be such that its men will not attain their best partner. Here, the gadgets cannot interact directly by introducing, for example, new common agents that agents of different Consistency gadgets would rank, as we need to ensure that the treewidth of the primal graph of the output instance is small. Hence, to coordinate between these gadgets, we rely on carefully chosen numbers of dummy agents that are added to the preference lists of their agents. The numbers involved in this gadget are of a different magnitude than those involved in the Original and Mirror Vertex Selector gadgets. However, we cannot also assign each color class a number of a different magnitude, as then we would end up assigning numbers of magnitudes such as , which means that we would need to insert dummy agents and hence the construction would not be done in “FPT time”. Nevertheless, we are able to overcome this difficulty by using a simple equation that has a unique solution of the form that we want, and using the appropriate coefficients as a guide for the number of dummy agents to be inserted.333By using a different equation, we are able to reuse our construction in the context of BSM, and hence it seems like the applicability of our construction is quite broad (where one only needs to be able tune the equation according to the target measure at hand).
Afterwards, we introduce the Edge Selector gadget. Here, we define one gadget per edge, which involves the woman representing that edge. Such a gadget indicates that an edge has been selected by being in the configuration where the woman representing the edge has not attained her best partner. Notice that unlike the previously discussed gadgets, which are analyzed from the perspective of the men, these gadgets are analyzed from the perspective of the women. In particular, while in the Consistency gadgets the total satisfaction of women is forced to be low, here the total satisfaction of the women would be forced to be high. However, we stress that this difference is not employed to attain a certain target value, but it is used to control which matchings are stable and to avoid introducing any form of direct interaction between Edge Selector gadgets and Consistency gadgets (which is necessary to ensure that the treewidth of the output is small). In particular, having set up all of the previously mentioned gadgets, we still encounter a significant imbalance between the satisfaction of men and women in the stable matchings of the form that we would like to represent solutions. However, this issue is easily handled by introducing “garbage collector” agents which counterweight this imbalance properly.
XP-Algorithms. Our second set of results, given in Section 5, establishes Theorem 2. The proof of this theorem is based on a standard application of the method of dynamic programming over nice tree decompositions, and it is sketched in this paper only for the sake of completeness.
FPT-Algorithms. Our third set of results, given in Section 6, leads to the establishment of Theorem 3. For this purpose, we present an approach that deviates from standard applications of DP over tree decompositions. First, the proof of its correctness integrates new insights into the structure of rotation digraphs that might be of independent interest. To formulate these insights, we introduce new notions that may be adapted to tackle other optimization versions of SM. Second, while in standard DP elements that have not yet been examined determine only how to extend/modify partial solutions, in our DP such elements (rotations) are part of the partial solutions themselves. Thus, we need to design a delicate mechanism that maintains consistency between the manner in which we handled rotations in the bags below the current one, and the manner in which we anticipate handling rotations in other bags. Third, we face difficulties stemming from the fact that to update partial solutions, we need to change the assignments of women to men that correspond to these partial solutions, yet the information we have at hand does not directly reveal the assignments. By associating a directed path with each man, and tracing the manner in which the path “enters and leaves” every bag of the tree decomposition, we are able to deduce sufficient information on the assignments. We remark that this solution introduces yet another difficulty, namely, the need to store and maintain “illegal scores” that are associated with assignments of several men to the same woman.
We proceed with a more detailed description of some ingredients of our approach. First, to unify the principles underlying our approach, we introduce a problem more generic than SESM and BSM,444By analyzing SESM and BSM separately, we also show how to speed-up the generic algorithm. where the objective is to determine, for all , whether there exists such that both and . To describe our approach compactly, we note that a state is a pair where and . Moreover, is said to be compatible with a state if . Now, to design our algorithm, we first observe that each man can be associated with a directed path of whose vertex-set is a superset of . With respect to a given state, we then proceed to introduce special “entry” and “exit” points for each man, based on the directed path associated with him. These special points allow us to further identify a subpath of the path of each man that captures the current most updated information that we have about his partner, where the internal vertices (which are rotations) of the paths encompass all changes that might occur when we analyze future states. We are then able to define exactly which men have been already settled with a partner. Next, again with respect to a given state, but also with respect to a stable matching , we assign a woman to each man. This woman may be either the same one that assigns to (if is settled) or some specific woman whose choice is based on the most updated information we could extract. We remark that such an assignment, due to inherent uncertainties at intermediate steps of the computation, may assign several men to the same woman. Having assigned tentative partners to men, we are able to introduce definitions related to tentative amounts of satisfaction.
The description above sets the background for the study of our algorithm. The algorithm itself is very short and easily implementable. The computation simply fills a table that consists of Boolean entries of the form N, where , and . Here, N if and only if there exists that is compatible with the state and where the “tentative” amounts of satisfaction of men and women are and , respectively. We stress that these amounts of satisfaction are not and (such amounts simply cannot be computed when we handle the entry N since we do not have enough information at hand at that point to extract them). In the computation of an introduce node, in particular, we need to correct our tentative amounts of satisfaction. Having defined the algorithm, the technical part of the analysis begins. Here, we need to carefully analyze each type of node of the nice tree decomposition, and prove that the definitions we have set up as background indeed allow us to trace the paths of the men correctly, and to obtain precise amounts of satisfaction at the end. In this context, we present a sequence of lemmata (for each type of node) that verify consistencies between types of men, partners and tentative amounts of satisfaction deduced for the current node and for the child(ren) of the current node.
Lower Bounds Based on SETH. Our last set of results, given in Section 7, establishes of Theorem 4. Here, by plugging in coefficients associated with two different equations to (essentially) the same construction, we are able to handle both SESM and BSM. Let us now give a high-level overview of the reduction to SESM. We remark that some ideas relevant to our W-hardness results also underlie the proofs of our SETH-based results, yet here we also introduce several new ideas on top of them. The source problem of our reduction is the -Sparse -CNF-SAT problem (for some appropriate choice of and ), which is the special case of CNF-SAT where the size of each clause is at most and there are at most clauses in total.
We begin by partitioning the set of all clauses into a “large” number of (pairwise-disjoint) small sets of clauses, where the size of each small set of clauses is fixed according to and . The necessity of having this partition stems from our need to ensure that the number of dummy agents that we need to insert into preference lists of other agents would not be too large (yet we would still need an exponential number of dummy agents). For the sake of clarity of explanation, let us think of each small set of clauses as a color class. For each color class , we enumerate all truth assignments that satisfy all of the clauses of that color . Each such truth assignment is represented by two sets of variables, the true set and the false set, where the first contains all those variables that the assignment sets to true and which appear in clauses of color , and the second contains all those other variables appearing in clauses of color . Each variable is represented by two basic agents called and , each true set associated with color class , indexed by in that color class, is represented by two basic agents called and , and each false assignment associated with color class , indexed by in that color class (where the two sets indexed in the same color class correspond to the same truth assignment), is represented by two basic agents called and . In addition to these agents, we also employ two “garbage collector” agents who are meant to counterweight imbalance in satisfaction of men and women that is present in “desirable configurations” of the gadgets described below.
For each variable , the Variable Selector gadget consists of four agents, the basic agents and as well as two “enriched” agents, and . The enriched agents do not rank any agent outside the gadget, and their sole purpose is to allow the gadget to encode two internal configurations, one where is matched to (while is matched to ), and the other where is matched to while is matched to . Having two such local agents also enables us to allow a basic agent to rank some other basic agent and yet and would never be matched to one another in any stable matching. The first configuration indicates that should be assigned false, while the second one indicates that should be assigned true. The man is defined to prefer all women representing false sets that contain to the woman , while the woman is defined to prefer all men representing true sets that contain to the man .
Next, for every true set, we introduce the Truth Selector gadget, which in addition to and , consists of the two enriched agents and . Here, the configuration where is matched to indicates that the truth assignment is selected, and the configuration where is not matched to indicates that the truth assignment is not selected. To ensure that for each color class, exactly one truth assignment would be selected, we insert dummy agents into the preference lists of the basic agents of Truth Selector gadgets whose numbers correspond to the coefficients of a certain equation. While the number color classes is large, it is still significantly smaller than , and thus the magnitute of the numbers involved is small enough for our purpose. The man is defined to prefer to for all women that rank , thus ensuring that if the truth assignment in which he is involved is selected, all of the appropriate Variable Selector gadgets would have to be selected as well to maintain stability. Moreover, is also defined to prefer all women for over (the purpose of this setting would be clarified below).
Finally, for every false set, we introduce the False Selector gadget, which in addition to and , consists of the two enriched agents and . Here, unlike the previous gadgets, the configuration where is matched to indicates that the truth assignment is not selected, and the configuration where is not matched to indicates that the truth assignment is selected. The woman is defined to prefer to for all men that rank , thus ensuring that if the truth assignment in which she is involved is selected, all of the appropriate Variable Selector gadgets would have to not be selected to maintain stability. Moreover, is also defined to prefer all men where to . This ensure that if the current false set is selected, the only true set of the same color class that can be selected is the one that is complementary to this false set. We remark that to further conveniently control the selection of false sets, we also insert dummy agents into the preference lists of their basic agents.
Having defined the reduction, we proceed to precisely characterize every stable matching of the output. Then, we are also able to precisely identify which set of rotations gives rise to which stable matching. Overall, we can then explicitly construct the rotation digraph of the output. In our proof, for the sake of simplicity, we actually construct a supergraph of the rotation digraph. We are thus able to show that the rotation digraph of our instance is simply a DAG with three layers such that the middle layer contains exactly vertices, and that if we remove the middle layer from that graph, the subgraph that remains is just a collection of “small” connected components—roughly speaking, each such connected component would be a representation of one color class. Hence, we are able to conclude that the treewidth (of the underlying undirected graph) of the rotation digraph is not much larger than .
4 Primal Graph: W-Hardness
In this section, we prove Theorem 1, based on the approach described in Section 3. Throughout this section, the notation refers to the treewidth of the primal graph. The source of our reduction is Multicolored Clique, which is defined as follows. The input of Mulicolored Clique consists of a graph , a positive integer , and a partition of , where for all , . Here, the parameter is . For every index , the set is called color class . The task is to decide whether contains a clique that consists of exactly one vertex from each color class. We denote and . Moreover, for every color class , we denote , and for every two color classes where , we denote and . Accordingly, we denote . For every vertex , we denote the set of edges incident to in by . We assume w.l.o.g. that . Furthermore, we implicitly assume that is significantly larger than (else the problem is solvable by a parameterized algorithm). For our purpose, it is sufficient to assume that .
The Multicolored Clique problem is W-hard with respect to . Moreover, unless ETH fails, Multicolored Clique cannot be solved in time for any function that depends only on .
Each section below is devoted to one reduction.
4.1 Sex Equal Stable Marriage
First, we prove that SESM is W-hard, and that unless ETH fails, SESM cannot be solved in time for any function that depends only on .
Let be an instance of Multicolored Clique. We now describe how to construct an instance of SESM.
Basic Agents. We introduce the following sets of basic agents, which would be part of all of our reductions.
. Each man would be the basic vertex that represents color class .
. Each man would be the basic vertex that is the mirror of the vertex .
For every color class , . Each woman would be the basic vertex that represents the selection of .
For every color class , . Each woman would be the basic vertex that is the mirror of the vertex .
For every two color class where , . Each woman would be the basic vertex that represents the selection of .
Moreover, in all of our reductions, the preference lists of the men in would be of the following form, which we call the form of a leader since, roughly speaking, women representing edges incident to some vertex would follow the woman representing with respect to their positions in preference lists. Formally, for every color class , the preference lists of and satisfy the four following conditions.
For every index where and edge , , and if , then . The internal ordering of all women representing edges in is arbitrary.
For every index where and edge , , and if , then . The internal ordering of all women representing edges in is arbitrary.
We are now ready to present the gadgets employed by our reduction.
Original Vertex Selector. For every color class , our first set of gadgets introduces the following set of new men: . Here, the abbreviation “enr” stands for the word “enriched”. Each man would be the basic vertex most preferred by the woman . The preference lists of the new men are defined as follows. For every index , set , and . Moreover, for every index , set . Finally, for every index , set .
Notice that so far, we have finished defining exactly which agents in rank which other agents in this set as well as what is the order in which they rank them (although we have not yet finished defining the preference lists of some of the agents in this set). For an illustration of the Original Vertex Selector gadget, the reader is referred to Fig. 1.
Mirror Vertex Selector. For every color class , our second set of gadgets introduces the following set of new men: . Each man would be the basic vertex most preferred by the woman . The preference lists of the new men are defined as follows. For every index , set , and . Moreover, for every index , set . Finally, for every index , set .
Thus, we have so far finished defining exactly which agents in rank which other agents in this set as well as what is the order in which they rank them. For an illustration of the Mirror Vertex Selector gadget, the reader is referred to Fig. 1.
Consistency. We would next like to ensure that for all , would matched to if and only if would be matched to . For this purpose, we insert the Consistency gadgets. Here, for every color class , we introduce two sets of new men, and , and two sets of new women, and . For all and , we set the preference lists of , , and as follows. First, let us set the preference list of .
The intersection of with the set of all agents, excluding the happy agents defined later, is exactly , and .
If , then excluding happy agents, the intersection of with the set of all agents, excluding the happy agents defined later, is exactly , and .
The intersection of with the set of all agents, excluding the happy agents defined later, is exactly , and .
Second, let us set the preference lists of , and .
, and .
The intersection of with the set of all agents, excluding the happy agents defined later, is exactly , and .
, and .
For all and , we are now ready to explicitly define the preference lists of and as follows. First, let us define the preference list of .
, and .
If , then excluding happy agents, the intersection of with the set of all agents is exactly , and .
The intersection of with the set of all agents, excluding the happy agents defined later, , and .
Second, let us define the preference list of .