92
Matching and Market Design: Introduction, Bipartite Matching NICOLE IMMORLICA, MICROSOFT RESEARCH NE

Matching and Market Design: Introduction, Bipartite Matching

Embed Size (px)

DESCRIPTION

Matching and Market Design: Introduction, Bipartite Matching. Nicole Immorlica, Microsoft Research NE. Nicole Immorlica, MSR NE Researcher. Background . Computer science, economics, applied research. Ph.D. 2005 (in computer science). Thesis: Computing with Strategic Agents. - PowerPoint PPT Presentation

Citation preview

Page 1: Matching and Market Design: Introduction, Bipartite Matching

Matching and Market Design:Introduction, Bipartite Matching

NICOLE IMMORLICA, MICROSOFT RESEARCH NE

Page 2: Matching and Market Design: Introduction, Bipartite Matching

Background. Computer science, economics, applied research.

NICOLE IMMORLICA, MSR NE RESEARCHER

Ph.D. 2005 (in computer science). Thesis: Computing with Strategic Agents.

Postdocs 2005-2008. Studied applications of:theory to advertising markets at MSR, combinatorics to economics at CWI.

Professor 2008-2012 (of computer science). Taught courses and advised students in CS-econ.

Researcher 2012-present. Study CS-econ issues from the very theoretical to the very applied.

Page 3: Matching and Market Design: Introduction, Bipartite Matching

Research. What are realistic utopias for selfish societies?

NICOLE IMMORLICA, MSR NE RESEARCHER

Mechanism Design: Can we systematically allocate scare resources to people who need it the most?Or sell the resources and generate high revenue? sim

plicity

Social Networks: What behavioral patterns can besupported by various structures? What information can be learned? How does behavior impact structure?diversi

ty

Market Design: What outcomes will be observedin matching markets, and how can we facilitatethe matching process in practical settings? partial

information

Page 4: Matching and Market Design: Introduction, Bipartite Matching

COURSE LOGISTICS

Course. CS 286r: Topics at the Interface of Computer Science and Economics – Matching and Market Design.

Website. www.Immorlica.com/marketDesign/Harvard

Lectures. Fridays, 9am-noon, MD 221.Includes a 20 minute coffee break halfway through, and you’re all invited to join me for lunch afterwards.

Teachers. Nicole Immorlica, Ran Shorrer, Brendan Lucier, Scott Kominers, and more!

Workload. Readings/participation (around 20 pages/week), 2 problem sets (around 6 hrs each), course project (3 stages).

Page 5: Matching and Market Design: Introduction, Bipartite Matching

Outline

1. Introduction: markets in practice and theory, discussion of market design

2. Bipartite Matching: elementary definitions, max cardinality & max weight matchings

Page 6: Matching and Market Design: Introduction, Bipartite Matching

Part 1:Introduction.

Page 7: Matching and Market Design: Introduction, Bipartite Matching

Markets are a medium of exchange.

Markets

agents objects

Page 8: Matching and Market Design: Introduction, Bipartite Matching

Markets

firms

workers

agents objects

Labor MarketsSchool Choice

students

high schools

Sponsored Search

advertisers

ad slots

Kidney Exchange

patients

kidneys

Page 9: Matching and Market Design: Introduction, Bipartite Matching

Traditional markets: shopping malls, eBay, ad auctions, FCC spectrum auctions

Examples

School choice: allocation of students to schools via centralized city-run program

Labor markets: NRMP, cadet-branch matching

Kidney exchange: matching of kidney donors to compatible recipients

Page 10: Matching and Market Design: Introduction, Bipartite Matching

Al Roth

Market Design

Page 11: Matching and Market Design: Introduction, Bipartite Matching

Market design involves a responsibility for detail, a need to deal with all of a market’s complications, not just its principle features. Designers therefore cannot work only with the simple conceptual models used for theoretical insights into the general working of markets. Instead, market design calls for an engineering approach.

– from The Economist as an Engineer, by Al Roth

Market Design

Page 12: Matching and Market Design: Introduction, Bipartite Matching

…this paper makes the case that experimental and computational economics are natural complements to game theory in the work of design. The paper also argues that some of the challenges facing both markets involve dealing with related kinds of complementarities, and that this suggests an agenda for future theoretical research.

– from The Economist as an Engineer, by Al Roth

Market Design

Page 13: Matching and Market Design: Introduction, Bipartite Matching

Develop simple theory,…to deal with complexity in practice.

Market Design

Page 14: Matching and Market Design: Introduction, Bipartite Matching

Computer Science&

Economics

Page 15: Matching and Market Design: Introduction, Bipartite Matching

On Spherical Cows …

Page 16: Matching and Market Design: Introduction, Bipartite Matching

Computer Science: computability

NP: set of problems whose solutions can be checked efficiently.

P: set of problems that can be solved efficiently (i.e., in polynomial time).

P versus NP

Page 17: Matching and Market Design: Introduction, Bipartite Matching

Computer Science: computability3 6 8

1 2

9

4

3 2 7

8 5

9

4 5

8 9

Page 18: Matching and Market Design: Introduction, Bipartite Matching

Computer Science: computability7 5 1 9 3 2 6 4 8

3 8 4 1 5 6 9 7 2

9 2 6 4 7 8 1 3 5

6 9 7 2 4 1 5 8 3

5 3 2 6 8 7 4 1 9

1 4 8 3 9 5 7 2 6

8 1 3 5 6 4 2 9 7

4 6 9 7 2 3 8 5 1

2 7 5 8 1 9 3 6 4

Page 19: Matching and Market Design: Introduction, Bipartite Matching

Computer Science: computability

Traveling Salesman: find smallest route that visits each capitol.

Page 20: Matching and Market Design: Introduction, Bipartite Matching

Computer Science: computabilityStudent social network:

Study groups of size two? Size three?

Page 21: Matching and Market Design: Introduction, Bipartite Matching

Economics: rationality

Many systems are composed of many independent self-interested agents

These agents are • rational, i.e. they act in their own self-interest• and reason strategically, i.e. they take into

account the actions of others

Page 22: Matching and Market Design: Introduction, Bipartite Matching

Let’s play a game

Experiment: The median game.

1. Guess an integer in [1, …, 100].2. Write your number on a piece of paper.

P R I Z E : The people whose numbers are closest to 2/3 of the median win.

Page 23: Matching and Market Design: Introduction, Bipartite Matching

The Median Game

Jose Julian Bruce Marcos Nicole

25 45 0 50 69

Calculating the winner:1. Sort the numbers: 0, 25, 45, 50, 692. Pick the middle one (the median): 453. Compute 2/3 of the median: 30

winner!

Page 24: Matching and Market Design: Introduction, Bipartite Matching

Are you a winner?

Page 25: Matching and Market Design: Introduction, Bipartite Matching

Questions

Given computability & rationality assumptions:• How will selfish agents behave?• What properties emerge as a result of selfish

behavior?• Is it possible to formulate the rules of the

system to encourage socially-optimal behavior?

Page 26: Matching and Market Design: Introduction, Bipartite Matching

Develop simple theory,…to deal with complexity in practice.

Market Design

Page 27: Matching and Market Design: Introduction, Bipartite Matching

Thickness: need to attract a sufficient proportion of potential market participants to come together ready to transact with one another.

Market Design Complexities

– from What have we learned from market design?, by Al Roth

Page 28: Matching and Market Design: Introduction, Bipartite Matching

Congestion: must provide enough time or fast enough transactions so that market participants can consider enough alternatives to arrive at satisfactory ones.

Market Design Complexities

– from What have we learned from market design?, by Al Roth

Page 29: Matching and Market Design: Introduction, Bipartite Matching

Simplicity: must make it easy to participate in market as opposed to transacting outside of the marketplace or engaging in strategic behavior that reduces overall welfare.

Market Design Complexities

– from What have we learned from market design?, by Al Roth

Page 30: Matching and Market Design: Introduction, Bipartite Matching

Others:• Asset to be traded• Nature of contracts• Medium of exchange• Measure of performance• Need for design• Market culture• Fairness and repugnance

Market Design Complexities

– from 1/22/14 post on The Leisure of the Theory Class, by Ricky Vohra

Page 31: Matching and Market Design: Introduction, Bipartite Matching

Example: traditional markets

FCC spectrum auctions, eBay, ad auctions etc.: sellers offer goods and services, buyers purchase via posted prices or auctions

Practice:

Page 32: Matching and Market Design: Introduction, Bipartite Matching

Example: traditional markets

Strategic behavior, complex agent preferences, price discovery, packages and deals

Issues:

Page 33: Matching and Market Design: Introduction, Bipartite Matching

Example: traditional markets

Existence of market-clearing prices, approximately optimal simple mechanisms, techniques to aid price discovery

Theory:

Page 34: Matching and Market Design: Introduction, Bipartite Matching

Example: school choice

Boston, New York City, etc:students submit preferences about different schools; matched based on “priorities” (e.g., test scores, geography, sibling matches)

Practice:

Page 35: Matching and Market Design: Introduction, Bipartite Matching

Example: school choice

NYC too slow to clear; Boston strategically complicated, result in unstable matches, many complaints in school boards

Issues:

Page 36: Matching and Market Design: Introduction, Bipartite Matching

Example: school choice

theorists proposed alternate mechanisms including the Gale-Shapley algorithm for stable marriage, schools adopt these

Theory:

Page 37: Matching and Market Design: Introduction, Bipartite Matching

Example: entry-level labor markets

National Residency Matching Program (NRMP): physicians look for residency programs at hospitals in the United States

Practice:

Page 38: Matching and Market Design: Introduction, Bipartite Matching

Example: entry-level labor markets

1950 1990

decentralized, unraveling,

exploding offers inefficiencies

centralized clearinghouse, 95% voluntary participation

dropping participation sparks redesign to

accommodate couples, system still in use

Issues:

Page 39: Matching and Market Design: Introduction, Bipartite Matching

Example: entry-level labor markets

NRMP central clearinghouse algorithm corresponds to Gale-Shapley algorithm

Theory:

Page 40: Matching and Market Design: Introduction, Bipartite Matching

Example: kidney exchange

In 2005:• 75,000 patients waiting for transplants• 16,370 transplants performed (9,800 from

deceased donors, 6,570 from living donors)• 4,200 patients died while waiting

Practice:

Page 41: Matching and Market Design: Introduction, Bipartite Matching

Example: kidney exchange

Source and allocation of kidneys:• cadaver kidneys: centralized matching

mechanism based on priority queue• living donors: patient must identify donor,

needs to be compatible• other: angel donors, black market sales

Issues:

Page 42: Matching and Market Design: Introduction, Bipartite Matching

Example: kidney exchange

living donor exchanges:

Theory:

patient 1 donor 1

patient 2 donor 2

Page 43: Matching and Market Design: Introduction, Bipartite Matching

Example: kidney exchange

living donor exchanges:adopted mechanism uses top-trading cycles, theory of maximum matching, results in improved welfare (many more transplants)

Theory:

Page 44: Matching and Market Design: Introduction, Bipartite Matching

Part 2:Bipartite Matching.

Page 45: Matching and Market Design: Introduction, Bipartite Matching

MatchingBoys Girls

Questions. 1) What’s the most # of agents we can accommodate?2) How can we find this allocation?

Page 46: Matching and Market Design: Introduction, Bipartite Matching

Matching

Boys Girls

left vertices right vertices

edges

Bipartite Graph:

Page 47: Matching and Market Design: Introduction, Bipartite Matching

Matching

left vertices

right vertices

edges

Bipartite Graph:

10

Page 48: Matching and Market Design: Introduction, Bipartite Matching

Matching

matching = a set of edges that share no vertices.

Page 49: Matching and Market Design: Introduction, Bipartite Matching

Matching

How to find a maximum matching?Idea: add edges until we can’t anymore.

maximal

Page 50: Matching and Market Design: Introduction, Bipartite Matching

Matching

How to find a maximum matching?Idea: add edges until we can’t anymore.Not maximum, but close!

maximal maximum

Page 51: Matching and Market Design: Introduction, Bipartite Matching

Matching

Defn. A soln. S to a maximization problem is an α-approximation if its value is at least an α fraction of the optimal value.Thm. Maximal matching (½)-approximates maximum matching.

maximal maximum

Page 52: Matching and Market Design: Introduction, Bipartite Matching

Matching

How to find a maximum matching?Idea: add edges until we can’t anymore, allowing people to push each other out.

Page 53: Matching and Market Design: Introduction, Bipartite Matching

Matching

augmenting path = path between exposed vertices

Theorem. Matching is maximum iff no augmenting paths.

Page 54: Matching and Market Design: Introduction, Bipartite Matching

Matching

matching = a set of edges that share no vertices.vertex cover = a set of vertices such that each edge is incident to at least one vertex in the set.

Page 55: Matching and Market Design: Introduction, Bipartite Matching

Matching

Theorem. Maximum matching equals minimum vertex cover.

Page 56: Matching and Market Design: Introduction, Bipartite Matching

Matching

Theorem. Maximum matching equals minimum vertex cover (bipartite graphs).

Proof. Matching = M, cover = C.1. |M| ≤ |C|.

Page 57: Matching and Market Design: Introduction, Bipartite Matching

Matching

Theorem. Maximum matching equals minimum vertex cover (bipartite graphs).

Proof. Matching = M, cover = C.2. |max M| ≥ |min C| (constructive).

Page 58: Matching and Market Design: Introduction, Bipartite Matching

Matching

Theorem. Maximum matching equals minimum vertex cover (bipartite graphs).

Proof. Matching = M, cover = C.2. |max M| ≥ |min C| (constructive).

augmenting path = path between exposed vertices

Page 59: Matching and Market Design: Introduction, Bipartite Matching

Matching

Theorem. Maximum matching equals minimum vertex cover (bipartite graphs).

Proof. Matching = M, cover = C.2. |max M| ≥ |min C| (constructive).

Key. vertices reachable from left-side exposed vertices.proposed vertex cover.

Page 60: Matching and Market Design: Introduction, Bipartite Matching

Matching

Theorem. Maximum matching equals minimum vertex cover.Question. When can we match everyone?

Page 61: Matching and Market Design: Introduction, Bipartite Matching

Perfect Matching

Defn. A matching is perfect if every vertex is matched.Question. When can we match everyone?

Page 62: Matching and Market Design: Introduction, Bipartite Matching

Hall’s Marriage Theorem

Thm. A perfect matching exists if and only if every set of girlslikes at least as large a set of boys.

Defn. A matching is perfect if every vertex is matched.

Boys Girls

Page 63: Matching and Market Design: Introduction, Bipartite Matching

Hall’s Marriage Theorem

Condition. Every set of girls likes at least as large a set of boys.

Boys Girls

Girls not in Cover

Prf. |Cover| = |Boys in Cover| + |Girls in Cover|≥ |Girls not in Cover| + |Girls in Cover|= |Girls|

and Girls is a cover, so |min Cover| ≤ |Girls|.

Boys in Cover

Page 64: Matching and Market Design: Introduction, Bipartite Matching

Matching in Random Graphs

Agents Items

Theorem. If each agent likes at least 2log n items, then with good probability there is a way to assign everyone an item they like.

Page 65: Matching and Market Design: Introduction, Bipartite Matching

Matching in Random Graphs

Theorem. If each agent likes at least 2ln(n) items, then with good probability there is a way to assign everyone an item they like.

Intuition. Deferred randomness.1) Pr[ unique choice in market of size k ] = (1 – 1/k)k-1 ≥ 1/32) Constant fraction of market clears in each step.3) Entire market clears in about log n steps.

Page 66: Matching and Market Design: Introduction, Bipartite Matching

Matching in Random Graphs

Theorem. If each agent likes k < ½ ln(n) items, then with good probability someone is unassigned.

Intuition. Some item is liked by nobody.

E[ # unliked items] = n Pr[ item is unliked ]∙= n (1 – 1/n)∙ nk

= n e∙ -k

> n n∙ -½ > 1

for k < ½ ln(n).

Page 67: Matching and Market Design: Introduction, Bipartite Matching

Weighted Matching

Questions. 1) What’s the most value we can create?2) How can we find this allocation?

Agents Items$4

$8

$6

Page 68: Matching and Market Design: Introduction, Bipartite Matching

Weighted MatchingAgents Items

$4

$8

$6

Agents Items

WLOG, assume complete bipartite graph.Look for max-weight matching .

Page 69: Matching and Market Design: Introduction, Bipartite Matching

2

Primal-Dual ApproachL R

23

1

3

2

1

21

“dual” variable y maps vertices to numbers such that for every edge e = (u,v), w(e) ≤ y(u) + y(v) (y non-negative).

3

3

3

3

0

0

0

0

“budgets” y(.) “prices” y(.)

“value” or“weight” w(.)

Page 70: Matching and Market Design: Introduction, Bipartite Matching

Primal-Dual ApproachL R

1

3

21

w(e) ≤ y(u) + y(v) implies ∑e in M w(e) ≤ ∑e in LUR y(v)

3

3

3

3

0

0

0

0

“budgets” y(.) “prices” y(.)

“weight” w(.)

2

1

2

32

Page 71: Matching and Market Design: Introduction, Bipartite Matching

2

Primal-Dual ApproachL R

23

1

3

2

1

21

Feasible Dual: for every M, y(.), ∑e in M w(e) ≤ ∑e in LUR y(v)

3

3

3

3

0

0

0

0

“budgets” y(.) “prices” y(.)

“weight” w(.)

Certificate of Optimality: find M, y(.) s.t. this holds with equality

Page 72: Matching and Market Design: Introduction, Bipartite Matching

Hungarian Algorithm

Algorithm maintains invariants1) Feasibility of dual: w(e) ≤ y(u) + y(v) 2) Tightness: if e=(u,v) is in M, then w(e) = y(u) + y(v)

Algorithm:Initialize y(v) = max weight for v in L; y(v) for v in R = 0; M = {.}.Repeat: 1) Augment matching: if there’s an augmenting path in

subgraph of tight edges, use it to augment matching M.2) Dual adjustment: if M is not perfect, adjust dual variable y(.)

to make more edges tight.Until M is maximum or duals reach zero.

Page 73: Matching and Market Design: Introduction, Bipartite Matching

Augmentation Step

L R

3

2

Find augmenting paths in subgraph of tight edges.

4

5

3

1

2

0

4

3

56

5

matching edge

new matching edges

Page 74: Matching and Market Design: Introduction, Bipartite Matching

Dual Adjustment StepL R

3

2

Update dual variables to make more tight edges:1) Orient matching edges right-to-left, tight edges left-to-right.2) Find set Z of vertices reachable from exposed vertices of L.3) Decrease dual of v in L ∩ Z; increase dual of v in R ∩ Z until

an edge goes tight.

4

5

3

1

2

0

4

3matching edges

tight edges

56

53

Page 75: Matching and Market Design: Introduction, Bipartite Matching

Dual Adjustment Step

matching edgestight edges

L R

1

11

1

2

3

2

1

0

0

0

23

32

22

Page 76: Matching and Market Design: Introduction, Bipartite Matching

Dual Adjustment Step

matching edgestight edges

L R

1

11

1

2

3

2

1

0

0

0

23

32

22

0

1

2

2

1

Page 77: Matching and Market Design: Introduction, Bipartite Matching

Dual Adjustment Step

matching edgestight edges

L R

1

11

0

1

2

2

2

1

0

0

23

32

2

2

Page 78: Matching and Market Design: Introduction, Bipartite Matching

CorrectnessAlgorithm maintains invariants1) Tight: w(e) = y(u) + y(v), for e in M

matching edges can’t cross in or out of red set.

2) Dual feasibility: w(e) ≤ y(u) + y(v) edges that cross from inside red set to outside it cannot be tight.

L R

-Δ +Δ

matching edgestight edges

reachable from exposed vertices

Page 79: Matching and Market Design: Introduction, Bipartite Matching

OptimalityUncovered vertices all have zero dualsat end of algorithm:1) Once a vertex is covered, it

remains so throughout algorithm.2) So uncovered left-vertices have

duals that decrease at same rate and reach zero simultaneously

3) And uncovered right-vertices have zero duals initially, never change.

Thus, by tightness invariant, weight of matching equals dual value and so it must be optimal.

L R

-Δ +Δ

Page 80: Matching and Market Design: Introduction, Bipartite Matching

Example

matching edgestight edges

L R

1

1

3

3

3

3

0

0

0

0

2

3

3

2

22

1

Page 81: Matching and Market Design: Introduction, Bipartite Matching

Example

matching edgestight edges

L R

1

1

3

3

3

3

0

0

0

0

2

3

3

2

22

1

Page 82: Matching and Market Design: Introduction, Bipartite Matching

Example

matching edgestight edges

L R

1

1

3

3

3

3

0

0

0

0

2

3

3

2

22

1

Page 83: Matching and Market Design: Introduction, Bipartite Matching

Example

matching edgestight edges

L R

1

1

3

3

3

3

0

0

0

0

2

3

3

2

22

1

2

2

Page 84: Matching and Market Design: Introduction, Bipartite Matching

Example

matching edgestight edges

L R

1

1

3

3

3

3

0

0

0

0

2

3

3

2

22

1

2

2

Page 85: Matching and Market Design: Introduction, Bipartite Matching

Example

matching edgestight edges

L R

1

1

3

3

3

3

0

0

0

0

2

3

3

2

22

1

2

2

Page 86: Matching and Market Design: Introduction, Bipartite Matching

Example

matching edgestight edges

L R

1

1

3

3

3

3

0

0

0

0

2

3

3

2

22

1

2

2

11

2

Page 87: Matching and Market Design: Introduction, Bipartite Matching

Example

matching edgestight edges

L R

1

1

3

3

3

3

0

0

0

0

2

3

3

2

22

1

2

2

11

2

Page 88: Matching and Market Design: Introduction, Bipartite Matching

Example

matching edgestight edges

L R

1

1

3

3

3

3

0

0

0

0

2

3

3

2

22

1

2

2

11

2

0 2

11

2

Page 89: Matching and Market Design: Introduction, Bipartite Matching

Example

matching edgestight edges

L R

1

1

2

3

3

2

22

1

3

3

3

3

0

0

0

0

2

2

11

2

0 2

11

2

Page 90: Matching and Market Design: Introduction, Bipartite Matching

Example

matching edgestight edges

L R

1

1

2

3

3

2

22

1

0

0

0

0

1 2

1

3

2

1

3

3

3

3

2

2

1

2

0

1

2

-1

0

1

1

Page 91: Matching and Market Design: Introduction, Bipartite Matching

Example

matching edgestight edges

L R

1

1

2

3

3

2

22

1

3

3

3

3

2

2

1

2

0

1

2

-1

0

1

1

0

0

0

0

1 2

1

3

2

1

Page 92: Matching and Market Design: Introduction, Bipartite Matching

Example

matching edgestight edges

L R

1

1

3

3

3

3

0

0

0

0

2

3

3

2

22

1

2

2

11

2

0 2

11

2

-1 3

20

11

1