1 / 18

Design & Co-design of Embedded Systems

Design & Co-design of Embedded Systems. Final Project: “The Match Maker” Second Phase Oral Presentation Safa S. Mahmoodian. The Stable Marriage Problem. Consider the following information: a collection of eligible men, each with a rank ordered list of girlfriends

moanna
Download Presentation

Design & Co-design of Embedded Systems

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Design & Co-design of Embedded Systems Final Project: “The Match Maker” Second Phase Oral Presentation Safa S. Mahmoodian

  2. The Stable Marriage Problem • Consider the following information: • a collection of eligible men, each with a rank ordered list of girlfriends • a collection of eligible women, each with a rank ordered list of boyfriends • Assume that: • the number of men and women are equal • all men rank all women, and vice versa • rank ordered lists are in decreasing order of preference "The Match Maker"

  3. The Stable Marriage Problem (cont’d) • We define a marriage arrangement to be a pairing of the men and women such that: • each man is paired with one woman and • every person appears in exactly one pair. • We say that a marriage arrangement is stable if there does not exist a woman X and man Y such that: • X prefers Y over X's husband, and • Y prefers X over Y's wife. • Note: If there would exist such people, then they would want to run off together, creating an unstable situation. "The Match Maker"

  4. The Stable Marriage Problem (cont’d) • The problem is: • “Given the preference rankings of the men and women, construct a stable marriage arrangement.” "The Match Maker"

  5. The Stable Marriage Problem (cont’d) • The method For solving this problem works something like this: • The first man will propose to the first woman on his list. • She having no better offer at this point, will accept. • The second man will then propose to his first choice, and so on. • Eventually it may happen that a man proposes to a woman who already has a partner. "The Match Maker"

  6. The Stable Marriage Problem (cont’d) • She will compare the new offer to her current partner and will accept whoever is higher on her list. • The man she rejects will then go back to his list and propose to his second choice, third choice, and so forth until he comes to a woman who accepts his offer. • If this woman already had a partner, her old partner gets rejected and he in turn starts proposing to women further down his list. • Eventually everything gets sorted out. "The Match Maker"

  7. The Stable Marriage Problem (cont’d) • Algorithm: • Each person starts with no people "canceled" from his or her list. • People will be canceled from lists as the algorithm progresses. • For each man m, do propose(m), as defined below. "The Match Maker"

  8. The Stable Marriage Problem (cont’d) • propose(m): • Let W be the first uncanceled woman on m's preference list. • Do: refuse(W,m), as defined in the next slide. • refuse(W,m): • Let m' be W 's current partner (if any). • If W prefers m' to m, then she rejects m, in which case: • cancel m off W 's list and W off m's list; • do: propose(m). (Now m must propose to someone else.) • Otherwise, W accepts m as her new partner, in which case: • cancel m' off W 's list and W off m' 's list; • do: propose(m'). (Now m' 's must propose to someone else.) "The Match Maker"

  9. The Stable Marriage Problem (cont’d) • How do we know the final arrangement will be stable? • Suppose there exists a man Y and woman X such that they prefer each other over their own spouses. Since Y prefers X over his own spouse, then he must have proposed to her before proposing to his own spouse. So there are two possibilities of what happened at the time of that proposal. • Either: • X rejected Y, which means that she was already engaged to someone she preferred over Y (she had scratched Y off her list). Therefore, she must either be married to that person or someone else who was on her list at the time of the proposal. Therefore, she could not prefer Y to her own spouse, contradicting our assumption. • X accepted Y, but dumped him later. Since she would have dumped him only in order to become engaged to someone higher ranked on her list, she must not prefer Y over her own spouse, again contradicting the assumption. "The Match Maker"

  10. The Stable Marriage Problem (cont’d) • In both cases, the assumption is contradicted. So, there cannot exist a man Y and woman X such that they prefer each other over their own spouses. •  The arrangement is stable. • How do we know everyone gets paired off? • Since the number of men and women are equal, the only way for a man to remain eligible at the end is for there to be an unengaged woman who rejects him. However, the only rejections come from women who are engaged. "The Match Maker"

  11. The Stable Marriage Problem (cont’d) • Before proceeding further, we need to choose Data Structures to hold the relevant information. • Let's think about what happens as the algorithm runs. At any point in the algorithm: • a man is either eligible or engaged • a woman is engaged to at most one man • each man and woman has a ranked list of preferences • For eligible men, we can use a list of men. For the engagements, we can use a mapping from women to men. Each man and woman can be an object that contains a list of preferences. "The Match Maker"

  12. The Stable Marriage Problem (cont’d) • The main procedure for the algorithm thus becomes: • void findMarriages() { • while (eligible != null) { • Man m = (Man) eligible.person; • Woman w = m.topPick(); • if (w.likes(m)) { • Man oldHusband = (Man) couples.lookup(w); • if (oldHusband == null) • eligible = eligible.next; • else • eligible = new PersonList(oldHusband, eligible.next); • couples.map(w, m); • w.trimList(m); • } • m.scratchTop(); • } • } "The Match Maker"

  13. Example: • We Have a list of 4 men and 4 women and their prefrence list as below: • Asghar: Donya Azita Cobra Bahar • Behnam: Azita Cobra Donya Bahar • Cirous: Cobra Donya Bahar Azita • Dani: Donya Azita Cobra Bahar • Azita: Asghar Cirous Dani Behnam • Bahar: Dani Asghar Behnam Cirous • Cobra: Cirous Behnam Dani Asghar • Donya: Behnam Dani Cirous Asghar "The Match Maker"

  14. Example: (cont’d) • Asghar: Donya Azita Cobra Bahar • Behnam: Azita Cobra Donya Bahar • Cirous: Cobra Donya Bahar Azita • Dani: Donya Azita Cobra Bahar • Azita: Asghar Cirous Dani Behnam • Bahar: Dani Asghar Behnam Cirous • Cobra: Cirous Behnam Dani Asghar • Donya: Behnam Dani Cirous Asghar Stable Marriages! Asghar Donya Azita Asghar Behnam Cirous Dani Azita Donya Cobra Bahar Behnam Azita Cobra Donya Cirous Cobra Dani Donya Azita Cobra Bahar "The Match Maker"

  15. The Stable Marriage Problem (cont’d) • Who gets a better deal in this algorithm, the men or the women? • It turns out that since the unengaged women in this algorithm accept any proposal, the men end up happier on average! • For example, suppose there are 5 men and 5 women, and suppose every man has a different first choice. Then they'll all get their first choice, regardless of the preferences of the woman!!! • This is actually rather facetious viewpoint; this problem is typically applied to relationships somewhat more paradigmatic than marriage, such as roommate assignments, dormitory room assignments, university admissions, match graduating medical students to hospitals and in konkoor. "The Match Maker"

  16. The BIG Question: • What have I done till present day?!!! • Collected a list of materials relevant to the subject (if you want the list, just call me) • Finally sorted out the algorithm (as I presented) • Written a C++ code of the algorithm that actually works! • Simple procedures and methods • In result, so many procedures and methods • Easier to manipulate for the next level • (Next level!) Thought about choosing HW or SW for each procedure and method to obtain the optimum solution (I didn’t get anywhere with this!) "The Match Maker"

  17. The BIG Question: (#2) • What will I do from present day?!!! • Continue thinking! • If (any result) • Then: • Write the HW parts in SystemC • Simulate both HW and SW separately • Synthesize the system (Try to make them work “Together!”) "The Match Maker"

  18. Question time! • Any questions??? "The Match Maker"

More Related