Stable Matching with Uncertain Linear Preferences

We consider the two-sided stable matching setting in which there may be uncertainty about the agents’ preferences due to limited information or communication. We consider three models of uncertainty: (1) lottery model—for each agent, there is a probability distribution over linear preferences, (2) compact indifference model—for each agent, a weak preference order is specified and each linear order compatible with the weak order is equally likely and (3) joint probability model—there is a lottery over preference profiles. For each of the models, we study the computational complexity of computing the stability probability of a given matching as well as finding a matching with the highest probability of being stable. We also examine more restricted problems such as deciding whether a certainly stable matching exists. We find a rich complexity landscape for these problems, indicating that the form uncertainty takes is significant.


Introduction
We consider a Stable Marriage problem (SM) in which there is a set of men and a set of women. Each man has a linear order over the women, and each woman has a linear order over the men. For the purpose of this paper we assume that the preference lists are complete, i.e., each agent finds each member of the opposite side acceptable. 1 In the stable marriage problem, the goal is to compute a stable matching; a matching where no two agents prefer to be matched to each other rather than to be matched to their current partners. Unlike most of the literature on stable matching problems [13,19,27], 1 We note that the complexity of all problems that we study is the same for complete and incomplete lists, where non-listed agents are deemed unacceptable-see Proposition 1 in Sect. 3.1.
A preliminary version of this paper has appeared in the proceedings of the 9th International Symposium on Algorithmic Game Theory (SAGT 2016) [2]. The majority of the claims appear without a proof or with only a short proof sketch in Aziz et al. [2].
Extended author information available on the last page of the article we assume that men and women may have uncertainty in their preferences which can be captured by various probabilistic uncertainty models. We focus on linear models in which each possible deterministic preference profile is a set of linear orders.
Uncertainty in preferences could arise for a number of reasons, both practical or epistemological. For example, an agent could express a weak order because the agent did not invest enough time or effort to differentiate between potential matches and therefore one could assume that each linear extension of the weak order is equally likely; this maps to our compact indifference model. In many real applications, the ties are broken randomly with lotteries, e.g., in the school choice programs in New York and Boston as well as in centralized college admissions in Ireland. However, a central planner may also choose a matching that is optimal in some sense, without breaking the ties in the preference list. For instance, in Scotland they used to compute the maximum size (weakly) stable matching to allocate residents to hospitals [19]. Alternatively, there may be a cost associated with eliciting preferences from the agents, so a central planner may want to only obtain and provide a recommendation based on a subset of the complete orders [9,24]. Another cause of uncertainty could be that agents are certain about preferences over other agents according to specific criteria but there may be a probability distribution corresponding to the weight placed on different criteria. This motivates our lottery and joint probability models. In the lottery model, the agents have independent probabilities over possible linear orders, i.e., each linear order may correspond to a different criterion. In the joint probability model, the probability distribution is over possible preference profiles.
Uncertainty in preferences has already been studied in voting [15] and for cooperative games [18]. Ehlers and Massó [10] considers many-to-one matching markets under a Bayesian setting. Similarly, in auction theory, it is standard to examine Bayesian settings in which there is a probability distribution over the types of agents. In the two-sided matching setting, when preferences are uncertain, a natural solution is finding a matching which has the highest probability of being stable. We consider this fundamental computational problem and its related variants for the three uncertainty models discussed above.
To illustrate the problem, we describe a simple example with four agents. We write b a c to say that agent a prefers b to c and assume the lottery model.
This setting admits two matchings that are stable with positive probability: μ 1 = {(m 1 , w 1 ), (m 2 , w 2 )} and μ 2 = {(m 1 , w 2 ), (m 2 , w 1 )}. Notice that if each agent submits the preference list that s/he finds most likely to be true, then the setting admits a unique stable matching that is μ 2 . The probability of μ 2 being stable, however, is 0.48 whereas the probability of μ 1 being stable is 0.52 (Tables 1, 2).

Uncertainty Models
In this article, we consider three different uncertainty models which assume that agents have linear preferences. In related work we have explored similar computational questions when agents define their uncertainty over pairwise preferences [3].
• Lottery Model For each agent, we are given a probability distribution over strict preference lists. • Compact Indifference Model Each agent reports a single weak preference list that allows for ties. Each complete linear order extension of this weak order is assumed to be equally likely. • Joint Probability Model A probability distribution over preference profiles is specified.
Note that for the Lottery Model and the Joint Probability Model the representation of the input preferences can be exponentially large (in the number of agents). However, in settings where similar models of uncertainty are used, including resident matching [9] and voting [15], a limited amount of uncertainty (i.e. small supports) is commonly expected and observed in real-world data [21,22]. Consequently, we consider special cases when the uncertainty is bounded in certain natural ways, including the existence of only a small number of uncertain preferences and/or uncertainty on only one side of the market.
Observe that the compact indifference model can be represented as a lottery model. This is a special case of the lottery model in which each agent expresses a weak order over the candidates, similar to the SMT setting [13,19]. However, the lottery model representation can be exponentially larger than the compact indifference model; for an agent that is indifferent among n agents on the other side of the market, there are n! possible linearly ordered preferences. The uncertainty models considered in the paper have further been examined in the context of Pareto optimal assignment of items to agents [4][5][6]. In a subsequent paper, Chen et al. [7] consider additional problems related to the joint probability model. in P for all three models if 1 side is certain in P for all models if 1 side is certain and there is O(1) number of uncertain agents

Computational Problems
Given a stable marriage setting where agents have uncertain preferences, various natural computational problems arise. Let stability probability denote the probability that a matching is stable. We then consider the following two natural problems for each of our uncertainty models.
• StabilityProbability Given a matching and uncertain preferences of the agents, what is the stability probability of the matching? • MatchingWithHighestStabilityProbability Given uncertain preferences of the agents, compute a matching with the highest stability probability. We also consider two specific problems that are simpler than StabilityProbability: • IsStabilityProbabilityNon-Zero For a given matching, is its stability probability non-zero? • IsStabilityProbabilityOne For a given matching, is its stability probability one? We additionally consider problems connected to, and more restricted than, Match-ingWithHighestStabilityProbability • ExistsCertainlyStableMatching Does there exist a matching that has stability probability one? • ExistsPossiblyStableMatching Does there exist a matching that has non-zero stability probability? Note that ExistsPossiblyStableMatching is straightforward to answer for any of the three uncertainty models we consider here, since there exists a stable matching for each deterministic preference profile that is a possible realization of the uncertain preferences. Table 3 summarizes our main findings. Note that the complexity of each problem is considered with respect to the input size, and that under the lottery and joint probability models the size of the input could be exponential in n, namely O(n!·2n) for the lottery model and O((n!) 2n ) for the joint probability model, where n is the number of agents on either side of the market.

Results
We point out that StabilityProbability is #P-complete for the lottery model even when each agent has at most two possible preferences, but in P if one side has certain preferences. Additionally, we show that IsStabilityProbabilityNon-Zero is in P for the lottery model if each agent has at most two possible preferences. Note that StabilityProbability is open for the compact indifference model when both sides may be uncertain, and we also do not know the complexity of MatchingWithHigh-estStabilityProbility in the lottery model, except when only a constant number of agents are uncertain on the same side of the market.

Preliminaries
In the Stable Marriage problem, there are two sets of agents. Let M denote a set of n men and W a set of n women. We use the term agents when making statements that apply to both men and women, and the term candidates to refer to the agents on the opposite side of the market to that of an agent under consideration. Each agent has a linearly ordered preference over the candidates. An agent may be uncertain about his/her linear preference ordering. Let L denote the uncertain preference profile for all agents.
We say that a given uncertainty model is independent if any uncertain preference profile L under the model can be written as a product of uncertain preferences L a for all agents a, where all L a 's are independent. Note that the lottery and the compact indifference models are both independent, but the joint probability model is not.
A matching μ is a pairing of men and women such that each man is paired with at most one woman and vice versa; defining a list of (man, woman) pairs (m, w). We use μ(m) to denote the woman w that is matched to m and μ(w) to denote the match for w. Assume that each agent prefers being matched to remaining unmatched. Given linearly ordered preferences, a matching is stable if there is no pair (m, w) not in μ where m prefers w to his partner in μ, i.e., w m μ(m), and vice versa. If such a pair exists, it constitutes a blocking pair; as the pair would prefer to defect and match with each other rather than stay with their partner in μ. A matching μ is a complete matching if all agents are matched in μ. A matching is certainly stable if it is stable with probability 1. For an instance I = (M, W , L) and matching μ, let p(μ, I ) denote the probability of μ being stable, and let p S (I ) = max{ p(μ, I ):μ is a matching in I }, that is the maximum probability of a matching being stable for I .
The following extensions of SM will come in handy in proving our results. The Stable Marriage Problem with Partially Ordered Lists (SMP) is an extension of SM in which agents' preferences are partial orders over the candidates. An instance I = (M, W , p) of SMP is given by a set of n men M, a set of n woman W , and the partial preference ordering profile of agents p where p a denotes the partial order that represents the preferences of agent a. If for a given agent a and two candidates b and c we have that neither b is related to c nor c is related to b then a cannot compare b and c. The Stable Marriage problem with Ties (SMT) is a special case of SMP in which incomparability is transitive and is interpreted as indifference. Therefore, in SMT each agent partitions the candidates into different ties (equivalence classes), is indifferent between the candidates in the same tie, and has strict preference ordering over the ties. In some practical settings some agents may find some candidates unacceptable and prefer to remain unmatched than to be matched to the unacceptable ones. SMP with Incomplete Lists (SMPI) and SMT with Incomplete lists (SMTI) captures these scenarios where each agent's partially ordered list contains only his/her acceptable candidates. Three stability criteria, including the one we have already defined, have been introduced in the literature to capture different degrees of stability for these richer domains. The weakest criterion, that is the one we have already defined, is (weak) stability. A matching is (weakly) stable in an instance of SMPI if there is no pair (m, w) / ∈ μ where m (strictly) prefers w to his partner in μ and vice versa. The strongest criterion, referred to by super-stability, is closely related to our notion of certain stability. A matching is super-stable in an instance of SMPI if there is no pair (m, w) not in μ where m either prefers w to his partner in μ or finds them incomparable, and vice versa. If such a pair exists, it constitutes a very weakly blocking pair. It is easy to observe (see, e.g., [17]) that μ is super-stable if and only if it is stable w.r.t. all linear extensions of the partially ordered lists.
We define the certainly preferred relation cert a for agent a.  Proof Assume that for each pair (m, w) we have that μ(m) ∈ D m (w) or μ(w) ∈ D w (m) for a given matching μ. This implies that for each unmatched pair (m, w) it is the case that μ(m) cert m w or μ(w) cert w m and hence (m, w) has zero probability of forming a blocking pair. It thus follows that μ is certainly stable.
Assume that a matching μ is certainly stable. Then no pair (m, w) has non-zero probability of forming a blocking pair. This is only possible if the pair (m, w) is part of the matching or one of m and w have zero probability of preferring the partner in (m, w) over their current partner in μ. In either case, μ(m) ∈ D m (w) or μ(w) ∈ D w (m).
We point out that the certainly preferred relation can be computed in polynomial time for all three models studied in this paper.

General Results
In this section, we first show that the complexity of all problems that we study is the same for complete and incomplete lists. We then present some general results that apply to multiple uncertainty models. We show that ExistsCertainlyStableMatching can be solved in polynomial time for a class of independent uncertainty models that includes lottery and compact indifference. We then prove that, when the number of uncertain agents is constant and one side of the market is certain, we can solve Match-ingWithHighestStabilityProbability efficiently for each of the linear models.

The Case for Incomplete Lists
The claims in this section explain that our efficient algorithms described for the case of complete lists can be extended to incomplete lists. Additionally, our hardness proofs for incomplete lists can be modified to extend to complete lists. In fact, all our hardness reductions, except Theorem 9, are for complete lists and so they trivially extend to the case of incomplete lists.
In the case of complete lists, we assumed that we have an equal number of men and women and everybody finds all candidates acceptable. When we consider the problem with incomplete lists we mean that the sizes of the two sets are not necessarily the same and not all the candidates are acceptable to all agents. However, we assume that in all realization of the preference profiles the same candidates are acceptable, so we only randomize on the preferences over the acceptable partners.

Proposition 1 The computational complexity of StabilityProbability is the same for complete and incomplete lists.
Proof We show that if I is an instance of a linear probabilistic model with incomplete lists and μ is a given matching for I then we can, in linear time, construct an extended instance I with complete lists and a complete matching μ for I such that the stability probability of μ under I , p(μ, I ), is equal to the stability probability of μ under I , p(μ , I ).
Assume, without loss of generality, that |M| ≥ |W |. From I we create an extended instance I with sets M and W in the following way. First we ensure that |M| = |W | by adding enough agents to the woman's side of the market if necessary. Then we complete the preference lists of each agent by adding the previously unacceptable or nonexistent candidates to the end of her/his list according to a predetermined order, e.g., by the indices of the agents. Suppose now that μ is a matching in I and X is the set of matched men in M, whilst μ(X ) = Y . Let E denote the set of acceptable pairs in I . We assume that there is no pair (m, w) ∈ (M\X ) × (W \Y ) belonging to E, since in this case this pair would certainly block μ in I , thus p(μ, I ) = 0 trivially. Let us now extend μ to another matching μ in I by appending to μ the unique stable matching for the subinstance restricted to the unmatched agents. Namely, let μ u be the stable matching that matches M\X to W \Y in such a way that the kth pair contains the kth man and the kth woman from M\X and W \Y , respectively according to their indices, and let μ = μ ∪ μ u .
We claim that p(μ, I ) = p(μ , I ). This is because there is no blocking pair in (M\X ) × (W \Y ), and any other pair is blocking for some preference profile in I if and only if it is blocking for the corresponding preference profile in I . To verify the latter statement, first consider a pair (m, w) ∈ X ×Y . If (m, w) ∈ E then the partners of m and w are the same in μ and μ and the ranks of m are the same in the corresponding preference profiles of w, and vice versa. If (m, w) / ∈ E then this pair cannot block in any preference profile. Similarly, let us consider a pair (m, w) when exactly one agent is matched in μ, say, m, i.e., (m, w) ∈ M × (W \Y ). If (m, w) ∈ E then m has the same partner in μ and μ , whilst w is unmatched in μ and has a previously unacceptable partner in μ , namely μ (w). Whenever this pair blocks for I then it also blocks for I , since the rank of w is the same in the corresponding preference profiles of m, and w prefers m to μ (w) in all profiles. Finally, if (m, w) / ∈ E then this pair cannot block in any preference profile, as before.
The above proof implies the following Corollary.

Corollary 1
The computational complexity of IsStabilityProbabilityNon-Zero is the same for complete and incomplete lists, and the same holds for IsStabilityProb-abilityOne.

Proposition 2 The computational complexity of MatchingWithHighestStabili-tyProbability is the same for complete and incomplete lists.
Proof Suppose that we are given an instance of a linear probabilistic model with incomplete lists I , and we consider the extended instance I with complete preference lists, as described in the proof of Proposition 1. We show that if μ is one of the most stable complete matchings in I then its restriction to E, μ, is one of the most stable matching for I .
First we note that p(μ, I ) ≥ p(μ , I ), since any pair in E that is blocking for μ under some preference profile in I is also blocking for μ under the corresponding extended preference profile in I . Suppose now for a contradiction that there is another matching ν for I such that p(ν, I ) > p(μ, I ). But then, for its natural extension ν we have p(ν, I ) = p(ν , I ) by Proposition 1, contradicting with the maximum stability of μ .
The above proof implies the following Corollary.

Corollary 2
The computational complexity of ExistsPossiblyStableMatching is the same for complete and incomplete lists, and the same holds for ExistsCer-tainlyStableMatching.

An Efficient Algorithm for the Lottery and Compact Indifference Models
As pointed out earlier, certainly stable matchings are closely related to the notion of super-stable matchings [13,16]. Deciding whether an instance of SMPI admits a superstable matching or not can be done in polynomial time using algorithm SUPER-SMP in [25]. We next show that for a class of independent uncertainty models that includes the lottery and compact indifference, we can solve ExistsCertainlyStableMatching in polynomial time by a straightforward reduction to the problem of deciding whether an instance of SMP admits a super-stable matching or not.

Theorem 1 For any independent uncertainty model in which the certainly preferred relation is transitive and can be computed in polynomial time, ExistsCer-tainlyStableMatching can be solved in polynomial time.
Proof We prove this by reducing ExistsCertainlyStableMatching to the problem of deciding whether an instance of SMP admits a super-stable matching or not. Let I = (M, W , L) be an instance of ExistsCertainlyStableMatching under an independent uncertainty model in which the certainly preferred relation is transitive and can be computed in polynomial time. We construct in polynomial time an instance I = (M, W , p) of SMP, where p is the agents' partial preference ordering profile, as follows. The set of men and women are unchanged. To create the partial preference ordering p a for each agent a we do the following. Without loss of generality, assume that a is a man m. For every pair of women w 1 and denoting that m (strictly) prefers w 2 to w 1 in I . We claim that I admits a super-stable matching if and only if I admits a certainly stable matching. It follows from the definition of super-stability that a matching μ in I is super- We first prove that if I admits a super-stable matching μ then μ is certainly stable in I . Assume, for a contradiction, that μ is not certainly stable. It then follows (⇒) Now we prove that if I admits a certainly stable matching μ then μ is superstable in I . Assume, for a contradiction, that μ is not super-stable in I . Therefore there exists an unmatched pair (m, w) where (μ(m), w) / ∈ p m and (μ(w), m) / ∈ p w , implying that μ(m) cert m w and μ(w) cert w m. The latter statement, coupled with the fact that m and w are not matched together, implies that μ(m) / ∈ D m (w) and μ(w) / ∈ D w (m). Thus, by Lemma 1, μ is not certainly stable in I , a contradiction.

An Efficient Algorithm for the Case with a Constant Number of Uncertain Agents
Theorem 2 When the number of uncertain agents is constant and one side of the market is certain, then MatchingWithHighestStabilityProbability is polynomial-time solvable for each of the linear models.
be an instance of MatchingWithHighestStabili-tyProbability and assume, without loss of generality, that uncertain agents are all men. Let X ⊆ M be the set of uncertain agents with |X | = k for a constant k. We consider all the possible matchings between X and W ; note that their total number is be such a matching. The main idea of the proof is to show that there exists an extension of μ i to M ∪ W , which we denote by μ * i , that has stability probability at least as high as any other extension of μ i . Furthermore, we can compute μ * i in polynomial time. Therefore, in order to compute a matching that has the highest stability probability, it is enough to generate μ * i 's, compute their stability probabilities, compare them and select the one with the highest stability probability. The total number of μ i 's and hence μ * i 's is K and hence polynomial in n, we can compute each μ * i in polynomial time (as we will see later in this proof) and computing the stability probability of a given μ * i can be done in polynomial time since all uncertain agents are on one side of the market (see Theorem 3 in Section 4, Theorem 8 in Section 5 and Theorem 10 in Section 6).
Take a matching μ i between sets X and W . Let Y = μ i (X ) (i.e., the partners of X in W ) and let M = M\X and W = W \Y . Recall that all agents in M ∪ W are certain. First, we compute the man-optimal matching μ M i for the sub-instance I on M ∪ W , that can be done efficiently by the Gale-Shapley algorithm [11]. Consider the matching μ i = μ i ∪ μ M i in I . If μ i admits a blocking pair (m , w) involving some (certain) agents m ∈ M and w ∈ Y (that we will refer to as a BP_Type1 blocking pair) then we can conclude that any extension of μ i to a matching in I will have zero probability of being stable. This is because any extension of μ i that has a positive probability of being stable in I must also be stable for the sub-instance I . If (m , w) is a blocking pair for μ i then it also blocks any other extension of μ i in I , since in all extensions w has the same partner and m cannot have a better partner than in μ M i . Therefore we can exclude the extensions of μ i from further consideration in this case.
Suppose now that μ i = μ i ∪ μ M i admits no BP_Type1 blocking pair. We truncate the preference lists of men in M in the following way. For each man m ∈ M we remove from his preference list all the women w ∈ W that m prefers less than some woman w ∈ Y who prefers m to her partner in μ i . That is, we remove w from the list of m if there exists w ∈ Y such that w m w and m w μ i (w). To do this, it is enough to identify the first (i.e. the highest ranked) woman w in the preference list of m such that w ∈ Y and m w μ i (w), and then remove from the preference list of m all women w ∈ W that appear after w. Let us denote the sub-instance for M ∪ W with the truncated lists as I r i . Now we compute the woman-optimal matching μ W i in We claim that μ * i is a complete matching in I and is stable for the certain agents; that is, no blocking pair (m, w) exists where both m and w are certain agents. To see this, first note that since μ i admits no BP_Type1 blocking pair hence μ M i (m ) remains in the truncated preference list of all m ∈ M . Therefore, the man-optimal matching for I r i is the same as the man-optimal matching for I , μ M i , implying that a complete stable matching exists in I r i and that each m ∈ M is either matched to the same woman in both μ M i and μ W i or prefers μ M i (m ) to μ W i (m ). As all stable matchings in I r i are of the same size (by the Rural-Hospital Theorem, see e.g. [26]), hence all agent in I r i are matched in μ W i and therefore μ * i is a complete matching for I . Now assume, for a contradiction, that μ * i is not stable for the certain agents and hence admits a blocking pair (m * , w * ) where m * ∈ M and w * ∈ W . Note that w * / ∈ W as otherwise (m * , w * ) blocks μ W i in I r i , a contradiction. Therefore, w * ∈ Y . But then we have that w * ∈ Y prefers m * ∈ M to μ i (w * ) and also that m * prefers w * to μ W i (m * ), implying that by the construction of the truncated preference lists of men in M , woman μ W i (m * ) must have been removed from m * 's preference list, a contradiction. Therefore μ * i is a complete matching in I and is stable for certain agents.
Finally, we show that for any matching μ + i that is an extension of μ i to I , the stability probability of μ + i is less than, or equal to, the stability probability of μ * i . If μ + i is not stable for the certain agents then μ + i has zero probability of being stable, thus the statement holds. Otherwise, μ + i is stable for the certain agents and hence for any pair (m, w) that has a positive probability of being a blocking pair it must be that m ∈ X and w ∈ W . Moreover, the projection of μ + i onto I r i must be stable in I r i , and as each woman w ∈ W is matched in μ * i to her optimal stable partner under I r i thus w either prefers her partner in μ * i to her partner in μ + i , or is matched to the same partner under both matchings. Therefore, for each deterministic preference profile that has a positive probability of realization under I , if a pair (m, w) blocks μ * i then it must also block μ + i , implying that if μ + i is stable under the given preference profile then so is μ * i , and thus our statement follows.

Lottery Model
In this section, we turn to the lottery model. Recall that in the lottery model, each agent reports a probability distribution over a set of preference orders. We show that even with small supports, computing StabilityProbability is still a computationally hard problem. However, other questions become more tractable with small supports or one side having certain preferences.

Theorem 3 For the lottery model, if one side has certain preferences, StabilityProbability is polynomial-time solvable.
Proof Without loss of generality, assume that men have certain preferences so each man m has a deterministic preference relation m . We present a polynomial-time computable formula for the probability of μ being stable. For a woman w, we denote her set of possible preferences lists by P w = { P 1 w w , . . . , P kw w w } with each preference list P i w w having corresponding probability p i w . Let q w be the probability that woman w will not form a blocking pair. The term q w is by definition as follows. So for each w ∈ W , q w can be computed in time O(k w n) by scanning over the k w preference lists of woman w and checking in which of them it is not the case that some m prefers w over μ(m) and w prefers m over μ(w). The probability that μ is stable is equal to the probability that no woman is in a blocking pair: Theorem 4 For the lottery model, IsStabilityProbabilityOne can be solved in polynomial time.
Proof The problem is equivalent to checking whether the given matching μ has nonzero probability of not being stable, i.e., we need only find a single possible blocking pair. This can be checked as follows: for each pair (m, w) of agents that are not matched to each other, we check whether either member of this pair can form a blocking pair with a pair in μ with non-zero probability. To do this, we need to check whether m prefers w in some possible preference over μ(m) and whether w prefers m in some possible preference over μ(w). As this only involves checking n 2 − n possible pairs, each of which can be checked in linear time, this can be done in polynomial time.
Theorem 5 For the lottery model, IsStabilityProbabilityNon-Zero is polynomialtime solvable when each agent has at most two possible preference orderings.

Proof
The problem is to decide whether there is some preference ordering for each agent (among the ones in their lottery) such that the given matching is stable. If each agent has at most two possible preference orderings in their lottery, we can reduce the problem to an instance ϕ of 2SAT [12], as follows. 2SAT is the problem of deciding whether a given propositional formula in 2CNF is satisfiable. A propositional formula ϕ is in 2CNF if it is the conjunction of clauses (l 1 ∨ l 2 ) of size 2, where l 1 and l 2 are propositional literals (propositional variables x or their negation ¬x).
Let {a 1 , . . . , a n } and {b 1 , . . . , b n } be the two sets of agents. Moreover, for each agent c and each i ∈ {1, 2}, let pref(c, i) denote the i-th preference in the lottery for agent c.
We introduce a propositional variable for each preference pref(c, i), which we also call pref(c, i). Intuitively, these variables indicate which preference for the agents we choose to make the matching stable.
Then, we add clauses to ensure that the selected matching is stable. For each agent c and each i ∈ {1, 2}, let B c,i be the set of preferences pref(c , i )-for c = c and i ∈ {1, 2}-such that pref(c, i) and pref(c , i ) together lead to the given matching being unstable (with (c, c ) being a blocking pair). Then, for each c, i, we add the following clauses: (¬pref(c, i) ∨ ¬pref(c , i )) for each pref(c , i ) ∈ B c,i . The given matching is then stable if and only if ϕ is satisfiable. Since ϕ is a 2CNF formula, this can be decided in linear time [1].

Theorem 6 For the lottery model, StabilityProbability is #P-complete, even when each agent has at most two possible preferences.
Proof We show how to count the number of satisfying assignments for a 2CNF formula using the problem StabilityProbability for the lottery model where each agent has two possible preferences. Since this problem is #P-hard, we get #P-hardness also for StabilityProbability [23].
Let ϕ be a 2CNF formula over the variables x 1 , . . . , x n . We firstly transform ϕ to a 2CNF formula ϕ over the variables x 1 , . . . , x 2n , y 1 , . . . , y 2n that has exactly the same number of satisfying assignments, and that satisfies the property that each clause contains one variable among x 1 , . . . , x 2n and one variable among y 1 , . . . , y 2n . We do so as follows. Firstly, for each 1 ≤ i ≤ n, we add the clauses (¬x i ∨ y i ), (¬y i ∨ x n+i ), (¬x n+i ∨ y n+i ) and (¬y n+i ∨ x i ), ensuring that in each satisfying assignment the variables x i , x n+i , y i and y n+i get assigned the same truth value. Then, for each clause of ϕ, we replace one occurrence of a variable among x 1 , . . . , x n by a corresponding variable among y 1 , . . . , y 2n -that is, we replace x i either by y i or by y n+i -and we add the resulting clause to ϕ . For example, if ϕ contains the clause (x 1 ∨ ¬x 3 ), we could add the clause (x 1 ∨ ¬y 3 ) to ϕ . It is readily verified that ϕ has the same number of satisfying assignments as ϕ.
Without loss of generality, we may assume that for each pair x i , x j of variables among x 1 , . . . , x n , the original formula ϕ contains at most two distinct clauses that contain both x i and x j . If ϕ were to contain three or more distinct clauses that contain both x i and x j , we know that at least one of the literals x i , ¬x i , x j , ¬x j would be entailed by these clauses, and we could instantiate these entailed literals and simplify ϕ accordingly. For example, if ϕ contains the clauses (x 1 ∨ x 2 ), (x 1 ∨ ¬x 2 ) and (¬x 1 ∨ ¬x 2 ), we can simplify ϕ by instantiating the entailed literals x 1 and ¬x 2 . As a result, we know that we can construct ϕ in such a way that for any two variables of ϕ , there is at most one clause of ϕ that contains both of these variables. For instance, if ϕ contains the clauses (x 1 ∨ x 2 ) and (¬x 1 ∨ ¬x 2 ), we can construct ϕ in such a way that it contains the clauses (x 1 ∨ y 2 ) and (¬y 1 ∨ ¬x 2 ).
We now construct an instance of StabilityProbability. The sets of agents that we consider are {x 1 , . . . , x 2n , a 1 , . . . , a 2n } and {y 1 , . . . , y 2n , b 1 , . . . , b 2n }. The matching that we consider matches x i to b i and matches y i to a i , for each 1 ≤ i ≤ 2n as shown below.
Each agent b i has only a single possible preference, namely one where they prefer x i over all other agents. Similarly, each agent a i has a single possible preference where they prefer y i over all other agents. In other words, the agents a i and b i are perfectly happy with the given matching.
The agents x i and y i each have two possible preferences, that are each chosen with probability 1 2 . These two possible preferences are associated with setting these variables to true or false, respectively. We describe how these preferences are constructed for the agents x i . The construction for the preferences of the agents y i is then entirely analogous.
Take an arbitrary agent x i . We show how to construct the two possible preferences for agent x i , which we denote by p x i and p ¬x i . Both of these possible preferences are based on the following partial ranking: b 1 > b 2 > · · · > b 2n , and we add some of the agents among y 1 , . . . , y 2n to the top of this partial ranking, and the remaining agents to the bottom of this partial ranking.
To the ranking p x i we add exactly those agents y j to the top where ϕ contains a clause (¬x i ∨ y j ) or a clause (¬x i ∨ ¬y j ). All remaining agents we add to the bottom. Similarly, to the ranking p ¬x i we add exactly those agents y j to the top where ϕ contains a clause (x i ∨ y j ) or a clause (x i ∨ ¬y j ). The rankings p y j and p ¬y j , for the agents y j , are constructed entirely similarly.
Consider a truth assignment α : {x 1 , . . . , x 2n , y 1 , . . . , y 2n } → {0, 1}, and consider the corresponding choice of preferences for the agents x 1 , . . . , x 2n , y 1 , . . . , y 2n , where for each agent x i the preference p x i is chosen if and only if α(x i ) = 1, and for each agent y j the preference p y j is chosen if and only if α(y j ) = 1. We show that α satisfies ϕ if and only if the corresponding choice of preferences leads to the matching being stable. The only blocking pairs that can arise are between an agent x i and an agent y j . Take an arbitrary such pair (x i , y j ). We show that this is a blocking pair if and only if α falsifies at least one clause containing both variables x i and y j . We know that ϕ contains exactly one clause containing x i and y j . We deal with the case where ϕ contains the clause (x i ∨ y j )-the other possibilities are entirely analogous. By construction of p x i , p ¬x i , p y j , and p ¬y j , we get that (x i , y j ) is a blocking pair if and only if both p ¬x i and p ¬y j are chosen. This is exactly the case where the clause (x i ∨ y j ) is falsified. Thus, we can conclude that α falsifies ϕ if and only if there is a blocking pair, and thus that α satisfies ϕ if and only if the corresponding choice of preferences leads to the matching being stable Since each combination of preferences is equally likely to occur, and there are 2 4n many combinations of preferences, the probability that the given matching is stable is exactly q = s 2 4n , where s is the number of satisfying truth assignments for ϕ. Therefore, given q, s can be obtained by computing s = q2 4n .
If the agents are allowed to have more than two possible preferences as we have assumed in the last two Theorems, then even the following problem is NP-complete. The statement can be proved via a reduction from Exact Cover by 3-Sets (X3C).

Theorem 7 For the lottery model, IsStabilityProbabilityNon-Zero is NPcomplete.
Proof The problem is in NP, since we only need to provide one profile that occurs with non-zero probability for which the given matching is stable. We show NP-hardness by giving a reduction from Exact Cover by 3-Sets (X3C). Let (X , C) be an instance of X3C, where |X | = 3n for some n, and C = {c 1 , . . . , c m } is a collection of sets c i ⊆ X , each of size 3. Moreover, let The problem is to decide whether there is a subset C ⊆ C of size exactly n such that C = X .
We construct an instance of our problem as follows. We let {a 1 , . . . , a n , a 1 , . . . , a 3n }  and {b 1 , . . . , b n , b 1 , . . . , b 3n } be the two sets of agents, we match a i to b i -for each 1 ≤ i ≤ n-and we match a j to b j -for each 1 ≤ j ≤ 3n. This is depicted graphically below.
Each agent a i prefers their matching to b i over any other possible match, i.e., agent a i has one preference, where b i is ranked first, and the rest of the agents appear in some fixed order after b i .
Similarly, each agent b j prefers their matching to a j over any other possible match. That is, agent b j has one preference ordering in which a j is ranked first and the rest of the agents appear in some fixed order after a j .
Then, for each agent b i , we add the following |C| possible preferences to the lottery: where in each preference the remaining agents appear in any (fixed) order after a i . In other words, b i prefers three agents a j to their current match, and these three form some set c ∈ C. Finally, for each agent a j , we add the following n possible preferences to the lottery: That is, each agent a j prefers each of the agents b 1 , . . . , b n , except one, to their current match (and they never prefer any of the agents b j for j = j over their current match). We can show that there is a choice of preferences for the agents that makes this matching stable if and only if (X , C) ∈ X3C.
(⇒) Firstly, suppose that there is a choice of preferences for the agents that makes this matching stable. That is, for each agent b i there is some preference ordering P i, i , and for each agent a j there is some preference ordering P j,k j , such that these orderings (together with the fixed preference orderings for the agents a i and b j ) make this matching stable. Now, consider the set C = {c : i ∈ [n], = i }. We show that C = X . To derive a contradiction, suppose that this is not the case, that is, suppose that C = X . Then, since |C | = n, |X | = 3n and for each c ∈ C it holds that |c| = 3, we know that there must be some c , c ∈ C such that c ∩ c = ∅. Say that x j ∈ c ∩ c . Therefore, there must be some i, i ∈ [n] such that both b i and b i prefer a j over their current match. On the other hand, a j will prefer either b i or b i over their current match. Therefore, either b i and a j or b i and a j will form a blocking pair. Thus, the matching is not stable. From this we can conclude that C = X .
(⇐) Conversely, suppose that there exists some C ⊆ C of size exactly n such that C = X . Let C = {c 1 , . . . , c n }. Now, for each agent b i we pick some preference ordering, and for each agent a j we pick some preference ordering, such that these orderings (together with the fixed preference orderings for the agents a i and b j ) make the matching stable. For each agent b i , we pick the preference ordering P i, i , and for each agent a j we pick the preference ordering P j,k j , where k j ∈ [n] is the unique value such that x j ∈ c k j . It is straightforward to verify that these preferences make the matching stable.
Given that StabilityProbability is computationally hard even in restricted settings, one may immediately wonder about approximation algorithms. However, we can state the following two corollaries, the first from Theorem 7 and the second from [29,Proposition 8] and Theorem 7, which show that even approximation remains intractable.

Compact Indifference Model
In the compact indifference model we are given an instance of SMT and each linear order over candidates (each possible preference ordering) is achieved by breaking ties independently at random with uniform probabilities. It is easy to show that IsStabilityProbablityNonZero, IsStabilityProbablityOne, and ExistsCer-tainlyStableMatching are all in P.

Proposition 3 For the compact indifference model, IsStabilityProbability NonZero is in P.
Proof This is equivalent to checking whether a given matching μ is weakly stable in the given SMTI instance, which is polynomial-time solvable. To check this we only have to look for a blocking pair, which can be done in polynomial time: take every possible pair (m, w) who are not matched together and check whether they both (strictly) prefer each other to their current partner.

Proposition 4 For the compact indifference model, IsStabilityProbabilityOne is in P.
Proof This is equivalent to checking whether a given matching μ is super stable in the given SMTI instance, which is polynomial-time solvable. To check this we only have to look for a very weakly blocking pair, which can be done in polynomial time: take every possible pair (m, w) who are not matched together and check whether they each either prefers the other to his or her current partner or finds them incomparable.

Proposition 5 For the compact indifference model, ExistsCertainlyStableMatching is in P.
Proof Deciding whether there is a matching that is stable with probability one is equivalent to deciding whether there is a matching that is stable w.r.t. all refinements, i.e., a super-stable matching. Given an instance of SMTI one can decide in polynomial time whether it admits a super-stable matching [20].
The complexity of computing the stability probability of a given matching remains open under the compact indifference model, but this problem can be shown to be in P if one side has certain preferences.

Theorem 8 In the compact indifference model, if one side has certain preferences, StabilityProbability is polynomial-time solvable.
Proof Assume, without loss of generality, that men have certain preferences. The following procedure gives us the stability probability of any given matching μ. (1) For each uncertain woman w identify those men with whom she can potentially form a blocking pair. That is, those m such that w m μ(m) and w is indifferent between m and her partner in μ. Assume there are k such men. The probability of w not forming a blocking pair with any men is then the probability that her current match ranks first among these k + 1 men, which is 1 k+1 . (2) Multiply the probabilities from step 1.
We next show that MatchingWithHighestStabilityProbability is NP-hard. For an instance I of SMT and matching μ, let p(μ, I ) denote the probability of μ being stable, and let p S (I ) = max{ p(μ, I ) | μ is a matching in I }, that is the maximum probability of a matching being stable. A matching μ is said to be weakly stable if there exists a tie-breaking rule where μ is stable. Therefore a matching μ has positive probability of being stable if and only if it is weakly stable. Furthermore, if the number of possible tie-breaking is N then any weakly stable matching has a probability of being stable at least 1 N . An extreme case occurs if we have one woman only with n men, where the woman is indifferent between all men. In this case any matching (pair) has a 1 n probability of being stable. An even more unfortunate scenario is when we have n men and n women, each women is indifferent between all men, and each man ranks the women in a strict order in the same way, e.g., in the order of their indices. In this case, the probability that the first woman picks her best partner, and thus does not block any matching is 1 n . Suppose that the first woman picked her best partner, the probability that the second woman also picks her best partner from the remaining n − 1 men is 1 n−1 , and so on. Therefore, the probability that an arbitrary complete matching is stable is 1 n·(n−1)·····2 = 1 n! .

Theorem 9
For the compact indifference model, MatchingWithHighestStabili-tyProbability is NP-hard, even if only one side of the market has uncertain agents.
Proof For an instance I of SMTI, let opt(I ) denote the maximum size of a weakly stable matching in I . [14] showed (in the proof of Corollary 3.4) that given an instance I of SMTI of size n, where only one side of the market has agents with indifferences and each of these agents has a single tie of size two, and any arbitrary small positive , it is NP-hard to distinguish between the following two cases: (1) opt(I ) ≥ 21− 27 n and (2) opt(I ) < 19+ 27 n. When choosing so that 0 < < 1 2 we can simplify the above cases to (1)  We create the preferences of I as follows. The preferences of men M remain the same. For each woman w ∈ W we append the men X and then Y at the end of her list in the order of their indices. Each man x i ∈ X has only all the women W in his list in the order of their indices. Furthermore, each y j ∈ Y has all the women W first in his preference list in the order or their indices and then z j . Let each z j ∈ Z has y j as first choice and then all the men Y j in one tie of size n. Each man in Y j has only z j in his list. We will show that in case one p S (I ) ≥ 1 2 n , whilst in case two p S ≤ ( 1 n ) n 27 . Therefore, for n > 2 27 , it is NP-hard to decide which of the two separate intervals contains the value p S (I ).
To show the above statement, suppose first that we have the first case, so opt(I ) > 41 54 n and therefore less than 13 54 n women are left unmatched in a maximum size weakly stable matching μ for I , denoted by W u ⊂ W . We extend μ to μ for I as follows. We assign all the women in W u to men in X in the unique stable way, namely we pair them in a mutually increasing order of their indices. Since |X | > |W u |, we now matched all women in W , and left some men in X unmatched in μ . We complete the matching by assigning y j to z j for each j = 1, . . . , n and leaving all of the men in Y j for all j unmatched. We shall see that no matter how we break the ties in I , blocking pair can appear between the original I agents only, and therefore the probability of μ being stable in I is the same as the probability of μ being stable in I . Since we have at most n ties in I , each of length two, the number of different tie-breakings is at most 2 n , out of which at least one is stable. Therefore p(μ, I ) = p(μ, I ) ≥ 1 2 n . In the second case, opt(I ) < 39 54 n and therefore more than 15 54 n women are left unmatched in any weakly stable matching μ for I . Let μ be one of the most stable matchings in I . First we have to note that the restriction of μ to I must be weakly stable in I , since otherwise p(μ , I ) = 0. Let W u denote the set of women that are not matched to any man from M in μ . According to our assumption |W u | > 15 54 n, whilst |X | + |Y | = 15 54 n, therefore in order to avoid a certain blocking pair between W u and X ∪ Y we shall match all the men in X ∪ Y to women in W u in the only stable way (in the order of indices, where men in X are coming before men in Y ), leaving some women in W u unmatched in μ . However, in this case no agent z j ∈ Z can be matched to y j , and therefore, even if there was no potential blocking pair between agents of I , the probability that z j is matched the best partner from Y j is 1 n independently for each z j ∈ Z . Therefore the probability of μ being stable is at most ( 1 n ) n 27 , which completes the proof of the first statement.
Regarding the NP-hardness of finding one of the most stable matchings, we shall prove that we can decide between the two cases according to the number of unmatched women in W in the restriction of μ to I , where μ is one of the most stable matchings in I . To see this, let W u denote again the set of women that are not matched to any man in M under μ . In the first case, when opt(I ) > 41 54 n, it must be the case that |W u | < 15 54 n, since otherwise p(μ , I ) would be less than ( 1 n ) n 27 and could not achieve 1 2 n , that is the minimum value for p S (I ), as shown in the above argument. Whilst, in the second case |W u | > 15 54 n must hold, since opt(I ) < 39 54 n was assumed.

Joint Probability Model
In this section, we examine problems concerning the joint probability model. Recall that the input now consists of a set of preference profiles, and a probability distribution over these preference profiles. Our first result is that the stability probability of a matching can be computed in polynomial time in the size of the input.

Theorem 10
For the joint probability model, StabilityProbability can be solved in polynomial time.
Proof The probability that a given matching is stable is equivalent to the sum of the probability weights of the preference profiles for which the matching is stable. This can be checked as follows. We check for which preference profiles the given matching is stable. For one profile, this can be checked in O(n 2 ) time by checking for each (man, woman) pair, whether it is a blocking pair. Then we add up the probabilities of those profiles for which the matching is stable. The sum of the probabilities is the probability that the matching is stable.

Corollary 5
For the joint probability model, IsStabilityProbabilityNon-Zero and IsStabilityProbabilityOne can be solved in polynomial time.
For the joint probability model, the problem ExistsCertainlyStableMatching is equivalent to checking whether the intersection of the sets of stable matchings of the different preference profiles is empty.

Theorem 11
For the joint probability model, ExistsCertainlyStableMatching is NP-complete.

Proof
The problem is in NP, since computing StabilityProbability can be done in polynomial time by Theorem 10 , and so a matching that is stable with probability 1 is a certificate. The NP-hardness proof is by reduction from the NP-complete 3-Coloring problem. The input for 3-Coloring is a graph G = (V , E), and the question is whether there exists a coloring of the vertex set with 3 colors, χ : V → {1, 2, 3}, such that no two adjacent vertices receive the same color. Such a coloring is called a proper coloring. Let G = (V , E) be a graph specifying an instance of 3-Coloring, where V = {v 1 , . . . , v n }. We construct an instance I of ExistsCertainlyStable-Matching in the joint probability model. For each vertex v i ∈ V , we introduce three men m i,1 , m i,2 , m i, 3 and three women w i,1 , w i,2 , w i, 3 . We will add a sequence of preference profiles that have nonzero probability. The exact probability of the preference profiles is unimportant, so we may assume that there is a uniform probability associated with the preference profiles. The first preference profile P 0 will ensure that every certainly stable matching matches each m i, j to some w i, j and each w i, j to some m i, j , where j, j , j ∈ {1, 2, 3}. Moreover, it ensures that for each i ∈ {1, . . . , n}, exactly one of three matchings between the men m i, j and the women w i, j must be used: 3 , and m i,3 is matched to w i,1 ; or (3) m i,1 is matched to w i,3 , m i,2 is matched to w i,1 , and m i,3 is matched to w i,2 .
Intuitively, choosing one of the matchings (1)-(3) for the agents m i, j , w i, j corresponds to coloring vertex v i with one of the three colors in {1, 2, 3}.
Then, for each edge e = {v i 1 , v i 2 } ∈ E, and for each color c ∈ {1, 2, 3}, we will introduce a preference profile P e,c that ensures that in each certainly stable matching, it cannot be the case that both the agents m i 1 , j , w i 1 , j and the agents m i 2 , j , w i 2 , j are matched to each other according to matching (c). As a result, any certainly stable matching directly corresponds to a proper 3-coloring of G.
A detailed description of the preference profiles P 0 and P e,c and a proof of correctness for this reduction follows.
In P 0 , for each i ∈ [n], the preferences for m i, j , w i, j are as follows: Observe that the matchings (1)-(3) are the only stable matchings restricted to the Next, we continue with the preference profiles P e,c . Take an arbitrary e = {v i 1 , v i 2 } ∈ E and an arbitrary c ∈ {1, 2, 3}. In P e,c , the preferences for m i, j , w i, j for each i ∈ [n]\{i 1 , i 2 } are exactly the same as in P 0 . Only the preferences for m i 1 , j , w i 1 , j and m i 2 , j , w i 2 , j differ from P 0 ; namely, we construct these preferences as follows.
For m i 1 , j , w i 1 , j , we start with preferences that (i) for all m i 1 , j have {w i 1 ,1 , w i 1 ,2 , w i 1 ,3 } as top three choices, (ii) for all w i 1 , j have {m i 1 ,1 , m i 1 ,2 , m i 1 ,3 } as top three choices, (iii) admit only matchings (1), (2), and (3) as stable matchings between the agents m i 1 , j , w i 1 , j , and (iv) for the men m i 1 , j the matching (c) is the worst option among the matchings (1), (2), and (3). Similarly, for m i 2 , j , w i 2 , j , we start with preferences that satisfy conditions (i), (ii) and (iii), and additionally satisfy the condition (iv ) that for the women w i 2 , j the matching (c) is the worst option among the matchings (1), (2), and (3). Then, we modify the preferences for m i 1 ,1 and w i 2 ,1 slightly. For m i 1 ,1 , we insert w i 2 ,1 between his second and third preferred woman. Similarly, for w i 2 ,1 , we insert m i 1 ,1 between her second and third preferred man. As a result, m i 1 ,1 and w i 2 ,1 form a blocking pair in this preference profile if both the agents m i 1 , j , w i 1 , j and the agents m i 2 , j , w i 2 , j are matched to each other using matching (c)and not if either set of agents is matched to each other using some other matching (c ).
For example, consider e = {v i 1 , v i 2 } and c = 2. The preferences for the agents m i 1 , j , w i 1 , j and m i 2 , j , w i 2 , j in the preference profile P e,c are as follows: 1 : w i 1 ,1 , w i 1 ,3 , w i 2 ,1 , w i 1  We argue that G has a proper 3-coloring if and only if there is a certainly stable matching for the probability distribution over preference profiles that we constructed.
(⇒) Firstly, suppose that G has a proper 3-coloring, say χ : V → {1, 2, 3}. We can then construct a certainly stable matching as follows. For each i ∈ {1, . . . , n}, we match the agents m i, j , w i, j to each other using matching (χ (v i )). Clearly, this matching is stable for P 0 . Moreover, because χ is a proper 3-coloring of G, it is straightforward to verify that this matching is also stable for each P e,c .
(⇐) Conversely, suppose that there is a certainly stable matching. We know that in this matching, each man m i, j must be matched to some woman w i, j , and vice versa, each woman w i, j must be matched to some man m i, j . If this were not the case, the matching would not be stable for P 0 , and thus not certainly stable. Moreover, by a similar argument, we know that for each i ∈ {1, . . . , n}, the matching between the men m i, j and the women w i, j must be one of the matchings (1), (2), or (3). We can then construct a 3-coloring χ : V → {1, 2, 3} as follows. For each i ∈ {1, . . . , n}, we set χ(v i ) in such a way that (χ (v i )) is the matching used in the certainly stable matching to match the men m i, j and the women w i, j to each other.
We argue that χ is a proper 3-coloring of G. Suppose that this is not the case, that is, that there is some e = {v i 1 , v i 2 } such that χ(v i 1 ) = χ(v i 2 ) = c. Now consider the preference profile P e,c . By construction of χ , we know that in the certainly stable matching, agent m i 1 , j is matched to agent w i 1 , j and agent m i 2 , j is matched to agent w i 2 , j , both times according to matching (c). However, by construction of P e,c we will have that m i 1 ,1 and w i 2 ,1 form a blocking pair in P e,c . This is a contradiction with our assumption that the matching we considered is certainly stable. From this, we can conclude that χ is a proper 3-coloring of G.
By reducing from 3-Coloring on 4-regular graphs and using Vizing's theorem to combine preference profiles, we can strengthen Theorem 11 and show that the result holds even when the input contains only a constant number of preference profiles.

Corollary 6
For the joint probability model, ExistsCertainlyStableMatching is NP-complete, even when there are only 16 preference profiles in the lottery.

Proof
We show this by modifying the proof of Theorem 11. We know that 3-Coloring is NP-complete even when restricted to 4-regular graphs [8]. We use the reduction in the proof of Theorem 11, and we assume that in the given graph G, each vertex has degree 4. Then, by Vizing's Theorem [28], we know that we can give a proper edge coloring of G that uses at most 5 colors. Moreover, we can find such an edge coloring in polynomial time. Then, since in the proof of Theorem 11, in each preference profile P e,c with e = {v i 1 , v i 2 }, only the preferences for the agents m i 1 , j , w i 1 , j , m i 2 , j , w i 2 , j differ from P 0 , we can, for each color c ∈ {1, 2, 3}, combine the preference profiles P e,c for all edges e that are colored with the same color. This results in only 16 preference profiles: P 0 , and a preference profile for each of the 5 edge colors and each of the 3 vertex colors.

Future work
First we note that we left open two outstanding questions, as described in Table 3. In this paper we focused on the problem of computing a matching with the highest stability probability. However, a similarly reasonable goal could be to minimize the expected number of blocking pairs. It would also be interesting to investigate some further realistic probability models, such as the situation when the candidates are ranked according to some noisy scores (like the SAT scores in the US college admissions). This would be a special case of the joint probability model that may turn out to be easier to solve.
One may also consider the questions we asked in this paper for two natural generalizations on the one-to-one matching problem: many-to-one and the many-to-many two-sided problems, where the agents on one or both sides of a two-sided market have capacities. These are reasonable extensions with regard to many applications, e.g., college admissions, and course allocation, respectively. One issue when considering capacities larger than one is that there are many ways of extending the preferences over candidates to preferences over sets of candidates. Another possible generalization of the one-to-one marriage model is the non-bipartite stable roommates problem. We conjecture that most of our polynomial tractability results can be extended to these more general models, but we leave this work for future research.