Stable marriage problem笔记
来源:互联网 发布:淘宝质量好的牛仔裤 编辑:程序博客网 时间:2024/05/21 21:39
Stable marriage problem
1.前言
看到一篇有意思的文章,讲配对算法的,写篇笔记记录一下~
How a matchmaking algorithm saved lives
例如傲慢与偏见里的人物,如果用算法给他们自动配对,岂不是很有意思~
2.算法
翻译 维基百科
the stable marriage problem (also stable matching problem or SMP) is the problem of finding a stable matching between two equally sized sets of elements given an ordering of preferences for each element. 简单翻译,稳定婚姻问题就是两个集合找配对的问题。
A matching is stable whenever it is not the case that both the following conditions hold. 一个匹配是稳定的,以下两个条件不能同时成立。
- There is an element A of the first matched set which prefers some given element B of the second matched set over the element to which A is already matched, and
A对于自己的匹配,更喜欢B - B also prefers A over the element to which B is already matched.
B对于自己的匹配,更喜欢A
具体步骤
In the first round,
a) each unengaged man proposes to the woman he prefers most, and then
b) each woman replies “maybe” to her suitor she most prefers and “no” to all other suitors. She is then provisionally “engaged” to the suitor she most prefers so far, and that suitor is likewise provisionally engaged to her.
In each subsequent round,
a) each unengaged man proposes to the most-preferred woman to whom he has not yet proposed (regardless of whether the woman is already engaged), and then
b) each woman replies “maybe” if she is currently not engaged or if she prefers this guy over her current provisional partner (in this case, she rejects her current provisional partner who becomes unengaged).
This process is repeated until everyone is engaged.
The runtime complexity of this algorithm is
第一回合
a) 所有没订婚的男士,向他们最喜欢的女士求婚
b) 所有没订婚的女士,对其求婚者中最喜欢的回复”maybe”, 对其他求婚者回复”no”
其余回合
a) 所有没订婚的男士,向他们没求过婚的最喜欢的女士求婚(不管该女士是否订婚)
b) 所有女士,依次考虑其每个求婚者,如果该女士没有订婚,则回复”maybe”与该求婚者订婚;如果已经订婚,但更喜欢该求婚者,则回复”maybe”与该求婚者订婚,被抛弃的订婚者变成未订婚者
重复该过程直到所有人订婚 (男女人数一样)
算法时间复杂度
3.应用
- 医生和医院的匹配
学生和学校的匹配
- 肾脏捐献者和接收者匹配
In 2012, the Nobel Prize in Economics was awarded to Lloyd S. Shapley and Alvin E. Roth “for the theory of stable allocations and the practice of market design.”
论文作者在2012年获得诺贝尔经济学奖
论文:
College Admissions and the Stability of Marriage Gale, D.; Shapley, L. S. (1962). American Mathematical Monthly
- Stable marriage problem笔记
- Stable Marriage Problem
- stable marriage problem
- POJ3487 The Stable Marriage Problem
- poj3487-The Stable Marriage Problem
- HDOJ 1914 The Stable Marriage Problem
- 【稳定匹配】:poj3487,The Stable Marriage Problem
- POJ 3487 The Stable Marriage Problem
- HDOJ 1914 The Stable Marriage Problem
- HDU 1914 The Stable Marriage Problem
- stable marriage
- POJ 3487 The Stable Marriage Problem (稳定婚姻问题)
- POJ 3487 The Stable Marriage Problem 稳定婚姻问题
- The Stable Marriage Problem 稳定婚姻问题与应用
- poj3487 The Stable Marriage Problem(最稳定的婚姻)
- 稳定婚姻匹配问题 EOJ 162 The Stable Marriage Problem
- hdu 1914 The Stable Marriage Problem(延迟认可算法)
- The Stable Marriage Problem(稳定婚姻问题)
- Android中自定义控件
- POJ 2560
- Mac eclipse 快捷键及常用设置
- 工具类收藏
- Error:Connection timed out: connect.
- Stable marriage problem笔记
- android 常用方法
- Gallery单独使用,Gallery和ImageSwitcher组件结合使用的例子
- 4.3 不要编写返回引用可变对象的访问器方法
- 线程的状态与调度
- 5、可以为空的值类型int?
- USACO4.2.1 网络流最大流算法
- Android listview addHeaderView 和 addFooterView 详解
- ACE模板知识积累-CSS部分-1-.space