From the marriage problem to sailor assignment and Google AdWords problems. MATCHING PROBLEMS OLD AND NEW:. G. Hernandez UofM / UNAL Colombia. Based on:
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.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.
From the marriage problem to sailor assignment and Google AdWords problems
MATCHING PROBLEMS OLD AND NEW:
G. Hernandez
UofM / UNAL Colombia
Gale-Shapley Algorithm
Kuhn-Munkres Algorithm
KM extension
EMOAs, HMOAs
There are n (agents, boys, sailors, bets, …)
and n (tasks, girls, jobs, adwords, …)
We may have restrictions on the agents can
perform the particular tasks
We may have preference lists or a cost
of assigning an agent to a task, or both
Question: How do we pair, match, assign, make them correspond off in an optimal way ?
The Traditional Marriage Problem
1
2
3
Taken from http://www.cs.cmu.edu/~15251/index.html
Dating Scenario
There are n boys and n girls
Each girl has her own ranked preference list of all the boys
Each boy has his own ranked preference list of the girls
The lists have no ties
Question: How do we pair them off?
3,2,5,1,4
3,5,2,1,4
1
1
5,2,1,4,3
1,2,5,3,4
2
2
4,3,5,1,2
4,3,2,1,5
3
3
1,2,3,4,5
1,3,4,2,5
4
4
2,3,4,1,5
1,2,4,5,3
5
5
More Than One Notion of What Constitutes A “Good” Pairing
Maximizing total satisfaction
Hong Kong and to an extent the USA
Maximizing the minimum satisfaction
Western Europe
Minimizing maximum difference in mate ranks
Sweden
Maximizing people who get their first choice
Barbie and Ken Land
Rogue Couples - Instability
Suppose we pair off all the boys and girls
Now suppose that some boy and some girl prefer each other to the people to whom they are paired
They will be called a rogue couple
Why be with them when we can be with each other?
What use is fairness, if it is not stable?
Stable Pairings
A pairing of boys and girls is called stable if it contains no rogue couples
Stable Pairings
A pairing of boys and girls is called stable if it contains no rogue couples
3,2,1
3,2,1
1
1
2,1,3
1,2,3
2
2
3,1,2
3,2,1
3
3
Worshipping Males
The Traditional Marriage Algorithm
Female
String
The Traditional Marriage Algorithm
Gale-Shapley
For each day that some boy gets a “No” do:
Morning
Afternoon (for girls with at least one suitor)
Evening
If no boys get a “No”, each girl marries boy to whom she just said “maybe”
The Traditional Marriage Algorithm
3,1,2
3,2,1
1
1
2,1,3
1,2,3
2
2
3,1,2
3,2,1
3
3
The Traditional Marriage Algorithm
3,1,2
3,2,1
1
1
2,1,3
1,2,3
2
2
3,1,2
3,2,1
3
3
The Traditional Marriage Algorithm
X
3,1,2
3,2,1
1
1
2,1,3
1,2,3
2
2
3,1,2
3,2,1
3
3
The Traditional Marriage Algorithm
X
3,1,2
3,2,1
1
1
2,1,3
1,2,3
2
2
3,1,2
3,2,1
3
3
The Traditional Marriage Algorithm
X
X
3,1,2
3,2,1
1
1
2,1,3
1,2,3
2
2
3,1,2
3,2,1
3
3
The Traditional Marriage Algorithm
X
X
3,1,2
3,2,1
1
1
2,1,3
1,2,3
2
2
3,1,2
3,2,1
3
3
The Traditional Marriage Algorithm
X
X
3,1,2
3,2,1
1
1
2,1,3
1,2,3
2
2
3,1,2
3,2,1
3
3
The Traditional Marriage Algorithm
3,1,2
3,2,1
1
1
2,1,3
1,2,3
2
2
3,1,2
3,2,1
3
3
The TMA always terminates in at most n2 days.
A “master list” of all n of the boys lists starts with a total of n x n = n2girls on it
Each day that at least one boy gets a “No”, so at least one girl gets crossed off the master list
Therefore, the number of days is bounded by the original size of the master list
TMA always produces a male-optimal, female-pessimal pairing.
A boy’s optimal girl is the highest ranked girl for whom there is some stable pairing in which the boy gets her
TMA Related problems!
Current real applications of TMA!
National Resident Matching Program
http://www.nrmp.org
The National Resident Matching Program (NRMP) is a private, not-for-profit corporation established in 1952 to provide a uniform date of appointment to positions in graduate medical education (GME) in the United States.
r1,1r1,2r1,3… r1,n
r2,1r2,2r2,3… r2,n
:
rn,1rn,2 rn,3 … rn,n
Tasks
Agents
r0,0
1
1
.
.
.
.
.
.
.
n! assignments
2
2
3
3
.
.
.
.
rn,n
n
n
Complete Bipartite Graph
LAP Kuhn-Munkres Algorithm
The Kuhn- Munkers (Hungarian) algorithm is used to find an optimum (maximum or minimum weight) matching in a complete bipartite graph in time O(n3 )
Step 1: For each row of the matrix, find the smallest element and subtract it from every element in its row.
LAP Kuhn-Munkres Algorithm
Step 2: Find a zero (Z) in the resulting matrix. If there is no starred zero in its row or column, star Z. Repeat for each element in the matrix.
Step 3: Cover each column containing a starred zero. If n columns are covered, the starred zeros describe a complete set of unique assignments. In this case STOP.
LAP Kuhn-Munkres Algorithm
Step 2: Find a zero (Z) in the resulting matrix. If there is no starred zero in its row or column, star Z. Repeat for each element in the matrix.
Step 3: Cover each column containing a starred zero. If n columns are covered, the starred zeros describe a complete set of unique assignments. In this case STOP.
LAP Kuhn-Munkres Algorithm
Step 4: Find a uncovered zero and prime it. If there is no starred zero in the row containing this primed zero, Go to Step 5. Otherwise, cover this row and uncover the column containing the starred zero. Continue in this manner until there are no uncovered zeros left. Save the smallest uncovered value and Go to Step 6.
Step 5: Construct a series of alternating primed and starred zeros as follows. Let Z0 represent the uncovered primed zero found in Step 4. Let Z1 denote the starred zero in the column of Z0 (if any). Let Z2 denote the primed zero in the row of Z1 (there will always be one). Continue until the series terminates at a primed zero that has no starred zero in its column. Unstar each starred zero of the series, star each primed zero of the series, erase all primes and uncover every line in the matrix. Return to Step 3.
Step 6: Add the value found in Step 4 to every element of each covered row, and subtract it from every element of each uncovered column. Return to Step 4 without altering any stars, primes, or covered lines.
LAP Kuhn-Munkres Algorithm
Step: 4
Step: 6
Step: 4
Step: 5
Step: 3
Final Solution
Sailors
120,000/year
1,000-10,000 to be assigned every two weeks
Commanders
Jobs database
XMLDB
Four objectives
TS
PCS
SR
CR
Detailers
200
MK algorithm applied to SAP
Problems
Sailors
Jobs
1
1
2
2
3
3
4
4
5
5
6
7
dummy
Job ID
Sailor-Job Information
r0,0r0,1 … rd0 …
r1,0r1,1 … rd1 …
: :
rn,0rn, 1 … … rdn
r0,0r0,1 …
r1,0r1,1 …
:
rn,0rn, 1 …
…
k
2
1
….
r1,k
r1,2
r1,1
….
….
1
Sailor Array
(List)
2
FTS1,1
3
FPCS1,1
Reduced rating
.
FSR1,1
.
Weight vectors
FCR1,1
.
n
Dummy jobs
Sparse Matrix representation
After adding dummy jobs in the matrix
RESULTS
KM(287)
NSGAII
NGSA(300)-KM (5)
Web
QUERY
Paid for each “impression”
links!
Pais when someone clicks on
Advertisers
The Adwords Problem
N advertisers;
Search Engine
N advertisers;
Search Engine
queries
(online)
N advertisers;
Search Engine
Select one Ad
Advertiser
pays his bid
queries
(online)
N advertisers;
Search Engine
Select one Ad
Advertiser
pays his bid
queries
(online)
Maximize total revenue
Online competitive analysis - compare with best offline allocation
N advertisers;
Search Engine
Select one Ad
Advertiser
pays his bid
queries
(online)
Maximize total revenue
Example – Assign to highest bidder: only ½ the offline revenue
Algorithm Greedy
Bidder 1 Bidder 2
Bidder1
Bidder 2
Book
Queries: 100 Books then 100 CDs
CD
B1 = B2 = $100
LOST
Revenue
100$
Optimal Allocation
Bidder 1 Bidder 2
Bidder1
Bidder 2
Book
Queries: 100 Books then 100 CDs
CD
B1 = B2 = $100
Revenue
199$
each bid is $0/1.
queries
(girls)
advertisers
(boys)
queries
(girls)
advertisers
(boys)
queries
(girls)
advertisers
(boys)
queries
(girls)
advertisers
(boys)
queries
(girls)
advertisers
(boys)
queries
(girls)
advertisers
(boys)
queries
(girls)
advertisers
(boys)
Online optimal (1-1/e =0.63)n matching .
Online bipartite matching
1 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0
0 1 0 0 0 0 0 0 0 1 0 0 0 0 0 0
0 0 1 0 0 0 0 0 0 0 1 0 0 0 0 0
1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0
queries
(girls)
advertisers
(boys)
n/2
:
:
n/2
:
:
queries
(girls)
advertisers
(boys)
n/2
:
:
n/2
:
:
advertisers
(boys)
queries
(girls)
n/2
:
:
:
:
Expected number of pairs n (1-1/e) + o(n)
Optimal.
On-line deterministic algorithm:
1-1/e factor algorithm for b-matching:
Daily budgets $b, bids $0/1, b>>1
advertiser who has the highest unspent budget.
1-1/e algorithm, assuming
budgets>>bids.
bids = 0, 1 or 2.
1-1/e algorithm, assuming budgets>>bids.
Optimal!
fraction of left-over budget
fraction of left-over budget
tradeoff-revealing family of LP’s
The optimal tradeoff function is:
ψ(x) = 1 – e -x
The algorithm assumes that the daily budget of advertisers is large compared to their bids.
Where d is the bid and n is the total number of advertisers and rank is the advertiser’s rank in the permutation
d*ψ(rank / n)
Google, then, will maximize its profits if it allocates queries to the advertiser with the highest value of d*ψ(f), where d is the bid and f is rank of the fraction of the budget that has not yet been spent.
market equilibrium
Algorithmic Game Theory
for traditional market models