算法分析稳定匹配问题c语言,算法-稳定匹配StableMatching

《算法-稳定匹配StableMatching》由会员分享,可在线阅读,更多相关《算法-稳定匹配StableMatching(22页珍藏版)》请在人人文库网上搜索。

1、1,Salute Lloyd Shapley,Lloyd Stowell Shapley (June 2, 1923 March 12, 2016),1980,Nobel Memorial Prize in Economic Sciences(2012),Stable Matching,3,Matching Residents to Hospitals,Goal. Given a set of preferences among hospitals and medical school students, design a self-reinforcing admissions process。

2、. Unstable pair: applicant x and hospital y are unstable if: x prefers y to its assigned hospital. y prefers x to one of its admitted students. Stable assignment. Assignment with no unstable pairs. Natural and desirable condition. Individual self-interest will prevent any applicant/hospital deal fro。

3、m being made.,4,Stable Matching Problem,Goal. Given n men and n women, find a suitable matching. Participants rate members of opposite sex. Each man lists women in order of preference from best to worst. Each woman lists men in order of preference from best to worst.,Zeus,Amy,Clare,Bertha,Yancey,Ber。

4、tha,Clare,Amy,Xavier,Amy,Clare,Bertha,1st,2nd,3rd,Mens Preference Profile,favorite,least favorite,Clare,Xavier,Zeus,Yancey,Bertha,Xavier,Zeus,Yancey,Amy,Yancey,Zeus,Xavier,1st,2nd,3rd,Womens Preference Profile,favorite,least favorite,5,Stable Matching Problem,Perfect matching: everyone is matched mo。

5、nogamously. Each man gets exactly one woman. Each woman gets exactly one man. Stability: no incentive for some pair of participants to undermine assignment by joint action. In matching M, an unmatched pair m-w is unstable if man m and woman w prefer each other to current partners. Unstable pair m-w 。

6、could each improve by eloping. Stable matching: perfect matching with no unstable pairs. Stable matching problem. Given the preference lists of n men and n women, find a stable matching if one exists.,6,Stable Matching Problem,Q. Is assignment X-C, Y-B, Z-A stable?,Zeus,Amy,Clare,Bertha,Yancey,Berth。

7、a,Clare,Amy,Xavier,Amy,Clare,Bertha,1st,2nd,3rd,Mens Preference Profile,Clare,Xavier,Zeus,Yancey,Bertha,Xavier,Zeus,Yancey,Amy,Yancey,Zeus,Xavier,1st,2nd,3rd,Womens Preference Profile,favorite,least favorite,favorite,least favorite,7,Stable Matching Problem,Q. Is assignment X-C, Y-B, Z-A stable? A. 。

8、No. Bertha and Xavier will hook up.,Zeus,Amy,Clare,Bertha,Yancey,Bertha,Clare,Amy,Xavier,Amy,Clare,Bertha,Clare,Xavier,Zeus,Yancey,Bertha,Xavier,Zeus,Yancey,Amy,Yancey,Zeus,Xavier,1st,2nd,3rd,1st,2nd,3rd,favorite,least favorite,favorite,least favorite,Mens Preference Profile,Womens Preference Profil。

9、e,8,Stable Matching Problem,Q. Is assignment X-A, Y-B, Z-C stable? A. Yes.,Zeus,Amy,Clare,Bertha,Yancey,Bertha,Clare,Amy,Xavier,Amy,Clare,Bertha,Clare,Xavier,Zeus,Yancey,Bertha,Xavier,Zeus,Yancey,Amy,Yancey,Zeus,Xavier,1st,2nd,3rd,1st,2nd,3rd,favorite,least favorite,favorite,least favorite,Mens Pref。

10、erence Profile,Womens Preference Profile,9,Stable Roommate Problem,Q. Do stable matchings always exist? A. Not obvious. Stable roommate problem. 2n people; each person ranks others from 1 to 2n-1. Assign roommate pairs so that no unstable pairs. Observation. Stable matchings do not always exist for 。

11、stable roommate problem.,B,Bob,Chris,Adam,C,A,B,D,D,Doofus,A,B,C,D,C,A,1st,2nd,3rd,A-B, C-D B-C unstableA-C, B-D A-B unstableA-D, B-C A-C unstable,10,Propose-and-reject algorithm. Gale-Shapley 1962 Intuitive method that guarantees to find a stable matching.,Propose-And-Reject Algorithm,Initialize ea。

12、ch person to be free. while (some man is free and hasnt proposed to every woman) Choose such a man m w = 1st woman on ms list to whom m has not yet proposed if (w is free) assign m and w to be engaged else if (w prefers m to her fianc m) assign m and w to be engaged, and m to be free else w rejects 。

13、m ,11,Proof of Correctness: Termination,Observation 1. Men propose to women in decreasing order of preference. Observation 2. Once a woman is matched, she never becomes unmatched; she only trades up. Claim. Algorithm terminates after at most n2 iterations of while loop. Pf. Each time through the whi。

14、le loop a man proposes to a new woman. There are only n2 possible proposals. ,n(n-1) + 1 proposals required,12,Proof of Correctness: Perfection,Claim. All men and women get matched. Pf. (by contradiction) Suppose, for sake of contradiction, that Zeus is not matched upon termination of algorithm. The。

15、n some woman, say Amy, is not matched upon termination. By Observation 2, Amy was never proposed to. But, Zeus proposes to everyone, since he ends up unmatched. ,13,Claim. No unstable pairs. Pf. (by contradiction) Suppose A-Z is an unstable pair: each prefers each other to partner in Gale-Shapley ma。

16、tching S*. Case 1: Z never proposed to A. Z prefers his GS partner to A. A-Z is stable. Case 2: Z proposed to A. A rejected Z (right away or later) A prefers her GS partner to Z. A-Z is stable. In either case A-Z is stable, a contradiction. ,Proof of Correctness: Stability,Bertha-Zeus,Amy-Yancey,S*,。

17、. . .,men propose in decreasingorder of preference,women only trade up,14,Summary,Stable matching problem. Given n men and n women, and their preferences, find a stable matching if one exists. Gale-Shapley algorithm. Guarantees to find a stable matching for any problem instance. Q. How to implement 。

18、GS algorithm efficiently? Q. If there are multiple stable matchings, which one does GS find?,15,Efficient Implementation,Efficient implementation. We describe O(n2) time implementation. Representing men and women. Assume men are named 1, , n. Assume women are named 1, , n. Engagements. Maintain a li。

19、st of free men, e.g., in a queue. Maintain two arrays wifem, and husbandw. set entry to 0 if unmatched if m matched to w then wifem=w and husbandw=m Men proposing. For each man, maintain a list of women, ordered by preference. Maintain an array countm that counts the number of proposals made by man 。

20、m.,16,Efficient Implementation,Women rejecting/accepting. Does woman w prefer man m to man m? For each woman, create inverse of preference list of men. Constant time access for each query after O(n) preprocessing.,for i = 1 to n inverseprefi = i,Amy prefers man 3 to 6since inverse3 inverse6,2,7,17,U。

21、nderstanding the Solution,Q. For a given problem instance, there may be several stable matchings. Do all executions of Gale-Shapley yield the same stable matching? If so, which one? An instance with two stable matchings. A-X, B-Y, C-Z. A-Y, B-X, C-Z.,Zeus,Yancey,Xavier,A,B,A,1st,B,A,B,2nd,C,C,C,3rd,。

22、Clare,Bertha,Amy,X,X,Y,1st,Y,Y,X,2nd,Z,Z,Z,3rd,18,Understanding the Solution,Q. For a given problem instance, there may be several stable matchings. Do all executions of Gale-Shapley yield the same stable matching? If so, which one? Def. Man m is a valid partner of woman w if there exists some stabl。

23、e matching in which they are matched. Man-optimal assignment. Each man receives best valid partner. Claim. All executions of GS yield man-optimal assignment, which is a stable matching! No reason to believe that man-optimal assignment is perfect, let alone stable. Simultaneously best for each and ev。

24、ery man.,19,Man Optimality,Claim. GS matching S* is man-optimal. Pf. (by contradiction) Suppose some man is paired with someone other than best partner. Men propose in decreasing order of preference some man is rejected by valid partner. Let Y be first such man, and let A be first validwoman that rejects him. Let S be a stable matching where A and either r is unmatched, or r prefers h to her assigned hospital; and either h does not have all its places filled, or h prefers r to at least one of its assigned residents.,resident A unwilling towork in Cleveland,hospital X wants to hire 3 residents。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值