Naveen Garg, CSE, IIT Delhi

Slides:



Advertisements
Similar presentations
Stable Matching Problems with Constant Length Preference Lists Rob Irving, David Manlove, Gregg OMalley University Of Glasgow Department of Computing Science.
Advertisements

Blah blah blah. Zoes shark Thanks to the conference artist Phoebe.
Minibridge Cowbridge Comprehensive July 2007 Patrick Jourdain.
Piyush Kumar (Lecture 3: Stable Marriage) Welcome to COT5405.
Prof. Swarat Chaudhuri COMP 482: Design and Analysis of Algorithms Spring 2013 Lecture 2.
1 Overview of Graph Theory Addendum “The Stable Marriage Problem” Instructor: Carlos Pomalaza-Ráez Fall 2003 University of Oulu, Finland.
Matching Theory.
Bipartite Matching, Extremal Problems, Matrix Tree Theorem.
1 Discrete Structures & Algorithms Graphs and Trees: III EECE 320.
Tutorial 6 of CSCI2110 Bipartite Matching Tutor: Zhou Hong ( 周宏 )
04/12/2005Tucker, Sec Applied Combinatorics, 4 th Ed. Alan Tucker Section 4.4 Algorithmic Matching Prepared by Joshua Schoenly and Kathleen McNamara.
Chapter 26 of CLSR Bipartite Matching By Dr. M. Sakalli, Sources: Levitin and many other CSE, Marmara Univ. May/2009.
Lecture 4 CSE 331 Sep 9, Blog posts for lectures Starts from today See Sep 8 post on the blog.
1 Bipartite Matching Lecture 3: Jan Bipartite Matching A graph is bipartite if its vertex set can be partitioned into two subsets A and B so that.
1 Bipartite Matching Polytope, Stable Matching Polytope x1 x2 x3 Lecture 10: Feb 15.
Lecture 8 CSE 331 Sep 17, HW 1 due today Place Q1 and Q2 in separate piles I will not accept HWs after 1:15pm.
VOCABULARY  Deck or pack  Suit  Hearts  Clubs  Diamonds  Spades  Dealer  Shuffle  Pick up  Rank  Draw  Set  Joker  Jack 
Week 11 - Friday.  What did we talk about last time?  Exam 2 post mortem  Cycle detection  Connectivity.
Lecture 6 CSE 331 Sep 10, Homeworks HW 1 posted online: see blog/piazza Pickup graded HW 0 in TA OHs.
Chapter 10: Iterative Improvement Simplex Method The Design and Analysis of Algorithms.
The Stable Marriage Problem
CSE, IIT KGP Matchings and Factors. CSE, IIT KGP Matchings A matching of size k in a graph G is a set of k pairwise disjoint edges.A matching of size.
Combinations Problems Problem 1: Sometimes we can use several counting techniques in the same problem, such as combinations and the addition principle.
1 Online algorithms Typically when we solve problems and design algorithms we assume that we know all the data a priori. However in many practical situations.
Lecture 4 CSE 331 Sep 6, TA change Swapnoneel will leave us for 531 Jiun-Jie Wang will join us.
Pitch Playing Agent Project for Into to AI Jody Ammeter.
Lecture 2 CSE 331. Day 1 Survey On UBlearns Day 1 Survey (talking points) Security MS PhD for research Building PC’s for 442 It’s ok to play games –
Stable Matchings a.k.a. the Stable Marriage Problem
Lecture 5 CSE 331 Sep 11, Submit the form I’ll need confirmation in writing. No graded material will be handed back till I get this signed form.
1 The Stable Marriage Problem Algorithms and Networks 2014/2015 Hans L. Bodlaender Johan M. M. van Rooij.
All Pair Shortest Path IOI/ACM ICPC Training June 2004.
Stable Matching Lecture 7: Oct 3. Matching A B C DE Boys Girls Today’s goal: to “match” the boys and the girls in a “good” way.
Design & Co-design of Embedded Systems Final Project: “The Match Maker” Second Phase Oral Presentation Safa S. Mahmoodian.
Bipartite Matching. Unweighted Bipartite Matching.
The Stable Marriage Problem
Game Engineering Robert Aumann Center for the Study of Rationality The Hebrew University of Jerusalem.
Matching Lecture 19: Nov 23.
Sep 29, 2014 Lirong Xia Matching. Report your preferences over papers soon! –deadline this Thursday before the class Drop deadline Oct 17 Catalan independence.
CS425: Algorithms for Web Scale Data Most of the slides are from the Mining of Massive Datasets book. These slides have been modified for CS425. The original.
Weighted Matchings & Applications in Scientific Computing Mahantesh Halappanavar Department of Computer Science Joint Work with: Florin Dobrian and Alex.
Fair Shares.
Graph Algorithms Maximum Flow - Best algorithms [Adapted from R.Solis-Oba]
CSCI 256 Data Structures and Algorithm Analysis Lecture 2 Some slides by Kevin Wayne copyright 2005, Pearson Addison Wesley all rights reserved, and some.
Market Design and Analysis Lecture 2 Lecturer: Ning Chen ( 陈宁 )
Market Design and Analysis Lecture 1 Lecturer: Ning Chen ( 陈宁 )
Indian Institute of Technology Kharagpur PALLAB DASGUPTA Graph Theory: Matchings and Factors Pallab Dasgupta, Professor, Dept. of Computer Sc. and Engineering,
1 Graphs Chapters 10.1 and 10.2 University of Maryland Chapters 10.1 and 10.2 Based on slides by Y. Peng University of Maryland.
IOI/ACM ICPC Training 4 June 2005.
Matching Boys Girls A B C D E
Cybernetica AS & Tartu University
Stable Marriage Problem
Lecture 4 CSE 331 Sep 7, 2016.
Chapter 10 Iterative Improvement
Bipartite Matching Lecture 8: Oct 7.
Maximum Flow - Best algorithms
CSE 421: Introduction to Algorithms
Various Graph Algorithms
Graphs Chapters 10.1 and 10.2 Based on slides by Y. Peng University of Maryland.
Lecture 7 CSE 331 Sep 15, 2010.
Discrete Mathematics for Computer Science
Lecture 6 CSE 331 Sep 13, 2010.
Lecture 13 CSE 331 Sep 29, 2010.
Lecture 9 CSE 331 Sep 18, 2017.
Systems of distinct representations
Lecture 9 CSE 331 Sep 19, 2016.
Lecture 10 CSE 331 Sep 21, 2011.
Lecture 10 CSE 331 Sep 21, 2012.
Lecture 5 CSE 331 Sep 9, 2011.
Week 10 - Wednesday CS221.
Lecture 11 CSE 331 Sep 20, 2013.
Presentation transcript:

Naveen Garg, CSE, IIT Delhi Match making Naveen Garg, CSE, IIT Delhi

Lets begin with a card trick! Please pick 5 cards from the deck offered by Smriti. Give the 5 cards to her. Smriti will return one card to the audience. She will tell me what the remaining 4 cards are. I will tell you what the fifth card was.

The card trick Was invented by Fitch Cheney and first appeared in 1950 in the Math miracles. The trick can be done even with a deck of 124 cards (all distinctly numbered).

A 2-player Path Game Player 1 and Player 2 alternate picking vertices forming a path. The first to get stuck loses. Player 1 loses

A 2-player Path Game Another run. Player 2 loses Do either player have a winning strategy? Does the answer depend on the graph?

A card puzzle A deck of playing cards arranged in a 4x13 grid Pick one card from each column so as to get all values (Ace to King)

A card puzzle A deck of playing cards arranged in a 4x13 grid Pick one card from each column so as to get all values (Ace to King) Is this always possible or does it depend on the arrangement of cards?

Pairing Players 5 men and 5 women players. Each player can be paired only with some other players Can you make 5 teams for a mixed doubles game? W1 W2 W3 W4 W5 M1 yes M2 M3 M4 M5 M1 M5 M4 W5 W1 M2 M3 W2 W3 W4 A bipartite graph

Pairing Players 5 men and 5 women players. Each player can be paired only with some other players Can you make 5 teams for a mixed doubles game? W1 W2 W3 W4 W5 Yes M1-W2, M2-W1, M3-W4, M4-W5, M5-W3 The bipartite graph has a perfect matching

Pairing Players M1 M2 M3 M4 M5 Suppose M2, W1 had a fight and do not want to be partners anymore. Is a perfect matching still possible? No. Because M2, M5 can partner only with W3. {M2,M5} is a Hall set. W1 W2 W3 W4 W5 Let N(S) denote the neighbors (possible partners) of a set S. A Hall set is a set of vertices, S, such that 𝑁 𝑆 <|𝑆|

Hall’s theorem A bipartite graph has a perfect matching iff it has no Hall set. If for every set of vertices, S, |𝑁 𝑆 |≥|𝑆|, then the bipartite graph has a perfect matching

Solution to the card puzzle A deck of playing cards arranged in a 4x13 grid Pick one card from each column so as to get all values (Ace to King) Is this always possible or does it depend on the arrangement of cards?

Solution to the card puzzle ACE Solution to the card puzzle No matter how cards are arranged we can always pick one from each column to get all values. A,Q,9,Q One side of bipartite graph has a vertex for each column. The other side has a vertex for each value (ace to king). 13 vertices on each side. Edge between column, c, and value, v, if v appears in column c. Each column-vertex has 4 edges incident. Each value-vertex has 4 edges incident. 9 2 QUEEN KING

Solution to the card puzzle ACE Solution to the card puzzle Every vertex of G has degree 4. Claim: G has no Hall set. Proof by contradiction: Let S be a Hall set. 4|𝑆| edges incident to S and hence to N(S) If 𝑁 𝑆 <|𝑆| then some vertex of N(S) has degree more than 4. Hence G has a perfect matching. If perfect matching pairs column 5 to card QUEEN the pick QUEEN from this column. S 2 N(S) KING

Stable Marriages Each woman has a preference order on the 5 men. Each man has a preference order on the 5 women. A matching M is called stable if there is no unstable pair. A pair (m,w) is unstable if (m,w) are not matched to each other in M both m and w prefer each other over their partners in the matching M. W1 M2 M4 M5 M1 M3 W2 W3 W4 W5 M1 W3 W4 W2 W1 W5 M2 M3 M4 M5

Stable Marriages A pair (m,w) is unstable if both m and w prefer each other over their partners in the matching M. Is this a stable matching? Is W1-M4 unstable? NO Is W2-M3 unstable? YES! Both prefer each other over current partners. W1 M2 M4 M5 M1 M3 W2 W3 W4 W5 M1 W3 W4 W2 W1 W5 M2 M3 M4 M5

Men propose women dispose Gale-Shapley algorithm proceeds in rounds. In each round: Every man who is not matched proposes to his most preferred woman. Each woman (tentatively) accepts the most preferred man she has received a proposal from and rejects rest. Rounds continue till there is an unpaired man/woman. W1 M2 M4 M5 M1 M3 W2 W3 W4 W5 M1 W3 W4 W2 W1 W5 M2 M3 M4 M5

Men propose women dispose Gale-Shapley algorithm proceeds in rounds. In each round: Every man who is not matched proposes to his most preferred woman. Each woman (tentatively) accepts the most preferred man she has received a proposal from and rejects rest. Rounds continue till there is an unpaired man/woman. W1 M2 M4 M5 M1 M3 W2 W3 W4 W5 M1 W3 W4 W2 W1 W5 M2 M3 M4 M5

Men propose women dispose Gale-Shapley algorithm proceeds in rounds. In each round: Every man who is not matched proposes to his most preferred woman. Each woman (tentatively) accepts the most preferred man she has received a proposal from and rejects rest. Rounds continue till there is an unpaired man/woman. W1 M2 M4 M5 M1 M3 W2 W3 W4 W5 M1 W3 W4 W2 W1 W5 M2 M3 M4 M5

Men propose women dispose Gale-Shapley algorithm proceeds in rounds. In each round: Every man who is not matched proposes to his most preferred woman. Each woman (tentatively) accepts the most preferred man she has received a proposal from and rejects rest. Rounds continue till there is an unpaired man/woman. W1 M2 M4 M5 M1 M3 W2 W3 W4 W5 M1 W3 W4 W2 W1 W5 M2 M3 M4 M5

Is this any use? The Gale-Shapley algorithm always finds a stable matching. GS and variants are used for matching interns to hospitals, students to high schools, kidneys to patients… The Gale-Shapley algorithm was cited by the Nobel Prize committee, awarding the Nobel Economics Prize 2012 to Lloyd Shapley and Alvin Roth.

Google Adwords Search engines like Google, Bing, Yahoo make the bulk of their revenue by showing ads. Merchants bid for keywords related to their business. When you search for the keyword Google shows the ad(s) of the merchants who bid for this keyword. If a merchant’s ad appears he pays google the bid value. Each merchant specifies a daily budget and that is the maximum he pays google in a day.

The adwords problem 𝑛 bidders with daily budgets 𝐵 1 , 𝐵 2 ,… 𝐵 𝑛 . Queries (keyword searches) arrive online. Bidder 𝑖 is willing to pay 𝑢 𝑖𝑗 rupees if his ad is shown for query 𝑗. Algorithm has to show the ad of one of the bidders without knowing future queries. Total revenue collected from bidder 𝑖 cannot exceed 𝐵 𝑖 . Algorithm has to collect the maximum revenue

Adwords and online mathing Consider a bipartite graph with the bidders on one side and the queries on the other. When a query arrives it has to be matched to one of the bidders. The number of queries a bidder can be matched to is governed by his daily budget.

Matching in non-bipartite graphs Graph 𝐺= 𝑉,𝐸 , V is set of nodes and 𝐸⊆𝑉×𝑉 is set of edges. A matching 𝑀 is a subset of edges so that no two edges of 𝑀 have a common end-point Red edges form a matching Blue edges do not form a matching

Winning strategy for the path game A matching is perfect if all vertices are matched. If G has a perfect matching Player 2 has a winning strategy. Whatever Player 1 picks, Player 2 picks its matched partner.

Winning strategy for the path game If G does not have a perfect matching Player 1 has a winning strategy. Player 1 picks a maximum matching. It starts from an unmatched vertex. Now Player 2 has to pick a matched vertex and Player 1 can pick its partner in the matching.

Finally, the secret of the card trick Amongst the 5 cards you chose, two have to be of the same suit, say club. If the two clubs were 5C and 10C, then the assistant returns 10C to the audience. The first card the assistant shows me is 5C. So that I know the suit of the hidden card. There are 6 permutations of the remaining 3 cards. Using these the assistant generates a number from 1 to 6 which I then add to 5 to get the value of the hidden card.

What does this have to do with matchings? The assistant can convey 5×4!=120 pieces of information. Information theory says that it may be possible to work with a deck of 124 cards. This upperbound can be achieved using matchings.

Using matchings to get to the upperbound Make a bipartite graph where vertices on left are all subsets of 5 cards. Vertices on right are all possible 4 card sequences. There is an edge between two vertices if the 4 cards on the right are a subset of the 5 cards on the left. Note each vertex has degree 120 and so graph has a perfect matching. This matching tells the assistant what sequence to give when presented with a certain set of 5 cards. Ditto for magician.

Thank You