UMBC CMSC 771 Knowledge representation and reasoning
offerings: 97 99 00 01 02 03 | notes | resources | software | papers | hw | help | mail

 THE STABLE MARRIAGE PROBLEM adapted from David Feldman, Mathematics, University of New Hampshire ```On the surface, the STABLE MARRIAGE PROBLEM (described below) bears a certain resemblence to the PERFECT MATCHING PROBLEM. Both problems give us a pair of disjoint sets and some additional data and then ask us to produce a bijection between the sets satisfying certain constraints. Nevertheless, the problems differ with respect to the nature of the given additional data and the constraints which any solution must satisfy. For coloristic purposes we follow the tradition that calls the two sets MEN and WOMEN, so that bijection means marrying everyone off to someone of the opposite sex. We often find it notationally convenient to regard a given bijection between MEN and WOMEN as the self-map on MEN U WOMEN (the union) which associates each person to his or her spouse. Any self-inverse, gender-changing function on MEN U WOMEN corresponds to such a bijection. In the context of these topics, we often use the word "matching" as a synonym for bijection. Where an instance of the PERFECT MATCHING PROBLEM specifies the compatible and incompatible pairs of men and women, in STABLE MARRIAGE PROBLEM we always have every pair of men and women potentially compatible. Instead of incompatibilities, we must content with the preferences of the members of both sexes. More precisely, we assume that each man and each woman comes with a preference lists that strictly ranks all the members of the opposite sex from most prefered down to least prefered. We then aim to find a bijection which which avoids, so to speak, any potential consentual adultery. That means we must avoid creating any unmarried man-woman pair (M,w) where M prefers w to his wife and w prefers M to her husband. (We assume no one would have adultery with someone they liked even less than their spouse.) We abbreviate "potentially consentually adulterous pair" to "adulterous pair" for the sake of brevity, (and not because we assume that no one can resist temptation.) As we shall see, an investigation of the STABLE MARRIAGE PROBLEM even just in its most basic form reveals an unexpectedly rich structure. Existence --------- In contrast to the PERFECT MATCHING PROBLEM, every instance of the STABLE MARRIAGE PROBLEM indeed admits a stable matching. This fact immediately provokes the question of how to find such a stable matching efficiently. We shall settle both matters at once by describing the famous Gale-Shapley algorithm. For the sake of illustration, let us start with a STABLE MARRIAGE PROBLEM instance such as: MEN WOMEN A abcde a ABCDE B bcdea b CBADE C baedc c DEABC D adebc d ABCDE E adbce e ADEBC Now the Gale-Shapley algorithm has a deterministic version and a non-deterministic version and each in turn has a male-oriented version and a female-oriented version. We begin with the male-oriented deterministic version. The algorithm proceeds in rounds. During the course of the algorithm various couples get engaged and sometimes engagements get broken. At the beginning of each round the first unengaged (or "free") man proposes the woman highest women on his list among those to whom he has never previously proposed (so no man ever proposes to the same woman twice). When a free woman receives a proposal she always excepts. When an engaged woman receives a proposal she checks her preference list and accepts the new proposal precisely when she prefers the man who makes it to her current fiance who then becomes free. The algorithm proceeds until we have every man engaged. Let's see how the algorithm works with the example above. Action Engagements A proposes to a A-a B proposes to b A-a B-b C proposes to b; since b A-a C-b prefers C to B, B becomes free B proposes to c A-a B-c C-b D proposes to A, gets rejected D proposes to d A-a B-c C-b D-d After rejections by a, d, and b, A-a C-b D-d E-c E proposes to c who accepts, since she prefers him to B. This frees B. B proposes to d who accepts, freeing D A-a B-d C-b E-c D proposes to e A-a B-d C-b D-e E-c Let n equal the total number of men (or women). Since each man never proposes to a given woman more than once, the algorithm can't possibly require more than n^2 rounds. In particular, it must terminate. Next we show that the algorithm always terminates with a matching. A priori, the algorithm can only terminate in two ways - we either exhaust the supply of free men (so we have a matching) or else some man winds up rejected by *every* woman on his list. The latter cannot actually happen, as the next paragraph explains. Observe that once a woman receives a proposal, forever after she remains engaged to *someone.* Thus the number of *free* woman *never* increases. At the hypothetical moment when some man M get rejected by the last woman on his list, M has already proposed to every women. That means we must have *every woman engaged* and thus also every man engaged, contradicting the freedom of M . The previous argument exemplifies a proof technique typical of this subject. We wish to prove a universal or global statement ("the algorithm matches everyone"). Assuming the contrary we _focus_ on some individual who has a special role, at least in the hypothetical situation ("the man who every woman rejects"). Then by reasoning about particular individuals we deduce a contradiction which then forces a conclusion that applied equally to everyone. We've seen that the algorithm always produces a matching. Given a man M, we write GS(M) for the woman to whom the algorithm marries him, and for a woman w we write GS(M) for her husband she marries. Observe that always we have M=GS(GS(M)) and w=GS(GS(w)). Now why does the algorithm always produce a *stable* matching? In keeping with the comment just above, we shall assume the contrary and work for a contradiction. Let (M,w) stand for an unmarried but potentially adulterous couple. Thus M prefers w to GS(M) and w prefers M to GS(w). Now consider the run of the algorithm. Men propose to women one by one, working down their preference lists. Since M prefers w to GS(M), at some point M must have proposed to w (since he certainly proposed to GS(M) ). Since M and w didn't wind up married at the end, w must have rejected M at some point (either immediately, if she found herself already married to someone she prefered, or later when she got a better offer). That means that w must have wound up married to someone she *prefers* to M, contrary to hypothesis. Many students at first find proof by contradiction difficult to swallow. Typically, once they get used to it, they want to prove *everything* by contradiction. Of course, whatever you can prove, you can prove by contradiction: just assume the contrary, prove the statement and you have your contradiction. On the other hand, if you can do without contradiction, often that clarifies your argument. To illustrate, let's redo the previous proof in strictly positive terms. Let (M,w) stand for any couple not married to each other by the algorithm. Suppose M prefers w to GS(M). Then M proposed to w before he proposed to GS(M). She must have rejected him (either immediately or later) for the sake of another man she preferred. Since her fortune could only improve as the algorithm progressed, she must prefer GS(w) to M, meaning that adultery with M will not interest her. On the other hand, if M prefers GS(M) to w, adultery won't interest him. So either way, we don't have an adulterous pair. Optimality ---------- Given a STABLE MARRIAGE PROBLEM instance and a man-woman pair (M,w), let us call M and w _stable partners_ if *some* stable matching pairs them off. It turns out, as we shall see, that the stable matching which the (male-oriented) Gale-Shapley algorithm generates pairs *every* man to his favorite stable partner. In other words, no single man can do better in any other stable matching. That hardly means that every man gets his first choice -- a man's favorite *stable* partner might well come in last on his list. Before we turn to justifying the claim in the previous paragraph, let us consider a related result. There exists no matching U (stable or unstable) where *every* man does better than he does with the algorithm's matching. The proof of this claim illustrates the proof technique described above: assume the contrary and focus on some individual who plays a special role. So let U denote a matching where *every* man does better. Let's focus now on w , the last woman who receives a proposal. Once we name w, we have two chains of men and women to whom we may explicitly refer: w , Uw , GS(Uw) , U(GS(Uw)) , GS(U(GS(Uw))), ... and also w , GSw , U(GSw) , GS(U(GSw)) , U(GS(U(GSw))), ... so finding a proof involves reasoning about whomever among these people turns out to have some relevance to the issue under consideration. By assumption, Uw prefers w(=U(Uw)) to GS(Uw) since *every* man does better with matching U. That means that at some point during the algorithm Uw proposed to w (on his way to proposing GS(Uw), his wife at the end). But w gets just a single proposal, namely from GS(w), contradiction. The desire to prove a negative claim ("there exists no matching...") obliges you to find a contradiction, but you can seek a different, possibly stronger, claim that admits a positive formulation. In this case the argument used actually proves more: in any instance there exists at least one woman w whom no man prefers to his wife. Then the stated claim follows immediately, for whomever w marries in an alternative matching must then do worse. Now we return to the claim set forth in the beginning of this section. Observe that we can paraphrase it thus: in the course of the GS algorithm, no woman ever rejects a stable partner. This suggests that we assume the contrary and then focus on a women who *does* reject a stable partner. You could spin you wheels with this for a while before you came up with the following refinement: focus on the *first* woman w who rejects a stable partner M . Next, you'll want to give a name, S say, to some stable matching where M marries w (so w=S(M)). Exercise: With this start, finish the proof. ```