Information Processing Letters 34 (1990) 261-263 North-Holland
7 May 1990
THE NECESSARY AND SUFFICIENT CONDITION FOR THE WORST-CASE MALE OPTIMAL STABLE MATCHING
R.T. KU0
Institute of Computer Science and Informaiion Engineering, National Chiao Tung University, Hsinchu, Taiwan 30050, People’s Republic of China
S.S. TSENG
Institute of Computer and Information Science, National Chiao Tung University Hsmchu, Taiwan 30050, People’s Republic of China
Communicated by P. Henderson Received March 1989 Revised September 1989
Keywords: Stable matching problem, worst-case execution, sequential algorithms
1. Introduction
Gale and Shapley [l] introduced and solved the stable matching problem. That problem involves two disjoint sets of equal cardinality n, the men and the women. Each person ranks all members of the opposite sex in order of preference. A stable matching is defined as a complete matching be- tween men and women with the property that no man and woman who are not partners both prefer each other to their actual partners under the matching.
Several stable matching algorithms [l-3, S-101 were proposed to solve the problem by returning the male optimal stable solution as its answer. Any sequential one of those algorithms will be called a stable matching algorithm in this paper.
The purpose of this paper is to consider the worst-case choice for the sequential stable match- ing problem. This problem has been investigated by some researchers since the early paper of Wil- son [ll]. Itoga [5] presented some conclusions about the nature of the worst-case situation. Tseng and Lee [lo] gave a necessary condition for the worst-case execution of the stable matching prob- lem which takes the maximum number of pro- posals for the McVitie-Wilson’s algorithm [8,9].
Kapur and Krishnamoorthy [6] presented a worst-case choice which takes the maximum num- ber of stages for Gale-Shapley’s algorithm [l]. In
this paper we give the necessary and sufficient condition for the worst-case execution, which leads the sequential stable matching algorithm to take the maximum number of proposals. We then point out that the probability that the worst-case execu- tion occurs when a sequential stable matching algorithm is employed is extremely small.
2. Definitions and background results
An instance of the stable matching problem consists of a set M of n men and a set W of n women, each member in these two sets has a rank-ordered preference lists of the n people of the opposite sex. For convenience, let P(m,) and P(w,) denote the preference lists for any man m, and any woman w, respectively, let mj[ j] denote the jth choice of man m, and let w,[ j] denote the j th choice of woman w,.
A matching p is a one-to-one mapping of the men and the women, i.e., an invertible function p : M -+ W such that p( m,) is the woman matched with man m, and pL-‘(w,) is the man matched 0020-0190/90/$3.50 0 1990 - Elsevier Science Publishers B.V. (North-Holland) 261
Volume 34, Number 5 INFORMATION PROCESSING LETTERS I May 1990
with woman w,. The pair (m, w) blocks the match- ing p if m and w are not matched by p but prefer each other to their respective partners given in p. A matching is stable if it is not blocked by any pair. A matching that is not stable is called unsta- ble. The fundamental theorem [l] is that there is a stable matching for any problem instance. Given any instance (M,W, P) where the pattern P repre- sents the preferences of all members of MU W, any stable matching algorithm with proposals made by the men will terminate and return the male optimal (abbreviated as M-optimal) stable matching p,,, as the answer. Similarly, any stable matching algorithm with proposals made by the women will terminate and return the female opti- mal (abbreviated as W-optimal) stable matching pw, as the answer.
The sequential stable matching algorithms for a solution to a stable matching instance [1,8,9] are based on a sequence of proposals from the men to the women. It is shown [8] that the sequence of proposals ends with every woman holding a unique proposal, and that the proposals held constitute a stable matching which is M-optimal. A similar outcome results if the roles of males and females are reversed, in which case the resulting stable matching that is W-optimal may or may not be the same as that obtained from the male proposal sequence.
Two fundamental implications of the male pro- posal sequence, implicit in [8], are
(i) if m proposes to w, then there is no stable matching in which m has a better partner than w, and
(ii) if w receives a proposal from m, then there is no stable matching in which w has a worse partner than m.
From these observations, it is shown [4] that we should explicitly remove m from w’s list, and w from m’s, if w receives a proposal from someone she likes better than m. The resulting lists are referred to as the male-oriented shortlists, for the given problem instance.
In the context of the male-oriented shortlists, a male-oriented rotation [4] exposed in p is a se- quence
r= (m,, wO>, . . . . (m,-,, wPP1>
262
of pairs from p such that, for each i (0 G i G p - 1) (i) wI is first in m,‘s shortlist, and (ii) wj+, is second in m,‘s shortlist (i + 1 taken modulo p).
Similarly, we can, by relabeling, also define the female-oriented rotation exposed in I*. Note that for a given matching there may be many or there may be no exposed rotations.
It is pointed out in [4] that if the first entries in the male-oriented shortlists do not specify the Pi,, then at least one rotation must be exposed. The chief significance of such a rotation lies in the fact that if, in pm, each m, exchanges his partner w, for W,+l(mod p)’ then the resulting matching is also
stable. This process is referred to as eliminating a rotation.
3. The necessary and sufficient condition for worst-case execution
We know that the sequential stable matching algorithms [1,8,9] are based on a sequence of proposals from the men to the women. Wilson [ll] showed that the maximum number of proposals to obtain the M-optimal p,,, is n2 - n + 1 when their algorithm is used, where n is the problem size.
In this section we present the necessary and sufficient condition for the worst-case choices for the stable matching problem which takes the max- imum number of proposals for the sequential sta- ble matching algorithms.
Lemma 1 [lo]. For a worst-case execution of the sequential stable matching algorithms the following two statements are true:
(i) There exists one woman w, who is the last choice of all men in A4 and the (n - 1) th choices of all men consists of all the members in W - { w, }.
(ii) For each woman w, in W - {w,}, the first choice of w, must be m, whose (n - 1)th choice is w,, i.e., m,[n - l] = w,.
The proof is simple, and we will not repeat it. However, the key point in the proof is that there is only one man who will propose to his last choice and all of the other men propose to their (n - 1)th choice women if the worst case occurs by using the sequential stable matching algorithm.
Volume 34. Number 5 INFORMATION PROCESSING LETTERS 7 May 1990
In order to show our central theorem, we need one more lemma. Given any arbitrary instance (M,W, P), if p,,, is the derivative of the worst-case execution, then there must exist no male-oriented rotation exposed in p,, otherwise pLM will not be the derivative of the worst-case execution. Hence (M, W, P) has only one stable matching and so Lemma 2. Given (M, W, P), if pm is the derivative of the worst-case execution, then p, = pLm.
Now, we are concerned with the necessary and sufficient condition for the worst-case execution of any sequential stable matching algorithm. Theorem 3. Given any arbitrary instance ( M, W, P) which leads to the worst-case execution of any sequential stable matching algorithm, that returns lJ,ln as its answer, iff the preference pattern P satis- fies the following conditions:
(i) Statements (i)-(ii) as stated in Lemma 1. (ii) There exists no female-oriented rotation ex- posed in Pi.
Proof. “If” part. We want to show that if P satisfies the given condition, then the worst-case execution will occur. It is easy to derive pL, from statement (i) of the theorem. Let pS = {(w,[l], w,) ]w, in W- {We}}. Then p,,,=pL,U {(m’, m,)} where m’ is the man who is unmatched in pS.
It is pointed out in [4], by slight modification, that if there is no female-oriented rotation ex- posed in pL,, then the first entries in the female- oriented shortlists should specify the pm,. That is, ,uL, = CL,,,. But statement (i) of the theorem implies that pLs can also be represented as {(m,, m,[n -
11) I m, in M - {m’>>. So P, = P,~
U {Cm’,
m’[ n])} and this implies that the worst-case execu- tion occurs. This completes the proof of the suf- ficiency of the condition.
“Only if” part. The proof of the necessity of the condition is a direct consequence of Lemmas 1 and 2. Lemma 1 states that statement (i) of the theorem must be true if the worst-case execution occurs. From Lemma 2 we know that if pm is the derivative of the worst-case execution, then for the given instance there exists only one stable match- ing which is both M-optimal and W-optimal. This implies that there must exist no female-oriented
rotation exposed in p,. This completes the proof of the “only if” part of the theorem.
Herewith, the proof of the theorem has been completed. 0
Using the theory of generalized derangements [7] we can show that the probability of the worst case occurring is n!/[2n”(n - l)2(“P’)]. This result indicates that the probability of the worst case occurring is extremely small. For example for n = 8 the probability that the worst case occurs is ap- proximately 1.77 X lOPI5 and this reduces to 2.95
X 1OP42 for n = 16.
4. Conclusions
In this paper we have found the necessary and sufficient condition for the worst-case execution of the sequential stable matching algorithms. Moreover, we have pointed out the probability that the worst-case execution occurs when a sequential stable matching algorithm is employed. References HI 121 [31 141 [51 [61 [71 [81 [91 HOI 1111
D. Gale and L.S. Shapley, College admissions and the stability of marriage, Amer. Math. Monthly 69 (1962) 9-15.
D. Gusfield, Three fast algorithms for four problems m stable marriage, SIAM J. Comput. 16 (1) (1987) 111-128. M.E.C. Hull, A parallel view of stable marriages, Znjorm. Process. Left. 18 (1) (1984) 63-66.
R.W. Irving, P. Leather and D. Gusfield, An efficient algorithm for the optimal stable marriage, J. ACM 34 (3) (1987).
S.Y. Itoga, The upper bound for the stable marriage problem, J. Opl. Rex Sot. 29 (8) (1978) 811-814. D. Kapur and MS. Krishnamoorthy, Worst-case choice for the stable marriage problem, Inform. Process. Lett. 21 (1985) 27-30.
C.L. Liu, Zntroduction to Combinatorial Mathematics (Mc- Graw-Hill, New York, 1968).
D.G. McVitie and L.B. Wilson, The stable marriage prob- lem, Comm. ACM 14 (7) (1971) 486-490.
D.G. McVitie and L.B. Wilson, Algorithm 411, Pts. 1-3. Three procedures for the stable marriage problem, Comm. ACM 14 (7) (1971) 491-492.
S.S. Tseng and R.C.T. Lee, A parallel algorithm to solve the stable marriage problem, BIT 24 (1984) 308-316. L.B. Wilson, An analysis of the stable marriage assign- ment algorithm, BIT 12 (1972) 569-575.