The Stable marriage problem

Source: Internet
Author: User

Classic Stable marital problems

"Stable marriage problem (the Stable marriage problem)" is roughly said to be 100 GG and 100 mm according to their own liking to the level of all the opposite sex score sort. Every handsome man by his likes and dislikes to each mm rating: I love A, second love B, Love again c ... Every handsome guy dozen different, your favorite may be I hate most of my favorite may be he did not like. Similarly, every beauty also gives each handsome man a grade. Now they need to be paired with 100 pairs of bride and groom, and make sure they get a stable marriage. So, what is an unstable marriage? The so-called unstable marriage is that, for example, there are two couples (M1, F1) and (M2, F2), M1 's wife is F1, but he loves F2, and F2 husband is M2, but she more love m1--such marriage is unstable marriage, M1 and F2 should be combined, they now each marriage is wrong.
So, the excitement of the marriage proposal begins.
On the first morning, all the boys proposed to their favorite girls. In the afternoon, each mm to see if they have received, how many people have received the proposal. If only one boy's proposal is received, then he is engaged to him. If more than one GG's proposal is received, then she is engaged to the man whom she loves most, and rejects all the other men. If a marriage proposal is not, do not worry, there will always be. Night, check again, if all mm are engaged, OK, everything is going to be a collective wedding tomorrow!
But if there are people who are not engaged, then things are not done, and the next day is repeated.
The next morning, all the boys who were not engaged were proposing to their loved one (because yesterday had been rejected by their favorite), and each mm looked at herself once more for the engagement. If she is engaged, but there is another man she loves to propose to her, then reject it and get engaged to the more loving man; If you are not engaged, it will be the same as the first day of the afternoon. Check again at night, and repeat the third day if someone is not engaged.
The third morning, all the non-engaged GG, including the first day ordered the next day and be kicked out (it seems to be a bit of a sense of hardship), and then to the MM who has not rejected his favorite of the proposal
......
So again and again, until the end of everyone is engaged in marriage, then married together! Haha, congratulations, congratulations.

The Stable marriage problem

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.