Reproduced - spare tire Algorithm

Spare tire algorithm

 

Suppose there are three men (respectively A, B, C) and three women (namely, x, y, z), his (her) favorite degree of anisotropy as shown in the dialog box.

 

For example, M A, the crush ranked first row x, y ranked second, z the third row.

Today is a special holiday, you are transformed into Cupid, to design an algorithm to assign object.

 

Immediately accepted algorithm

Below boys active pursuit of the object as an example to explain the immediate acceptance algorithm .

The boys are beginning to pursue their most favorite girls, while girls face suitors to make a decision immediately determine the object (if there are multiple suitors select a higher degree before they admire that, then it is only a You can only vote for him).

Then, immediately rejected boys to chase girls second favorite, and so on until pairing is completed, as shown in FIG moving.

 

 

Such practices have a very serious problem: when you are refused your No.1, No.2 go to pursue your time, your heart No.2 may have chosen someone else in the first round, such as boys B in the first round to tell the truth girl x, y confession after the failure of wanted to pursue, but the girls have y and C together, the tragedy is the right man y eyes what she did not tell the truth to the boys B.

Where the final match as shown in FIG.

 

 

Although the result of the match ended, boys and girls each have a target, but the following will happen.

B for boys, although he and the girls z together, but in fact he is more desirable and y together (note A and x are the two sides of love, do not split open).

Meanwhile, the girls y, although she and the boys C together, but in fact she is more desirable and B together.

That boys and girls B y are more willing to leave their current objects and each other.

Therefore, the use immediately accepted algorithm result of the match is the result of an unstable state.

Delayed acceptance algorithm

"Gail - Shapley Algorithm" (the Gale-Shapley algorithm), also known as "delayed acceptance algorithm" (deferred-acceptance algorithm), referred to as "GS algorithm."

目前该算法在 高中择校系统、肾脏移植 等实际应用上起到了巨大的作用,你甚至可以在 2012 年诺贝尔经济学奖中看到它的身影。

这个算法一个核心之处在于,合意的要约不会立即被接受,而只是被“抓住”(hold on to),也就是“延迟接受”。

还是以男生主动追求对象为例来讲解 延迟接受算法

首先每个男生在第一轮中向自己最心仪的女生表白,但是各位女生不用立即做决定,而是先 hold 住。

第一轮

第一轮,男生 A 和男生 B 都跟女生 x 表白,女生 x 按捺激动的心情,矜持没有表态直接选男生 A,只是把男生 A 放入考察范围

男生 C 跟女生 y 表白,女生 y 略显失望,但把男生 C 放入了考察范围。

 

 

第二轮

第二轮,每个男生再向心中的 No.2 示爱。并且从第二轮开始,每位女生们只保留自己到现在为止所收获的最心仪的男生(但是不用答应他,只hold在心里),而拒绝其他所有人。

而被拒绝的男生(也就是现在尚没有女生 hold 你的男生)则继续在下一轮中向心中排名的下一个女生表白。

以此类推,一轮轮继续下去,直到所有想示爱的男生都示完为止。

最后,每个女生手里都有 hold 的对象。

 

 

 

 

使用 延迟接受算法 后,最终 A - x ,B - y ,C - z 在一起,并且在这 6 人中,你不可能找到一男一女符合以下条件:他(她)们都更愿意抛弃已有的对象而与彼此在一起。

使用 延迟接受算法 匹配后的结果是一种稳定的状态结果。

结尾语

最后回到标题,对于爱情问题,上面的盖尔-沙普利算法告诉我们一点:

主动追求比被动等待更有希望获得幸福

所以,如果你无法让表白成为你胜利的号角,那倒在进攻的冲锋号上也未尝不可。

个人理解:对于相亲的结果集进行选择时可以用这个算法

Guess you like

Origin www.cnblogs.com/xiaoshahai/p/12072563.html