SlideShare una empresa de Scribd logo
1 de 30
Descargar para leer sin conexión
Iris Hui-Ru Jiang Fall 2014
CHAPTER 1
INTRODUCTION
IRIS H.-R. JIANG
Outline
¨ Content:
¤ Opening: stable matching
¤ Five representative problems
¨ Reading:
¤ Chapter 1
Opening
2
Opening topic
Stable Matching
3
Opening
IRIS H.-R. JIANG
Opening
¨ We start from an algorithmic problem that illustrates many of
the themes we will be emphasizing.
1. It is motivated by some very natural and practical concerns.
2. From these, we formulate a clean and simple statement of a
problem.
3. The algorithm to solve the problem is very clean as well.
4. Most of our work will be spent in proving that it is correct and
giving an acceptable bound on the amount of time it takes to
terminate with an answer.
Opening
4
Iris Hui-Ru Jiang Fall 2014
CHAPTER 1
INTRODUCTION
IRIS H.-R. JIANG
Outline
¨ Content:
¤ Opening: stable matching
¤ Five representative problems
¨ Reading:
¤ Chapter 1
Opening
2
Opening topic
Stable Matching
3
Opening
IRIS H.-R. JIANG
Opening
¨ We start from an algorithmic problem that illustrates many of
the themes we will be emphasizing.
1. It is motivated by some very natural and practical concerns.
2. From these, we formulate a clean and simple statement of a
problem.
3. The algorithm to solve the problem is very clean as well.
4. Most of our work will be spent in proving that it is correct and
giving an acceptable bound on the amount of time it takes to
terminate with an answer.
Opening
4
Iris Hui-Ru Jiang Fall 2014
CHAPTER 1
INTRODUCTION
IRIS H.-R. JIANG
Outline
¨ Content:
¤ Opening: stable matching
¤ Five representative problems
¨ Reading:
¤ Chapter 1
Opening
2
Opening topic
Stable Matching
3
Opening
IRIS H.-R. JIANG
Opening
¨ We start from an algorithmic problem that illustrates many of
the themes we will be emphasizing.
1. It is motivated by some very natural and practical concerns.
2. From these, we formulate a clean and simple statement of a
problem.
3. The algorithm to solve the problem is very clean as well.
4. Most of our work will be spent in proving that it is correct and
giving an acceptable bound on the amount of time it takes to
terminate with an answer.
Opening
4
Iris Hui-Ru Jiang Fall 2014
CHAPTER 1
INTRODUCTION
IRIS H.-R. JIANG
Outline
¨ Content:
¤ Opening: stable matching
¤ Five representative problems
¨ Reading:
¤ Chapter 1
Opening
2
Opening topic
Stable Matching
3
Opening
IRIS H.-R. JIANG
Opening
¨ We start from an algorithmic problem that illustrates many of
the themes we will be emphasizing.
1. It is motivated by some very natural and practical concerns.
2. From these, we formulate a clean and simple statement of a
problem.
3. The algorithm to solve the problem is very clean as well.
4. Most of our work will be spent in proving that it is correct and
giving an acceptable bound on the amount of time it takes to
terminate with an answer.
Opening
4
IRIS H.-R. JIANG
If You Are a Matchmaker…
¨ Imagine you are a matchmaker
¤ One hundred female clients, and one hundred male clients
¤ Each woman has given you a complete list of the hundred men,
ordered by her preference: first choice, second choice, and so on
¤ Each man has given you a list of the women, ranked analogously
¤ Your job is to arrange one hundred happy marriages
n Neither singlehood nor polygamy
n Happy and stable (You don’t want them to divorce or to
develop outside relationships
Opening
5
IRIS H.-R. JIANG
The Stable Matching Problem
¨ Given n men and n women, find a suitable matching
¤ Participants rank members of opposite gender
¤ Each man lists women in order of preference from best to worst
¤ Each woman lists men in order of preference from best to worst
Opening
6
favorite least favorite
1st 2nd 3rd
Amy
Bertha
Clare
Yancey
Xavier
Xavier
Xavier
Yancey
Yancey
Zeus
Zeus
Zeus
Women’s Preference Profile
favorite least favorite
1st 2nd 3rd
Xavier
Yancey
Zeus
Amy
Bertha
Amy
Bertha
Amy
Bertha
Clare
Clare
Clare
Men’s Preference Profile
IRIS H.-R. JIANG
Example (1/2)
¨ Try this way…
¤ Z-A, Y-B, X-C
¨ Q: Is assignment X-C, Y-B, Z-A stable?
¨ A:
Opening
7
favorite least favorite
1st 2nd 3rd
Xavier
Yancey
Zeus
Amy
Bertha
Amy
Bertha
Amy
Bertha
Clare
Clare
Clare
Men’s Preference Profile
favorite least favorite
1st 2nd 3rd
Amy
Bertha
Clare
Yancey
Xavier
Xavier
Xavier
Yancey
Yancey
Zeus
Zeus
Zeus
Women’s Preference Profile
Bertha
Amy
Clare
Xavier
Yancey
Zeus
IRIS H.-R. JIANG
Example (2/2)
¨ Q: Is assignment X-C, Y-B, Z-A stable?
¨ A: No. Bertha and Xavier will hook up.
¨ Q: What has gone wrong?
¨ A: The process is not self-enforcing.
Opening
8
favorite least favorite
1st 2nd 3rd
Xavier
Yancey
Zeus
Amy
Bertha
Amy
Bertha
Amy
Bertha
Clare
Clare
Clare
Men’s Preference Profile
favorite least favorite
1st 2nd 3rd
Amy
Bertha
Clare
Yancey
Xavier
Xavier
Xavier
Yancey
Yancey
Zeus
Zeus
Zeus
Women’s Preference Profile
Bertha
Xavier
IRIS H.-R. JIANG
If You Are a Matchmaker…
¨ Imagine you are a matchmaker
¤ One hundred female clients, and one hundred male clients
¤ Each woman has given you a complete list of the hundred men,
ordered by her preference: first choice, second choice, and so on
¤ Each man has given you a list of the women, ranked analogously
¤ Your job is to arrange one hundred happy marriages
n Neither singlehood nor polygamy
n Happy and stable (You don’t want them to divorce or to
develop outside relationships
Opening
5
IRIS H.-R. JIANG
The Stable Matching Problem
¨ Given n men and n women, find a suitable matching
¤ Participants rank members of opposite gender
¤ Each man lists women in order of preference from best to worst
¤ Each woman lists men in order of preference from best to worst
Opening
6
favorite least favorite
1st 2nd 3rd
Amy
Bertha
Clare
Yancey
Xavier
Xavier
Xavier
Yancey
Yancey
Zeus
Zeus
Zeus
Women’s Preference Profile
favorite least favorite
1st 2nd 3rd
Xavier
Yancey
Zeus
Amy
Bertha
Amy
Bertha
Amy
Bertha
Clare
Clare
Clare
Men’s Preference Profile
IRIS H.-R. JIANG
Example (1/2)
¨ Try this way…
¤ Z-A, Y-B, X-C
¨ Q: Is assignment X-C, Y-B, Z-A stable?
¨ A:
Opening
7
favorite least favorite
1st 2nd 3rd
Xavier
Yancey
Zeus
Amy
Bertha
Amy
Bertha
Amy
Bertha
Clare
Clare
Clare
Men’s Preference Profile
favorite least favorite
1st 2nd 3rd
Amy
Bertha
Clare
Yancey
Xavier
Xavier
Xavier
Yancey
Yancey
Zeus
Zeus
Zeus
Women’s Preference Profile
Bertha
Amy
Clare
Xavier
Yancey
Zeus
IRIS H.-R. JIANG
Example (2/2)
¨ Q: Is assignment X-C, Y-B, Z-A stable?
¨ A: No. Bertha and Xavier will hook up.
¨ Q: What has gone wrong?
¨ A: The process is not self-enforcing.
Opening
8
favorite least favorite
1st 2nd 3rd
Xavier
Yancey
Zeus
Amy
Bertha
Amy
Bertha
Amy
Bertha
Clare
Clare
Clare
Men’s Preference Profile
favorite least favorite
1st 2nd 3rd
Amy
Bertha
Clare
Yancey
Xavier
Xavier
Xavier
Yancey
Yancey
Zeus
Zeus
Zeus
Women’s Preference Profile
Bertha
Xavier
IRIS H.-R. JIANG
If You Are a Matchmaker…
¨ Imagine you are a matchmaker
¤ One hundred female clients, and one hundred male clients
¤ Each woman has given you a complete list of the hundred men,
ordered by her preference: first choice, second choice, and so on
¤ Each man has given you a list of the women, ranked analogously
¤ Your job is to arrange one hundred happy marriages
n Neither singlehood nor polygamy
n Happy and stable (You don’t want them to divorce or to
develop outside relationships
Opening
5
IRIS H.-R. JIANG
The Stable Matching Problem
¨ Given n men and n women, find a suitable matching
¤ Participants rank members of opposite gender
¤ Each man lists women in order of preference from best to worst
¤ Each woman lists men in order of preference from best to worst
Opening
6
favorite least favorite
1st 2nd 3rd
Amy
Bertha
Clare
Yancey
Xavier
Xavier
Xavier
Yancey
Yancey
Zeus
Zeus
Zeus
Women’s Preference Profile
favorite least favorite
1st 2nd 3rd
Xavier
Yancey
Zeus
Amy
Bertha
Amy
Bertha
Amy
Bertha
Clare
Clare
Clare
Men’s Preference Profile
IRIS H.-R. JIANG
Example (1/2)
¨ Try this way…
¤ Z-A, Y-B, X-C
¨ Q: Is assignment X-C, Y-B, Z-A stable?
¨ A:
Opening
7
favorite least favorite
1st 2nd 3rd
Xavier
Yancey
Zeus
Amy
Bertha
Amy
Bertha
Amy
Bertha
Clare
Clare
Clare
Men’s Preference Profile
favorite least favorite
1st 2nd 3rd
Amy
Bertha
Clare
Yancey
Xavier
Xavier
Xavier
Yancey
Yancey
Zeus
Zeus
Zeus
Women’s Preference Profile
Bertha
Amy
Clare
Xavier
Yancey
Zeus
IRIS H.-R. JIANG
Example (2/2)
¨ Q: Is assignment X-C, Y-B, Z-A stable?
¨ A: No. Bertha and Xavier will hook up.
¨ Q: What has gone wrong?
¨ A: The process is not self-enforcing.
Opening
8
favorite least favorite
1st 2nd 3rd
Xavier
Yancey
Zeus
Amy
Bertha
Amy
Bertha
Amy
Bertha
Clare
Clare
Clare
Men’s Preference Profile
favorite least favorite
1st 2nd 3rd
Amy
Bertha
Clare
Yancey
Xavier
Xavier
Xavier
Yancey
Yancey
Zeus
Zeus
Zeus
Women’s Preference Profile
Bertha
Xavier
IRIS H.-R. JIANG
If You Are a Matchmaker…
¨ Imagine you are a matchmaker
¤ One hundred female clients, and one hundred male clients
¤ Each woman has given you a complete list of the hundred men,
ordered by her preference: first choice, second choice, and so on
¤ Each man has given you a list of the women, ranked analogously
¤ Your job is to arrange one hundred happy marriages
n Neither singlehood nor polygamy
n Happy and stable (You don’t want them to divorce or to
develop outside relationships
Opening
5
IRIS H.-R. JIANG
The Stable Matching Problem
¨ Given n men and n women, find a suitable matching
¤ Participants rank members of opposite gender
¤ Each man lists women in order of preference from best to worst
¤ Each woman lists men in order of preference from best to worst
Opening
6
favorite least favorite
1st 2nd 3rd
Amy
Bertha
Clare
Yancey
Xavier
Xavier
Xavier
Yancey
Yancey
Zeus
Zeus
Zeus
Women’s Preference Profile
favorite least favorite
1st 2nd 3rd
Xavier
Yancey
Zeus
Amy
Bertha
Amy
Bertha
Amy
Bertha
Clare
Clare
Clare
Men’s Preference Profile
IRIS H.-R. JIANG
Example (1/2)
¨ Try this way…
¤ Z-A, Y-B, X-C
¨ Q: Is assignment X-C, Y-B, Z-A stable?
¨ A:
Opening
7
favorite least favorite
1st 2nd 3rd
Xavier
Yancey
Zeus
Amy
Bertha
Amy
Bertha
Amy
Bertha
Clare
Clare
Clare
Men’s Preference Profile
favorite least favorite
1st 2nd 3rd
Amy
Bertha
Clare
Yancey
Xavier
Xavier
Xavier
Yancey
Yancey
Zeus
Zeus
Zeus
Women’s Preference Profile
Bertha
Amy
Clare
Xavier
Yancey
Zeus
IRIS H.-R. JIANG
Example (2/2)
¨ Q: Is assignment X-C, Y-B, Z-A stable?
¨ A: No. Bertha and Xavier will hook up.
¨ Q: What has gone wrong?
¨ A: The process is not self-enforcing.
Opening
8
favorite least favorite
1st 2nd 3rd
Xavier
Yancey
Zeus
Amy
Bertha
Amy
Bertha
Amy
Bertha
Clare
Clare
Clare
Men’s Preference Profile
favorite least favorite
1st 2nd 3rd
Amy
Bertha
Clare
Yancey
Xavier
Xavier
Xavier
Yancey
Yancey
Zeus
Zeus
Zeus
Women’s Preference Profile
Bertha
Xavier
IRIS H.-R. JIANG
The Stable Matching Problem
¨ Perfect matching: Everyone is matched monogamously.
¤ Each man gets exactly one woman
¤ Each woman gets exactly one man
¨ Stability: No incentive for some pair of participants to
undermine assignment by joint action.
¤ In matching M, an unmatched pair (m, w) is unstable if man m
and woman w prefer each other to current partners.
¤ Unstable pair (m, w) could each improve by eloping.
¨ Stable matching: Perfect matching without unstable pairs.
¨ The stable matching problem: Given the preference lists of n
men and n women, find a stable matching if one exists.
¤ The preference lists are complete and have no ties
Opening
9
IRIS H.-R. JIANG
Simple but Invalid
¨ Random matching and fixing up
¨ Q: Valid?
¨ A: This will NOT work since a loop can occur. Swaps can be
made that might continually result in unstable pairs.
¤ Terminate?
Opening
10
Simple-But-Invalid
1. Start with some matching
2. while (there is an unstable pair) do
3. Swap mates to make the pair stable
IRIS H.-R. JIANG
Propose and Reject
¨ Status of each person: free (unmarried) ~ engaged ~ married
¤ Deferred decision making: You may hesitate for a while before
you are pretty sure you have got a reasonably good partner
¨ Goal: self-enforcing
¤ [Gale-Shapley 1962] Intuitive method: act in one’s self-interest
¨ Q: Correct? (Stable? or even perfect?) Terminate?
Opening
11
Gale-Shapley
1. initialize each person to be free
2. while (some man m is free and hasn't proposed to every woman) do
3. w = highest ranked woman in m's list to whom m has not yet proposed
4. if (w is free) then
5. (m, w) become engaged
6. else if (w prefers m to her fiancé m') then
7. (m, w) become engaged
8. m' become free
9. return the set S of engaged pairs
D. Gale and L. S. Shapley. College admissions and the stability of marriage.
American Mathematical Monthly, vol. 69, pp. 9-14, 1962.
2012 Nobel Prize in Economics
Example of Gale-Shapley Algorithm
12
Opening A flash demo can be found at http://mathsite.math.berkeley.edu/smp/smp.html
IRIS H.-R. JIANG
The Stable Matching Problem
¨ Perfect matching: Everyone is matched monogamously.
¤ Each man gets exactly one woman
¤ Each woman gets exactly one man
¨ Stability: No incentive for some pair of participants to
undermine assignment by joint action.
¤ In matching M, an unmatched pair (m, w) is unstable if man m
and woman w prefer each other to current partners.
¤ Unstable pair (m, w) could each improve by eloping.
¨ Stable matching: Perfect matching without unstable pairs.
¨ The stable matching problem: Given the preference lists of n
men and n women, find a stable matching if one exists.
¤ The preference lists are complete and have no ties
Opening
9
IRIS H.-R. JIANG
Simple but Invalid
¨ Random matching and fixing up
¨ Q: Valid?
¨ A: This will NOT work since a loop can occur. Swaps can be
made that might continually result in unstable pairs.
¤ Terminate?
Opening
10
Simple-But-Invalid
1. Start with some matching
2. while (there is an unstable pair) do
3. Swap mates to make the pair stable
IRIS H.-R. JIANG
Propose and Reject
¨ Status of each person: free (unmarried) ~ engaged ~ married
¤ Deferred decision making: You may hesitate for a while before
you are pretty sure you have got a reasonably good partner
¨ Goal: self-enforcing
¤ [Gale-Shapley 1962] Intuitive method: act in one’s self-interest
¨ Q: Correct? (Stable? or even perfect?) Terminate?
Opening
11
Gale-Shapley
1. initialize each person to be free
2. while (some man m is free and hasn't proposed to every woman) do
3. w = highest ranked woman in m's list to whom m has not yet proposed
4. if (w is free) then
5. (m, w) become engaged
6. else if (w prefers m to her fiancé m') then
7. (m, w) become engaged
8. m' become free
9. return the set S of engaged pairs
D. Gale and L. S. Shapley. College admissions and the stability of marriage.
American Mathematical Monthly, vol. 69, pp. 9-14, 1962.
2012 Nobel Prize in Economics
Example of Gale-Shapley Algorithm
12
Opening A flash demo can be found at http://mathsite.math.berkeley.edu/smp/smp.html
IRIS H.-R. JIANG
The Stable Matching Problem
¨ Perfect matching: Everyone is matched monogamously.
¤ Each man gets exactly one woman
¤ Each woman gets exactly one man
¨ Stability: No incentive for some pair of participants to
undermine assignment by joint action.
¤ In matching M, an unmatched pair (m, w) is unstable if man m
and woman w prefer each other to current partners.
¤ Unstable pair (m, w) could each improve by eloping.
¨ Stable matching: Perfect matching without unstable pairs.
¨ The stable matching problem: Given the preference lists of n
men and n women, find a stable matching if one exists.
¤ The preference lists are complete and have no ties
Opening
9
IRIS H.-R. JIANG
Simple but Invalid
¨ Random matching and fixing up
¨ Q: Valid?
¨ A: This will NOT work since a loop can occur. Swaps can be
made that might continually result in unstable pairs.
¤ Terminate?
Opening
10
Simple-But-Invalid
1. Start with some matching
2. while (there is an unstable pair) do
3. Swap mates to make the pair stable
IRIS H.-R. JIANG
Propose and Reject
¨ Status of each person: free (unmarried) ~ engaged ~ married
¤ Deferred decision making: You may hesitate for a while before
you are pretty sure you have got a reasonably good partner
¨ Goal: self-enforcing
¤ [Gale-Shapley 1962] Intuitive method: act in one’s self-interest
¨ Q: Correct? (Stable? or even perfect?) Terminate?
Opening
11
Gale-Shapley
1. initialize each person to be free
2. while (some man m is free and hasn't proposed to every woman) do
3. w = highest ranked woman in m's list to whom m has not yet proposed
4. if (w is free) then
5. (m, w) become engaged
6. else if (w prefers m to her fiancé m') then
7. (m, w) become engaged
8. m' become free
9. return the set S of engaged pairs
D. Gale and L. S. Shapley. College admissions and the stability of marriage.
American Mathematical Monthly, vol. 69, pp. 9-14, 1962.
2012 Nobel Prize in Economics
Example of Gale-Shapley Algorithm
12
Opening A flash demo can be found at http://mathsite.math.berkeley.edu/smp/smp.html
IRIS H.-R. JIANG
The Stable Matching Problem
¨ Perfect matching: Everyone is matched monogamously.
¤ Each man gets exactly one woman
¤ Each woman gets exactly one man
¨ Stability: No incentive for some pair of participants to
undermine assignment by joint action.
¤ In matching M, an unmatched pair (m, w) is unstable if man m
and woman w prefer each other to current partners.
¤ Unstable pair (m, w) could each improve by eloping.
¨ Stable matching: Perfect matching without unstable pairs.
¨ The stable matching problem: Given the preference lists of n
men and n women, find a stable matching if one exists.
¤ The preference lists are complete and have no ties
Opening
9
IRIS H.-R. JIANG
Simple but Invalid
¨ Random matching and fixing up
¨ Q: Valid?
¨ A: This will NOT work since a loop can occur. Swaps can be
made that might continually result in unstable pairs.
¤ Terminate?
Opening
10
Simple-But-Invalid
1. Start with some matching
2. while (there is an unstable pair) do
3. Swap mates to make the pair stable
IRIS H.-R. JIANG
Propose and Reject
¨ Status of each person: free (unmarried) ~ engaged ~ married
¤ Deferred decision making: You may hesitate for a while before
you are pretty sure you have got a reasonably good partner
¨ Goal: self-enforcing
¤ [Gale-Shapley 1962] Intuitive method: act in one’s self-interest
¨ Q: Correct? (Stable? or even perfect?) Terminate?
Opening
11
Gale-Shapley
1. initialize each person to be free
2. while (some man m is free and hasn't proposed to every woman) do
3. w = highest ranked woman in m's list to whom m has not yet proposed
4. if (w is free) then
5. (m, w) become engaged
6. else if (w prefers m to her fiancé m') then
7. (m, w) become engaged
8. m' become free
9. return the set S of engaged pairs
D. Gale and L. S. Shapley. College admissions and the stability of marriage.
American Mathematical Monthly, vol. 69, pp. 9-14, 1962.
2012 Nobel Prize in Economics
Example of Gale-Shapley Algorithm
12
Opening A flash demo can be found at http://mathsite.math.berkeley.edu/smp/smp.html
Five Representative Problems
13
Opening
IRIS H.-R. JIANG
Interval Scheduling
¨ Given: Set of jobs with start times and finish times
¨ Goal: Find maximum cardinality subset of mutually compatible jobs
Opening
14
jobs don’t overlap
Time
0 1 2 3 4 5 6 7 8 9 10 11
f
g
h
e
a
b
c
d
h
e
b
Maximum compatible set {b, e, h}
IRIS H.-R. JIANG
Weighted Interval Scheduling
¨ Given: Set of jobs with start times, finish times, and weights
¨ Goal: Find maximum weight subset of mutually compatible jobs
Opening
15
Time
0 1 2 3 4 5 6 7 8 9 10 11
20
11
16
13
23
12
20
26
16
26
Maximum weighted compatible set {26, 16}
IRIS H.-R. JIANG
Bipartite Matching
¨ Given: Bipartite graph
¨ Goal: Find maximum cardinality matching
Opening
16
1
2
3
4
5
A
B
C
D
E
Maximum matching {(A, 1), (B, 2), (C, 4), (D, 3), (E, 5)}
Five Representative Problems
13
Opening
IRIS H.-R. JIANG
Interval Scheduling
¨ Given: Set of jobs with start times and finish times
¨ Goal: Find maximum cardinality subset of mutually compatible jobs
Opening
14
jobs don’t overlap
Time
0 1 2 3 4 5 6 7 8 9 10 11
f
g
h
e
a
b
c
d
h
e
b
Maximum compatible set {b, e, h}
IRIS H.-R. JIANG
Weighted Interval Scheduling
¨ Given: Set of jobs with start times, finish times, and weights
¨ Goal: Find maximum weight subset of mutually compatible jobs
Opening
15
Time
0 1 2 3 4 5 6 7 8 9 10 11
20
11
16
13
23
12
20
26
16
26
Maximum weighted compatible set {26, 16}
IRIS H.-R. JIANG
Bipartite Matching
¨ Given: Bipartite graph
¨ Goal: Find maximum cardinality matching
Opening
16
1
2
3
4
5
A
B
C
D
E
Maximum matching {(A, 1), (B, 2), (C, 4), (D, 3), (E, 5)}
Five Representative Problems
13
Opening
IRIS H.-R. JIANG
Interval Scheduling
¨ Given: Set of jobs with start times and finish times
¨ Goal: Find maximum cardinality subset of mutually compatible jobs
Opening
14
jobs don’t overlap
Time
0 1 2 3 4 5 6 7 8 9 10 11
f
g
h
e
a
b
c
d
h
e
b
Maximum compatible set {b, e, h}
IRIS H.-R. JIANG
Weighted Interval Scheduling
¨ Given: Set of jobs with start times, finish times, and weights
¨ Goal: Find maximum weight subset of mutually compatible jobs
Opening
15
Time
0 1 2 3 4 5 6 7 8 9 10 11
20
11
16
13
23
12
20
26
16
26
Maximum weighted compatible set {26, 16}
IRIS H.-R. JIANG
Bipartite Matching
¨ Given: Bipartite graph
¨ Goal: Find maximum cardinality matching
Opening
16
1
2
3
4
5
A
B
C
D
E
Maximum matching {(A, 1), (B, 2), (C, 4), (D, 3), (E, 5)}
Five Representative Problems
13
Opening
IRIS H.-R. JIANG
Interval Scheduling
¨ Given: Set of jobs with start times and finish times
¨ Goal: Find maximum cardinality subset of mutually compatible jobs
Opening
14
jobs don’t overlap
Time
0 1 2 3 4 5 6 7 8 9 10 11
f
g
h
e
a
b
c
d
h
e
b
Maximum compatible set {b, e, h}
IRIS H.-R. JIANG
Weighted Interval Scheduling
¨ Given: Set of jobs with start times, finish times, and weights
¨ Goal: Find maximum weight subset of mutually compatible jobs
Opening
15
Time
0 1 2 3 4 5 6 7 8 9 10 11
20
11
16
13
23
12
20
26
16
26
Maximum weighted compatible set {26, 16}
IRIS H.-R. JIANG
Bipartite Matching
¨ Given: Bipartite graph
¨ Goal: Find maximum cardinality matching
Opening
16
1
2
3
4
5
A
B
C
D
E
Maximum matching {(A, 1), (B, 2), (C, 4), (D, 3), (E, 5)}
IRIS H.-R. JIANG
Independent Set
¨ Given: Graph
¨ Goal: Find maximum cardinality independent set
Opening
17
subset of nodes s.t. no two joined by an edge
1 2
3 4 5
6 7
1
4 5
6
Maximum independent set {1, 4, 5, 6}
IRIS H.-R. JIANG
Competitive Facility Location
¨ Given: Graph with weight on each node
¨ Game:
¤ Two competing players alternate in selecting nodes
¤ Do not allow to select a node if any of its neighbors have been
selected
¨ Goal: Select a maximum weight subset of nodes
Opening
18
Second player can guarantee 20, but not 25
10 5
1 5
15 1 5 1 10
15
IRIS H.-R. JIANG
Five Representative Problems
¨ Efficiently solvable
¤ Interval scheduling: nlogn greedy algorithm
¤ Weighted interval scheduling: nlogn dynamic programming
algorithm
¤ Bipartite matching: nk max-flow based algorithm
¨ Hard
¤ Independent set: NP-complete
¤ Competitive facility location: PSPACE-complete (even harder!)
Opening
19
Proofs
Back to Stable Matching
20
Opening
IRIS H.-R. JIANG
Independent Set
¨ Given: Graph
¨ Goal: Find maximum cardinality independent set
Opening
17
subset of nodes s.t. no two joined by an edge
1 2
3 4 5
6 7
1
4 5
6
Maximum independent set {1, 4, 5, 6}
IRIS H.-R. JIANG
Competitive Facility Location
¨ Given: Graph with weight on each node
¨ Game:
¤ Two competing players alternate in selecting nodes
¤ Do not allow to select a node if any of its neighbors have been
selected
¨ Goal: Select a maximum weight subset of nodes
Opening
18
Second player can guarantee 20, but not 25
10 5
1 5
15 1 5 1 10
15
IRIS H.-R. JIANG
Five Representative Problems
¨ Efficiently solvable
¤ Interval scheduling: nlogn greedy algorithm
¤ Weighted interval scheduling: nlogn dynamic programming
algorithm
¤ Bipartite matching: nk max-flow based algorithm
¨ Hard
¤ Independent set: NP-complete
¤ Competitive facility location: PSPACE-complete (even harder!)
Opening
19
Proofs
Back to Stable Matching
20
Opening
IRIS H.-R. JIANG
Independent Set
¨ Given: Graph
¨ Goal: Find maximum cardinality independent set
Opening
17
subset of nodes s.t. no two joined by an edge
1 2
3 4 5
6 7
1
4 5
6
Maximum independent set {1, 4, 5, 6}
IRIS H.-R. JIANG
Competitive Facility Location
¨ Given: Graph with weight on each node
¨ Game:
¤ Two competing players alternate in selecting nodes
¤ Do not allow to select a node if any of its neighbors have been
selected
¨ Goal: Select a maximum weight subset of nodes
Opening
18
Second player can guarantee 20, but not 25
10 5
1 5
15 1 5 1 10
15
IRIS H.-R. JIANG
Five Representative Problems
¨ Efficiently solvable
¤ Interval scheduling: nlogn greedy algorithm
¤ Weighted interval scheduling: nlogn dynamic programming
algorithm
¤ Bipartite matching: nk max-flow based algorithm
¨ Hard
¤ Independent set: NP-complete
¤ Competitive facility location: PSPACE-complete (even harder!)
Opening
19
Proofs
Back to Stable Matching
20
Opening
IRIS H.-R. JIANG
Independent Set
¨ Given: Graph
¨ Goal: Find maximum cardinality independent set
Opening
17
subset of nodes s.t. no two joined by an edge
1 2
3 4 5
6 7
1
4 5
6
Maximum independent set {1, 4, 5, 6}
IRIS H.-R. JIANG
Competitive Facility Location
¨ Given: Graph with weight on each node
¨ Game:
¤ Two competing players alternate in selecting nodes
¤ Do not allow to select a node if any of its neighbors have been
selected
¨ Goal: Select a maximum weight subset of nodes
Opening
18
Second player can guarantee 20, but not 25
10 5
1 5
15 1 5 1 10
15
IRIS H.-R. JIANG
Five Representative Problems
¨ Efficiently solvable
¤ Interval scheduling: nlogn greedy algorithm
¤ Weighted interval scheduling: nlogn dynamic programming
algorithm
¤ Bipartite matching: nk max-flow based algorithm
¨ Hard
¤ Independent set: NP-complete
¤ Competitive facility location: PSPACE-complete (even harder!)
Opening
19
Proofs
Back to Stable Matching
20
Opening
IRIS H.-R. JIANG
Formulating the Problem
¨ The stable matching problem
¨ Given:
¤ M: n men
¤ W: n women
¤ M x W: Each person has ranked all members of the opposite sex
with a unique number between 1 and n in order of preference
¨ Goal:
¤ Marry the men and women off such that
¤ There are no two people of opposite sex who would both rather
have each other than their current partners.
n If there are no such people, all the marriages are stable.
Opening
21
Clean!
IRIS H.-R. JIANG
Designing the Algorithm
¨ Correctness:
¤ Termination: G-S terminates after at most n2 iterations.
¤ Perfection: Everyone gets married.
¤ Stability: The marriages are stable.
¨ Male-optimal and female-pessimal
¨ All executions yield the same matching
Opening
22
Clean!
Gale-Shapley
1. initialize each person to be free
2. while (some man m is free and hasn't proposed to every woman) do
3. w = highest ranked woman in m's list to whom m has not yet proposed
4. if (w is free) then
5. (m, w) become engaged
6. else if (w prefers m to her fiancé m') then
7. (m, w) become engaged
8. m' become free
9. return the set S of engaged pairs
IRIS H.-R. JIANG
Correctness: Termination
¨ G-S terminates after at most n2 iterations of the while loop.
¨ Pf:
¤ At each iteration, a man proposes to a new woman.
¤ There are only n2 possible proposals.
¨ Observation 1: The sequence of women to whom m proposes gets
worse and worse.
¨ Observation 2: Once a woman w receives her first proposal, w
remains engaged; she only trades up.
Opening
23
1st 2nd 3rd
Xavier
Yancey
Zeus
Amy
Bertha
Amy
Bertha
Amy
Bertha
Clare
Clare
Clare
Men’s Preference Profile
1st 2nd 3rd
Amy
Bertha
Clare
Yancey
Xavier
Xavier
Xavier
Yancey
Yancey
Zeus
Zeus
Zeus
Women’s Preference Profile
Bertha
Amy
Clare
Xavier
Yancey
Zeus
Amy Bertha
Zeus
Zeus
Don’t count
free people
IRIS H.-R. JIANG
Correctness: Perfection
¨ The set S returned at termination is perfect matching.
¤ i.e., all men get married
¤ Prove by contradiction!
¨ Pf:
¤ Suppose that G-S algorithm terminates with a free man m.
¤ At termination, m had already proposed to every woman.
Otherwise, the while loop would not have exited.
¤ Since there is a free man m, there must be at least a free woman,
say w. w was never proposed to.
¤ This contradicts that m had already proposed to every woman.
Opening
24
Gale-Shapley
1. initialize each person to be free
2. while (some man m is free and hasn't proposed to every woman) do
3. w = highest ranked woman in m's list to whom m has not yet proposed
4. if (w is free) then
5. (m, w) become engaged
6. else if (w prefers m to her fiancé m') then
7. (m, w) become engaged
8. m' become free
9. return the set S of engaged pairs
IRIS H.-R. JIANG
Formulating the Problem
¨ The stable matching problem
¨ Given:
¤ M: n men
¤ W: n women
¤ M x W: Each person has ranked all members of the opposite sex
with a unique number between 1 and n in order of preference
¨ Goal:
¤ Marry the men and women off such that
¤ There are no two people of opposite sex who would both rather
have each other than their current partners.
n If there are no such people, all the marriages are stable.
Opening
21
Clean!
IRIS H.-R. JIANG
Designing the Algorithm
¨ Correctness:
¤ Termination: G-S terminates after at most n2 iterations.
¤ Perfection: Everyone gets married.
¤ Stability: The marriages are stable.
¨ Male-optimal and female-pessimal
¨ All executions yield the same matching
Opening
22
Clean!
Gale-Shapley
1. initialize each person to be free
2. while (some man m is free and hasn't proposed to every woman) do
3. w = highest ranked woman in m's list to whom m has not yet proposed
4. if (w is free) then
5. (m, w) become engaged
6. else if (w prefers m to her fiancé m') then
7. (m, w) become engaged
8. m' become free
9. return the set S of engaged pairs
IRIS H.-R. JIANG
Correctness: Termination
¨ G-S terminates after at most n2 iterations of the while loop.
¨ Pf:
¤ At each iteration, a man proposes to a new woman.
¤ There are only n2 possible proposals.
¨ Observation 1: The sequence of women to whom m proposes gets
worse and worse.
¨ Observation 2: Once a woman w receives her first proposal, w
remains engaged; she only trades up.
Opening
23
1st 2nd 3rd
Xavier
Yancey
Zeus
Amy
Bertha
Amy
Bertha
Amy
Bertha
Clare
Clare
Clare
Men’s Preference Profile
1st 2nd 3rd
Amy
Bertha
Clare
Yancey
Xavier
Xavier
Xavier
Yancey
Yancey
Zeus
Zeus
Zeus
Women’s Preference Profile
Bertha
Amy
Clare
Xavier
Yancey
Zeus
Amy Bertha
Zeus
Zeus
Don’t count
free people
IRIS H.-R. JIANG
Correctness: Perfection
¨ The set S returned at termination is perfect matching.
¤ i.e., all men get married
¤ Prove by contradiction!
¨ Pf:
¤ Suppose that G-S algorithm terminates with a free man m.
¤ At termination, m had already proposed to every woman.
Otherwise, the while loop would not have exited.
¤ Since there is a free man m, there must be at least a free woman,
say w. w was never proposed to.
¤ This contradicts that m had already proposed to every woman.
Opening
24
Gale-Shapley
1. initialize each person to be free
2. while (some man m is free and hasn't proposed to every woman) do
3. w = highest ranked woman in m's list to whom m has not yet proposed
4. if (w is free) then
5. (m, w) become engaged
6. else if (w prefers m to her fiancé m') then
7. (m, w) become engaged
8. m' become free
9. return the set S of engaged pairs
IRIS H.-R. JIANG
Formulating the Problem
¨ The stable matching problem
¨ Given:
¤ M: n men
¤ W: n women
¤ M x W: Each person has ranked all members of the opposite sex
with a unique number between 1 and n in order of preference
¨ Goal:
¤ Marry the men and women off such that
¤ There are no two people of opposite sex who would both rather
have each other than their current partners.
n If there are no such people, all the marriages are stable.
Opening
21
Clean!
IRIS H.-R. JIANG
Designing the Algorithm
¨ Correctness:
¤ Termination: G-S terminates after at most n2 iterations.
¤ Perfection: Everyone gets married.
¤ Stability: The marriages are stable.
¨ Male-optimal and female-pessimal
¨ All executions yield the same matching
Opening
22
Clean!
Gale-Shapley
1. initialize each person to be free
2. while (some man m is free and hasn't proposed to every woman) do
3. w = highest ranked woman in m's list to whom m has not yet proposed
4. if (w is free) then
5. (m, w) become engaged
6. else if (w prefers m to her fiancé m') then
7. (m, w) become engaged
8. m' become free
9. return the set S of engaged pairs
IRIS H.-R. JIANG
Correctness: Termination
¨ G-S terminates after at most n2 iterations of the while loop.
¨ Pf:
¤ At each iteration, a man proposes to a new woman.
¤ There are only n2 possible proposals.
¨ Observation 1: The sequence of women to whom m proposes gets
worse and worse.
¨ Observation 2: Once a woman w receives her first proposal, w
remains engaged; she only trades up.
Opening
23
1st 2nd 3rd
Xavier
Yancey
Zeus
Amy
Bertha
Amy
Bertha
Amy
Bertha
Clare
Clare
Clare
Men’s Preference Profile
1st 2nd 3rd
Amy
Bertha
Clare
Yancey
Xavier
Xavier
Xavier
Yancey
Yancey
Zeus
Zeus
Zeus
Women’s Preference Profile
Bertha
Amy
Clare
Xavier
Yancey
Zeus
Amy Bertha
Zeus
Zeus
Don’t count
free people
IRIS H.-R. JIANG
Correctness: Perfection
¨ The set S returned at termination is perfect matching.
¤ i.e., all men get married
¤ Prove by contradiction!
¨ Pf:
¤ Suppose that G-S algorithm terminates with a free man m.
¤ At termination, m had already proposed to every woman.
Otherwise, the while loop would not have exited.
¤ Since there is a free man m, there must be at least a free woman,
say w. w was never proposed to.
¤ This contradicts that m had already proposed to every woman.
Opening
24
Gale-Shapley
1. initialize each person to be free
2. while (some man m is free and hasn't proposed to every woman) do
3. w = highest ranked woman in m's list to whom m has not yet proposed
4. if (w is free) then
5. (m, w) become engaged
6. else if (w prefers m to her fiancé m') then
7. (m, w) become engaged
8. m' become free
9. return the set S of engaged pairs
IRIS H.-R. JIANG
Formulating the Problem
¨ The stable matching problem
¨ Given:
¤ M: n men
¤ W: n women
¤ M x W: Each person has ranked all members of the opposite sex
with a unique number between 1 and n in order of preference
¨ Goal:
¤ Marry the men and women off such that
¤ There are no two people of opposite sex who would both rather
have each other than their current partners.
n If there are no such people, all the marriages are stable.
Opening
21
Clean!
IRIS H.-R. JIANG
Designing the Algorithm
¨ Correctness:
¤ Termination: G-S terminates after at most n2 iterations.
¤ Perfection: Everyone gets married.
¤ Stability: The marriages are stable.
¨ Male-optimal and female-pessimal
¨ All executions yield the same matching
Opening
22
Clean!
Gale-Shapley
1. initialize each person to be free
2. while (some man m is free and hasn't proposed to every woman) do
3. w = highest ranked woman in m's list to whom m has not yet proposed
4. if (w is free) then
5. (m, w) become engaged
6. else if (w prefers m to her fiancé m') then
7. (m, w) become engaged
8. m' become free
9. return the set S of engaged pairs
IRIS H.-R. JIANG
Correctness: Termination
¨ G-S terminates after at most n2 iterations of the while loop.
¨ Pf:
¤ At each iteration, a man proposes to a new woman.
¤ There are only n2 possible proposals.
¨ Observation 1: The sequence of women to whom m proposes gets
worse and worse.
¨ Observation 2: Once a woman w receives her first proposal, w
remains engaged; she only trades up.
Opening
23
1st 2nd 3rd
Xavier
Yancey
Zeus
Amy
Bertha
Amy
Bertha
Amy
Bertha
Clare
Clare
Clare
Men’s Preference Profile
1st 2nd 3rd
Amy
Bertha
Clare
Yancey
Xavier
Xavier
Xavier
Yancey
Yancey
Zeus
Zeus
Zeus
Women’s Preference Profile
Bertha
Amy
Clare
Xavier
Yancey
Zeus
Amy Bertha
Zeus
Zeus
Don’t count
free people
IRIS H.-R. JIANG
Correctness: Perfection
¨ The set S returned at termination is perfect matching.
¤ i.e., all men get married
¤ Prove by contradiction!
¨ Pf:
¤ Suppose that G-S algorithm terminates with a free man m.
¤ At termination, m had already proposed to every woman.
Otherwise, the while loop would not have exited.
¤ Since there is a free man m, there must be at least a free woman,
say w. w was never proposed to.
¤ This contradicts that m had already proposed to every woman.
Opening
24
Gale-Shapley
1. initialize each person to be free
2. while (some man m is free and hasn't proposed to every woman) do
3. w = highest ranked woman in m's list to whom m has not yet proposed
4. if (w is free) then
5. (m, w) become engaged
6. else if (w prefers m to her fiancé m') then
7. (m, w) become engaged
8. m' become free
9. return the set S of engaged pairs
IRIS H.-R. JIANG
Correctness: Stability
¨ Consider an execution returns S. Set S is a stable matching.
¤ Assume an instability w.r.t. S and obtain a contradiction.
¨ Pf.
¤ This instability involve two pairs, (m, w) and (m', w'), in S with
n m prefers w' to w
n w' prefers m to m'
¤ In the execution, m’s last proposal was w.
¤ Did m propose to w' at some earlier point?
n Case 1: No.
n m must prefers w to w'. ®¬
n Case 2: Yes.
n m was rejected by w' because of m'', w' prefers m'' to m
n m'' = m' (final partner) ®¬
n w' prefers her final partner m' to m'' ®¬
Opening
25
w
m
m' w'
IRIS H.-R. JIANG
Uniqueness?
¨ Q: For a given instance, is stable matching is unique?
¨ A:
Opening
26
1st 2nd 3rd
Xavier
Yancey
Zeus
Amy
Bertha
Amy
Bertha
Amy
Bertha
Clare
Clare
Clare
Men’s Preference Profile
1st 2nd 3rd
Amy
Bertha
Clare
Yancey
Xavier
Xavier
Xavier
Yancey
Yancey
Zeus
Zeus
Zeus
Women’s Preference Profile
Bertha
Amy
Clare
Xavier
Yancey
Zeus
1st 2nd 3rd
Xavier
Yancey
Zeus
Amy
Bertha
Amy
Bertha
Amy
Bertha
Clare
Clare
Clare
Men’s Preference Profile
1st 2nd 3rd
Amy
Bertha
Clare
Yancey
Xavier
Xavier
Xavier
Yancey
Yancey
Zeus
Zeus
Zeus
Women’s Preference Profile
Bertha
Amy
Clare
Xavier
Yancey
Zeus
IRIS H.-R. JIANG
Male-Optimality
¨ S* = {(m, best(m)): m Î M}: best possible outcome for all men
¤ w Î W is a valid partner of a man m if there is a stable matching
that contains the pair (m, w)
¤ w = best(m): best valid partner of m if w is a valid partner of m
and no woman whom m ranks higher than w is m’s valid partner
¨ Every execution of G-S algorithm results in the set S*
¤ Male-optimal (and female-pessimal)
¤ The same matching for all executions
Opening
27
1st 2nd 3rd
Xavier
Yancey
Zeus
Amy
Bertha
Clare
Bertha
Amy
Bertha
Clare
Clare
Amy
Men’s Preference Profile
1st 2nd 3rd
Amy
Bertha
Clare
Yancey
Xavier
Xavier
Zeus
Zeus
Yancey
Xavier
Yancey
Zeus
Women’s Preference Profile
Bertha
Amy
Clare
Xavier
Yancey
Zeus
IRIS H.-R. JIANG
Male-Optimality
¨ G-S algorithm results in the set S*
¤ Again, by contradiction!
¨ Pf.
¤ Suppose some execution E of G-S yields S where some man is paired with
someone other than his best valid partner.
¤ Since men propose in decreasing order of preference Þ some man is
rejected by a valid partner during E.
n Let m be first such man & w be first valid woman who rejects m
n w = best(m)
n By definition, there is a stable matching S' containing (m, w).
¤ In E, m was rejected by w because of m' Þ w prefers m' to m
¤ Assume (m', w') Î S', w' ¹ w. (w' is a valid partner of m')
¤ In E, (m, w) is the first rejection of a valid pair
¤ m' hadn’t been rejected by any valid partner when m' is engaged to w in E.
¤ m' proposed in decreasing order of preference (those women ranked before
w are invalid).
¤ And w' is a valid partner of m' Þ m' must prefer w to w'
¤ Since (m', w) Ï S', it follows that (m', w) is an instability in S'. ®¬
Opening
28
w
m
m' w'
S'
S'
IRIS H.-R. JIANG
Correctness: Stability
¨ Consider an execution returns S. Set S is a stable matching.
¤ Assume an instability w.r.t. S and obtain a contradiction.
¨ Pf.
¤ This instability involve two pairs, (m, w) and (m', w'), in S with
n m prefers w' to w
n w' prefers m to m'
¤ In the execution, m’s last proposal was w.
¤ Did m propose to w' at some earlier point?
n Case 1: No.
n m must prefers w to w'. ®¬
n Case 2: Yes.
n m was rejected by w' because of m'', w' prefers m'' to m
n m'' = m' (final partner) ®¬
n w' prefers her final partner m' to m'' ®¬
Opening
25
w
m
m' w'
IRIS H.-R. JIANG
Uniqueness?
¨ Q: For a given instance, is stable matching is unique?
¨ A:
Opening
26
1st 2nd 3rd
Xavier
Yancey
Zeus
Amy
Bertha
Amy
Bertha
Amy
Bertha
Clare
Clare
Clare
Men’s Preference Profile
1st 2nd 3rd
Amy
Bertha
Clare
Yancey
Xavier
Xavier
Xavier
Yancey
Yancey
Zeus
Zeus
Zeus
Women’s Preference Profile
Bertha
Amy
Clare
Xavier
Yancey
Zeus
1st 2nd 3rd
Xavier
Yancey
Zeus
Amy
Bertha
Amy
Bertha
Amy
Bertha
Clare
Clare
Clare
Men’s Preference Profile
1st 2nd 3rd
Amy
Bertha
Clare
Yancey
Xavier
Xavier
Xavier
Yancey
Yancey
Zeus
Zeus
Zeus
Women’s Preference Profile
Bertha
Amy
Clare
Xavier
Yancey
Zeus
IRIS H.-R. JIANG
Male-Optimality
¨ S* = {(m, best(m)): m Î M}: best possible outcome for all men
¤ w Î W is a valid partner of a man m if there is a stable matching
that contains the pair (m, w)
¤ w = best(m): best valid partner of m if w is a valid partner of m
and no woman whom m ranks higher than w is m’s valid partner
¨ Every execution of G-S algorithm results in the set S*
¤ Male-optimal (and female-pessimal)
¤ The same matching for all executions
Opening
27
1st 2nd 3rd
Xavier
Yancey
Zeus
Amy
Bertha
Clare
Bertha
Amy
Bertha
Clare
Clare
Amy
Men’s Preference Profile
1st 2nd 3rd
Amy
Bertha
Clare
Yancey
Xavier
Xavier
Zeus
Zeus
Yancey
Xavier
Yancey
Zeus
Women’s Preference Profile
Bertha
Amy
Clare
Xavier
Yancey
Zeus
IRIS H.-R. JIANG
Male-Optimality
¨ G-S algorithm results in the set S*
¤ Again, by contradiction!
¨ Pf.
¤ Suppose some execution E of G-S yields S where some man is paired with
someone other than his best valid partner.
¤ Since men propose in decreasing order of preference Þ some man is
rejected by a valid partner during E.
n Let m be first such man & w be first valid woman who rejects m
n w = best(m)
n By definition, there is a stable matching S' containing (m, w).
¤ In E, m was rejected by w because of m' Þ w prefers m' to m
¤ Assume (m', w') Î S', w' ¹ w. (w' is a valid partner of m')
¤ In E, (m, w) is the first rejection of a valid pair
¤ m' hadn’t been rejected by any valid partner when m' is engaged to w in E.
¤ m' proposed in decreasing order of preference (those women ranked before
w are invalid).
¤ And w' is a valid partner of m' Þ m' must prefer w to w'
¤ Since (m', w) Ï S', it follows that (m', w) is an instability in S'. ®¬
Opening
28
w
m
m' w'
S'
S'
IRIS H.-R. JIANG
Correctness: Stability
¨ Consider an execution returns S. Set S is a stable matching.
¤ Assume an instability w.r.t. S and obtain a contradiction.
¨ Pf.
¤ This instability involve two pairs, (m, w) and (m', w'), in S with
n m prefers w' to w
n w' prefers m to m'
¤ In the execution, m’s last proposal was w.
¤ Did m propose to w' at some earlier point?
n Case 1: No.
n m must prefers w to w'. ®¬
n Case 2: Yes.
n m was rejected by w' because of m'', w' prefers m'' to m
n m'' = m' (final partner) ®¬
n w' prefers her final partner m' to m'' ®¬
Opening
25
w
m
m' w'
IRIS H.-R. JIANG
Uniqueness?
¨ Q: For a given instance, is stable matching is unique?
¨ A:
Opening
26
1st 2nd 3rd
Xavier
Yancey
Zeus
Amy
Bertha
Amy
Bertha
Amy
Bertha
Clare
Clare
Clare
Men’s Preference Profile
1st 2nd 3rd
Amy
Bertha
Clare
Yancey
Xavier
Xavier
Xavier
Yancey
Yancey
Zeus
Zeus
Zeus
Women’s Preference Profile
Bertha
Amy
Clare
Xavier
Yancey
Zeus
1st 2nd 3rd
Xavier
Yancey
Zeus
Amy
Bertha
Amy
Bertha
Amy
Bertha
Clare
Clare
Clare
Men’s Preference Profile
1st 2nd 3rd
Amy
Bertha
Clare
Yancey
Xavier
Xavier
Xavier
Yancey
Yancey
Zeus
Zeus
Zeus
Women’s Preference Profile
Bertha
Amy
Clare
Xavier
Yancey
Zeus
IRIS H.-R. JIANG
Male-Optimality
¨ S* = {(m, best(m)): m Î M}: best possible outcome for all men
¤ w Î W is a valid partner of a man m if there is a stable matching
that contains the pair (m, w)
¤ w = best(m): best valid partner of m if w is a valid partner of m
and no woman whom m ranks higher than w is m’s valid partner
¨ Every execution of G-S algorithm results in the set S*
¤ Male-optimal (and female-pessimal)
¤ The same matching for all executions
Opening
27
1st 2nd 3rd
Xavier
Yancey
Zeus
Amy
Bertha
Clare
Bertha
Amy
Bertha
Clare
Clare
Amy
Men’s Preference Profile
1st 2nd 3rd
Amy
Bertha
Clare
Yancey
Xavier
Xavier
Zeus
Zeus
Yancey
Xavier
Yancey
Zeus
Women’s Preference Profile
Bertha
Amy
Clare
Xavier
Yancey
Zeus
IRIS H.-R. JIANG
Male-Optimality
¨ G-S algorithm results in the set S*
¤ Again, by contradiction!
¨ Pf.
¤ Suppose some execution E of G-S yields S where some man is paired with
someone other than his best valid partner.
¤ Since men propose in decreasing order of preference Þ some man is
rejected by a valid partner during E.
n Let m be first such man & w be first valid woman who rejects m
n w = best(m)
n By definition, there is a stable matching S' containing (m, w).
¤ In E, m was rejected by w because of m' Þ w prefers m' to m
¤ Assume (m', w') Î S', w' ¹ w. (w' is a valid partner of m')
¤ In E, (m, w) is the first rejection of a valid pair
¤ m' hadn’t been rejected by any valid partner when m' is engaged to w in E.
¤ m' proposed in decreasing order of preference (those women ranked before
w are invalid).
¤ And w' is a valid partner of m' Þ m' must prefer w to w'
¤ Since (m', w) Ï S', it follows that (m', w) is an instability in S'. ®¬
Opening
28
w
m
m' w'
S'
S'
IRIS H.-R. JIANG
Correctness: Stability
¨ Consider an execution returns S. Set S is a stable matching.
¤ Assume an instability w.r.t. S and obtain a contradiction.
¨ Pf.
¤ This instability involve two pairs, (m, w) and (m', w'), in S with
n m prefers w' to w
n w' prefers m to m'
¤ In the execution, m’s last proposal was w.
¤ Did m propose to w' at some earlier point?
n Case 1: No.
n m must prefers w to w'. ®¬
n Case 2: Yes.
n m was rejected by w' because of m'', w' prefers m'' to m
n m'' = m' (final partner) ®¬
n w' prefers her final partner m' to m'' ®¬
Opening
25
w
m
m' w'
IRIS H.-R. JIANG
Uniqueness?
¨ Q: For a given instance, is stable matching is unique?
¨ A:
Opening
26
1st 2nd 3rd
Xavier
Yancey
Zeus
Amy
Bertha
Amy
Bertha
Amy
Bertha
Clare
Clare
Clare
Men’s Preference Profile
1st 2nd 3rd
Amy
Bertha
Clare
Yancey
Xavier
Xavier
Xavier
Yancey
Yancey
Zeus
Zeus
Zeus
Women’s Preference Profile
Bertha
Amy
Clare
Xavier
Yancey
Zeus
1st 2nd 3rd
Xavier
Yancey
Zeus
Amy
Bertha
Amy
Bertha
Amy
Bertha
Clare
Clare
Clare
Men’s Preference Profile
1st 2nd 3rd
Amy
Bertha
Clare
Yancey
Xavier
Xavier
Xavier
Yancey
Yancey
Zeus
Zeus
Zeus
Women’s Preference Profile
Bertha
Amy
Clare
Xavier
Yancey
Zeus
IRIS H.-R. JIANG
Male-Optimality
¨ S* = {(m, best(m)): m Î M}: best possible outcome for all men
¤ w Î W is a valid partner of a man m if there is a stable matching
that contains the pair (m, w)
¤ w = best(m): best valid partner of m if w is a valid partner of m
and no woman whom m ranks higher than w is m’s valid partner
¨ Every execution of G-S algorithm results in the set S*
¤ Male-optimal (and female-pessimal)
¤ The same matching for all executions
Opening
27
1st 2nd 3rd
Xavier
Yancey
Zeus
Amy
Bertha
Clare
Bertha
Amy
Bertha
Clare
Clare
Amy
Men’s Preference Profile
1st 2nd 3rd
Amy
Bertha
Clare
Yancey
Xavier
Xavier
Zeus
Zeus
Yancey
Xavier
Yancey
Zeus
Women’s Preference Profile
Bertha
Amy
Clare
Xavier
Yancey
Zeus
IRIS H.-R. JIANG
Male-Optimality
¨ G-S algorithm results in the set S*
¤ Again, by contradiction!
¨ Pf.
¤ Suppose some execution E of G-S yields S where some man is paired with
someone other than his best valid partner.
¤ Since men propose in decreasing order of preference Þ some man is
rejected by a valid partner during E.
n Let m be first such man & w be first valid woman who rejects m
n w = best(m)
n By definition, there is a stable matching S' containing (m, w).
¤ In E, m was rejected by w because of m' Þ w prefers m' to m
¤ Assume (m', w') Î S', w' ¹ w. (w' is a valid partner of m')
¤ In E, (m, w) is the first rejection of a valid pair
¤ m' hadn’t been rejected by any valid partner when m' is engaged to w in E.
¤ m' proposed in decreasing order of preference (those women ranked before
w are invalid).
¤ And w' is a valid partner of m' Þ m' must prefer w to w'
¤ Since (m', w) Ï S', it follows that (m', w) is an instability in S'. ®¬
Opening
28
w
m
m' w'
S'
S'
IRIS H.-R. JIANG
What Did We Learn?
¨ Powerful ideas learned from stable matching
¤ Isolate underlying structure of problem
¤ Create effective and efficient algorithms
n Effectiveness: Logical proofs
n Useful technique: proof by contradiction
n Efficiency will be detailed in the next chapter
Opening
29
For me, great algorithms are the poetry of computation.
Just like verse, they can be terse, allusive, dense, and even mysterious.
But once unlocked, they cast a brilliant new light on some aspect of computing.
-- Francis Sullivan
An algorithm must be seen to be believed.
The best way to learn what an algorithm is all about is to try it.
The reader should always take pencil and paper and work through an example...
-- Donald Knuth
IRIS H.-R. JIANG
eBook
¨ Chapters 1, 6, 13
¨ http://www.aw-bc.com/info/kleinberg/assets/downloads/ch1.pdf
¨ http://www.aw-bc.com/info/kleinberg/assets/downloads/ch6.pdf
¨ http://www.aw-bc.com/info/kleinberg/assets/downloads/ch13.pdf
¨ The whole book
¨ http://www.icsd.aegean.gr/kaporisa/index_files/Algorithm_Design.pdf
Opening
30
IRIS H.-R. JIANG
What Did We Learn?
¨ Powerful ideas learned from stable matching
¤ Isolate underlying structure of problem
¤ Create effective and efficient algorithms
n Effectiveness: Logical proofs
n Useful technique: proof by contradiction
n Efficiency will be detailed in the next chapter
Opening
29
For me, great algorithms are the poetry of computation.
Just like verse, they can be terse, allusive, dense, and even mysterious.
But once unlocked, they cast a brilliant new light on some aspect of computing.
-- Francis Sullivan
An algorithm must be seen to be believed.
The best way to learn what an algorithm is all about is to try it.
The reader should always take pencil and paper and work through an example...
-- Donald Knuth
IRIS H.-R. JIANG
eBook
¨ Chapters 1, 6, 13
¨ http://www.aw-bc.com/info/kleinberg/assets/downloads/ch1.pdf
¨ http://www.aw-bc.com/info/kleinberg/assets/downloads/ch6.pdf
¨ http://www.aw-bc.com/info/kleinberg/assets/downloads/ch13.pdf
¨ The whole book
¨ http://www.icsd.aegean.gr/kaporisa/index_files/Algorithm_Design.pdf
Opening
30

Más contenido relacionado

Más de HsuChi Chen

algorithm_0introdunction.pdf
algorithm_0introdunction.pdfalgorithm_0introdunction.pdf
algorithm_0introdunction.pdfHsuChi Chen
 
期末專題報告書
期末專題報告書期末專題報告書
期末專題報告書HsuChi Chen
 
單晶片期末專題-報告二
單晶片期末專題-報告二單晶片期末專題-報告二
單晶片期末專題-報告二HsuChi Chen
 
單晶片期末專題-報告一
單晶片期末專題-報告一單晶片期末專題-報告一
單晶片期末專題-報告一HsuChi Chen
 
模組化課程生醫微製程期末報告
模組化課程生醫微製程期末報告模組化課程生醫微製程期末報告
模組化課程生醫微製程期末報告HsuChi Chen
 
單晶片期末專題-初步想法
單晶片期末專題-初步想法單晶片期末專題-初步想法
單晶片期末專題-初步想法HsuChi Chen
 

Más de HsuChi Chen (6)

algorithm_0introdunction.pdf
algorithm_0introdunction.pdfalgorithm_0introdunction.pdf
algorithm_0introdunction.pdf
 
期末專題報告書
期末專題報告書期末專題報告書
期末專題報告書
 
單晶片期末專題-報告二
單晶片期末專題-報告二單晶片期末專題-報告二
單晶片期末專題-報告二
 
單晶片期末專題-報告一
單晶片期末專題-報告一單晶片期末專題-報告一
單晶片期末專題-報告一
 
模組化課程生醫微製程期末報告
模組化課程生醫微製程期末報告模組化課程生醫微製程期末報告
模組化課程生醫微製程期末報告
 
單晶片期末專題-初步想法
單晶片期末專題-初步想法單晶片期末專題-初步想法
單晶片期末專題-初步想法
 

Último

The Evolution of Karaoke From Analog to App.pdf
The Evolution of Karaoke From Analog to App.pdfThe Evolution of Karaoke From Analog to App.pdf
The Evolution of Karaoke From Analog to App.pdfPower Karaoke
 
Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)OPEN KNOWLEDGE GmbH
 
Salesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantSalesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantAxelRicardoTrocheRiq
 
Cloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackCloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackVICTOR MAESTRE RAMIREZ
 
Project Based Learning (A.I).pptx detail explanation
Project Based Learning (A.I).pptx detail explanationProject Based Learning (A.I).pptx detail explanation
Project Based Learning (A.I).pptx detail explanationkaushalgiri8080
 
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...stazi3110
 
What is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need ItWhat is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need ItWave PLM
 
Engage Usergroup 2024 - The Good The Bad_The Ugly
Engage Usergroup 2024 - The Good The Bad_The UglyEngage Usergroup 2024 - The Good The Bad_The Ugly
Engage Usergroup 2024 - The Good The Bad_The UglyFrank van der Linden
 
cybersecurity notes for mca students for learning
cybersecurity notes for mca students for learningcybersecurity notes for mca students for learning
cybersecurity notes for mca students for learningVitsRangannavar
 
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...MyIntelliSource, Inc.
 
Hand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxHand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxbodapatigopi8531
 
What is Binary Language? Computer Number Systems
What is Binary Language?  Computer Number SystemsWhat is Binary Language?  Computer Number Systems
What is Binary Language? Computer Number SystemsJheuzeDellosa
 
EY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityEY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityNeo4j
 
chapter--4-software-project-planning.ppt
chapter--4-software-project-planning.pptchapter--4-software-project-planning.ppt
chapter--4-software-project-planning.pptkotipi9215
 
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideBuilding Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideChristina Lin
 
DNT_Corporate presentation know about us
DNT_Corporate presentation know about usDNT_Corporate presentation know about us
DNT_Corporate presentation know about usDynamic Netsoft
 
Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...OnePlan Solutions
 
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...Christina Lin
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsAlberto González Trastoy
 
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...soniya singh
 

Último (20)

The Evolution of Karaoke From Analog to App.pdf
The Evolution of Karaoke From Analog to App.pdfThe Evolution of Karaoke From Analog to App.pdf
The Evolution of Karaoke From Analog to App.pdf
 
Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)
 
Salesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantSalesforce Certified Field Service Consultant
Salesforce Certified Field Service Consultant
 
Cloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackCloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStack
 
Project Based Learning (A.I).pptx detail explanation
Project Based Learning (A.I).pptx detail explanationProject Based Learning (A.I).pptx detail explanation
Project Based Learning (A.I).pptx detail explanation
 
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
 
What is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need ItWhat is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need It
 
Engage Usergroup 2024 - The Good The Bad_The Ugly
Engage Usergroup 2024 - The Good The Bad_The UglyEngage Usergroup 2024 - The Good The Bad_The Ugly
Engage Usergroup 2024 - The Good The Bad_The Ugly
 
cybersecurity notes for mca students for learning
cybersecurity notes for mca students for learningcybersecurity notes for mca students for learning
cybersecurity notes for mca students for learning
 
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
 
Hand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxHand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptx
 
What is Binary Language? Computer Number Systems
What is Binary Language?  Computer Number SystemsWhat is Binary Language?  Computer Number Systems
What is Binary Language? Computer Number Systems
 
EY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityEY_Graph Database Powered Sustainability
EY_Graph Database Powered Sustainability
 
chapter--4-software-project-planning.ppt
chapter--4-software-project-planning.pptchapter--4-software-project-planning.ppt
chapter--4-software-project-planning.ppt
 
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideBuilding Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
 
DNT_Corporate presentation know about us
DNT_Corporate presentation know about usDNT_Corporate presentation know about us
DNT_Corporate presentation know about us
 
Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...
 
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
 
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
 

algorithm_1introdunction.pdf

  • 1. Iris Hui-Ru Jiang Fall 2014 CHAPTER 1 INTRODUCTION IRIS H.-R. JIANG Outline ¨ Content: ¤ Opening: stable matching ¤ Five representative problems ¨ Reading: ¤ Chapter 1 Opening 2 Opening topic Stable Matching 3 Opening IRIS H.-R. JIANG Opening ¨ We start from an algorithmic problem that illustrates many of the themes we will be emphasizing. 1. It is motivated by some very natural and practical concerns. 2. From these, we formulate a clean and simple statement of a problem. 3. The algorithm to solve the problem is very clean as well. 4. Most of our work will be spent in proving that it is correct and giving an acceptable bound on the amount of time it takes to terminate with an answer. Opening 4
  • 2. Iris Hui-Ru Jiang Fall 2014 CHAPTER 1 INTRODUCTION IRIS H.-R. JIANG Outline ¨ Content: ¤ Opening: stable matching ¤ Five representative problems ¨ Reading: ¤ Chapter 1 Opening 2 Opening topic Stable Matching 3 Opening IRIS H.-R. JIANG Opening ¨ We start from an algorithmic problem that illustrates many of the themes we will be emphasizing. 1. It is motivated by some very natural and practical concerns. 2. From these, we formulate a clean and simple statement of a problem. 3. The algorithm to solve the problem is very clean as well. 4. Most of our work will be spent in proving that it is correct and giving an acceptable bound on the amount of time it takes to terminate with an answer. Opening 4
  • 3. Iris Hui-Ru Jiang Fall 2014 CHAPTER 1 INTRODUCTION IRIS H.-R. JIANG Outline ¨ Content: ¤ Opening: stable matching ¤ Five representative problems ¨ Reading: ¤ Chapter 1 Opening 2 Opening topic Stable Matching 3 Opening IRIS H.-R. JIANG Opening ¨ We start from an algorithmic problem that illustrates many of the themes we will be emphasizing. 1. It is motivated by some very natural and practical concerns. 2. From these, we formulate a clean and simple statement of a problem. 3. The algorithm to solve the problem is very clean as well. 4. Most of our work will be spent in proving that it is correct and giving an acceptable bound on the amount of time it takes to terminate with an answer. Opening 4
  • 4. Iris Hui-Ru Jiang Fall 2014 CHAPTER 1 INTRODUCTION IRIS H.-R. JIANG Outline ¨ Content: ¤ Opening: stable matching ¤ Five representative problems ¨ Reading: ¤ Chapter 1 Opening 2 Opening topic Stable Matching 3 Opening IRIS H.-R. JIANG Opening ¨ We start from an algorithmic problem that illustrates many of the themes we will be emphasizing. 1. It is motivated by some very natural and practical concerns. 2. From these, we formulate a clean and simple statement of a problem. 3. The algorithm to solve the problem is very clean as well. 4. Most of our work will be spent in proving that it is correct and giving an acceptable bound on the amount of time it takes to terminate with an answer. Opening 4
  • 5. IRIS H.-R. JIANG If You Are a Matchmaker… ¨ Imagine you are a matchmaker ¤ One hundred female clients, and one hundred male clients ¤ Each woman has given you a complete list of the hundred men, ordered by her preference: first choice, second choice, and so on ¤ Each man has given you a list of the women, ranked analogously ¤ Your job is to arrange one hundred happy marriages n Neither singlehood nor polygamy n Happy and stable (You don’t want them to divorce or to develop outside relationships Opening 5 IRIS H.-R. JIANG The Stable Matching Problem ¨ Given n men and n women, find a suitable matching ¤ Participants rank members of opposite gender ¤ Each man lists women in order of preference from best to worst ¤ Each woman lists men in order of preference from best to worst Opening 6 favorite least favorite 1st 2nd 3rd Amy Bertha Clare Yancey Xavier Xavier Xavier Yancey Yancey Zeus Zeus Zeus Women’s Preference Profile favorite least favorite 1st 2nd 3rd Xavier Yancey Zeus Amy Bertha Amy Bertha Amy Bertha Clare Clare Clare Men’s Preference Profile IRIS H.-R. JIANG Example (1/2) ¨ Try this way… ¤ Z-A, Y-B, X-C ¨ Q: Is assignment X-C, Y-B, Z-A stable? ¨ A: Opening 7 favorite least favorite 1st 2nd 3rd Xavier Yancey Zeus Amy Bertha Amy Bertha Amy Bertha Clare Clare Clare Men’s Preference Profile favorite least favorite 1st 2nd 3rd Amy Bertha Clare Yancey Xavier Xavier Xavier Yancey Yancey Zeus Zeus Zeus Women’s Preference Profile Bertha Amy Clare Xavier Yancey Zeus IRIS H.-R. JIANG Example (2/2) ¨ Q: Is assignment X-C, Y-B, Z-A stable? ¨ A: No. Bertha and Xavier will hook up. ¨ Q: What has gone wrong? ¨ A: The process is not self-enforcing. Opening 8 favorite least favorite 1st 2nd 3rd Xavier Yancey Zeus Amy Bertha Amy Bertha Amy Bertha Clare Clare Clare Men’s Preference Profile favorite least favorite 1st 2nd 3rd Amy Bertha Clare Yancey Xavier Xavier Xavier Yancey Yancey Zeus Zeus Zeus Women’s Preference Profile Bertha Xavier
  • 6. IRIS H.-R. JIANG If You Are a Matchmaker… ¨ Imagine you are a matchmaker ¤ One hundred female clients, and one hundred male clients ¤ Each woman has given you a complete list of the hundred men, ordered by her preference: first choice, second choice, and so on ¤ Each man has given you a list of the women, ranked analogously ¤ Your job is to arrange one hundred happy marriages n Neither singlehood nor polygamy n Happy and stable (You don’t want them to divorce or to develop outside relationships Opening 5 IRIS H.-R. JIANG The Stable Matching Problem ¨ Given n men and n women, find a suitable matching ¤ Participants rank members of opposite gender ¤ Each man lists women in order of preference from best to worst ¤ Each woman lists men in order of preference from best to worst Opening 6 favorite least favorite 1st 2nd 3rd Amy Bertha Clare Yancey Xavier Xavier Xavier Yancey Yancey Zeus Zeus Zeus Women’s Preference Profile favorite least favorite 1st 2nd 3rd Xavier Yancey Zeus Amy Bertha Amy Bertha Amy Bertha Clare Clare Clare Men’s Preference Profile IRIS H.-R. JIANG Example (1/2) ¨ Try this way… ¤ Z-A, Y-B, X-C ¨ Q: Is assignment X-C, Y-B, Z-A stable? ¨ A: Opening 7 favorite least favorite 1st 2nd 3rd Xavier Yancey Zeus Amy Bertha Amy Bertha Amy Bertha Clare Clare Clare Men’s Preference Profile favorite least favorite 1st 2nd 3rd Amy Bertha Clare Yancey Xavier Xavier Xavier Yancey Yancey Zeus Zeus Zeus Women’s Preference Profile Bertha Amy Clare Xavier Yancey Zeus IRIS H.-R. JIANG Example (2/2) ¨ Q: Is assignment X-C, Y-B, Z-A stable? ¨ A: No. Bertha and Xavier will hook up. ¨ Q: What has gone wrong? ¨ A: The process is not self-enforcing. Opening 8 favorite least favorite 1st 2nd 3rd Xavier Yancey Zeus Amy Bertha Amy Bertha Amy Bertha Clare Clare Clare Men’s Preference Profile favorite least favorite 1st 2nd 3rd Amy Bertha Clare Yancey Xavier Xavier Xavier Yancey Yancey Zeus Zeus Zeus Women’s Preference Profile Bertha Xavier
  • 7. IRIS H.-R. JIANG If You Are a Matchmaker… ¨ Imagine you are a matchmaker ¤ One hundred female clients, and one hundred male clients ¤ Each woman has given you a complete list of the hundred men, ordered by her preference: first choice, second choice, and so on ¤ Each man has given you a list of the women, ranked analogously ¤ Your job is to arrange one hundred happy marriages n Neither singlehood nor polygamy n Happy and stable (You don’t want them to divorce or to develop outside relationships Opening 5 IRIS H.-R. JIANG The Stable Matching Problem ¨ Given n men and n women, find a suitable matching ¤ Participants rank members of opposite gender ¤ Each man lists women in order of preference from best to worst ¤ Each woman lists men in order of preference from best to worst Opening 6 favorite least favorite 1st 2nd 3rd Amy Bertha Clare Yancey Xavier Xavier Xavier Yancey Yancey Zeus Zeus Zeus Women’s Preference Profile favorite least favorite 1st 2nd 3rd Xavier Yancey Zeus Amy Bertha Amy Bertha Amy Bertha Clare Clare Clare Men’s Preference Profile IRIS H.-R. JIANG Example (1/2) ¨ Try this way… ¤ Z-A, Y-B, X-C ¨ Q: Is assignment X-C, Y-B, Z-A stable? ¨ A: Opening 7 favorite least favorite 1st 2nd 3rd Xavier Yancey Zeus Amy Bertha Amy Bertha Amy Bertha Clare Clare Clare Men’s Preference Profile favorite least favorite 1st 2nd 3rd Amy Bertha Clare Yancey Xavier Xavier Xavier Yancey Yancey Zeus Zeus Zeus Women’s Preference Profile Bertha Amy Clare Xavier Yancey Zeus IRIS H.-R. JIANG Example (2/2) ¨ Q: Is assignment X-C, Y-B, Z-A stable? ¨ A: No. Bertha and Xavier will hook up. ¨ Q: What has gone wrong? ¨ A: The process is not self-enforcing. Opening 8 favorite least favorite 1st 2nd 3rd Xavier Yancey Zeus Amy Bertha Amy Bertha Amy Bertha Clare Clare Clare Men’s Preference Profile favorite least favorite 1st 2nd 3rd Amy Bertha Clare Yancey Xavier Xavier Xavier Yancey Yancey Zeus Zeus Zeus Women’s Preference Profile Bertha Xavier
  • 8. IRIS H.-R. JIANG If You Are a Matchmaker… ¨ Imagine you are a matchmaker ¤ One hundred female clients, and one hundred male clients ¤ Each woman has given you a complete list of the hundred men, ordered by her preference: first choice, second choice, and so on ¤ Each man has given you a list of the women, ranked analogously ¤ Your job is to arrange one hundred happy marriages n Neither singlehood nor polygamy n Happy and stable (You don’t want them to divorce or to develop outside relationships Opening 5 IRIS H.-R. JIANG The Stable Matching Problem ¨ Given n men and n women, find a suitable matching ¤ Participants rank members of opposite gender ¤ Each man lists women in order of preference from best to worst ¤ Each woman lists men in order of preference from best to worst Opening 6 favorite least favorite 1st 2nd 3rd Amy Bertha Clare Yancey Xavier Xavier Xavier Yancey Yancey Zeus Zeus Zeus Women’s Preference Profile favorite least favorite 1st 2nd 3rd Xavier Yancey Zeus Amy Bertha Amy Bertha Amy Bertha Clare Clare Clare Men’s Preference Profile IRIS H.-R. JIANG Example (1/2) ¨ Try this way… ¤ Z-A, Y-B, X-C ¨ Q: Is assignment X-C, Y-B, Z-A stable? ¨ A: Opening 7 favorite least favorite 1st 2nd 3rd Xavier Yancey Zeus Amy Bertha Amy Bertha Amy Bertha Clare Clare Clare Men’s Preference Profile favorite least favorite 1st 2nd 3rd Amy Bertha Clare Yancey Xavier Xavier Xavier Yancey Yancey Zeus Zeus Zeus Women’s Preference Profile Bertha Amy Clare Xavier Yancey Zeus IRIS H.-R. JIANG Example (2/2) ¨ Q: Is assignment X-C, Y-B, Z-A stable? ¨ A: No. Bertha and Xavier will hook up. ¨ Q: What has gone wrong? ¨ A: The process is not self-enforcing. Opening 8 favorite least favorite 1st 2nd 3rd Xavier Yancey Zeus Amy Bertha Amy Bertha Amy Bertha Clare Clare Clare Men’s Preference Profile favorite least favorite 1st 2nd 3rd Amy Bertha Clare Yancey Xavier Xavier Xavier Yancey Yancey Zeus Zeus Zeus Women’s Preference Profile Bertha Xavier
  • 9. IRIS H.-R. JIANG The Stable Matching Problem ¨ Perfect matching: Everyone is matched monogamously. ¤ Each man gets exactly one woman ¤ Each woman gets exactly one man ¨ Stability: No incentive for some pair of participants to undermine assignment by joint action. ¤ In matching M, an unmatched pair (m, w) is unstable if man m and woman w prefer each other to current partners. ¤ Unstable pair (m, w) could each improve by eloping. ¨ Stable matching: Perfect matching without unstable pairs. ¨ The stable matching problem: Given the preference lists of n men and n women, find a stable matching if one exists. ¤ The preference lists are complete and have no ties Opening 9 IRIS H.-R. JIANG Simple but Invalid ¨ Random matching and fixing up ¨ Q: Valid? ¨ A: This will NOT work since a loop can occur. Swaps can be made that might continually result in unstable pairs. ¤ Terminate? Opening 10 Simple-But-Invalid 1. Start with some matching 2. while (there is an unstable pair) do 3. Swap mates to make the pair stable IRIS H.-R. JIANG Propose and Reject ¨ Status of each person: free (unmarried) ~ engaged ~ married ¤ Deferred decision making: You may hesitate for a while before you are pretty sure you have got a reasonably good partner ¨ Goal: self-enforcing ¤ [Gale-Shapley 1962] Intuitive method: act in one’s self-interest ¨ Q: Correct? (Stable? or even perfect?) Terminate? Opening 11 Gale-Shapley 1. initialize each person to be free 2. while (some man m is free and hasn't proposed to every woman) do 3. w = highest ranked woman in m's list to whom m has not yet proposed 4. if (w is free) then 5. (m, w) become engaged 6. else if (w prefers m to her fiancé m') then 7. (m, w) become engaged 8. m' become free 9. return the set S of engaged pairs D. Gale and L. S. Shapley. College admissions and the stability of marriage. American Mathematical Monthly, vol. 69, pp. 9-14, 1962. 2012 Nobel Prize in Economics Example of Gale-Shapley Algorithm 12 Opening A flash demo can be found at http://mathsite.math.berkeley.edu/smp/smp.html
  • 10. IRIS H.-R. JIANG The Stable Matching Problem ¨ Perfect matching: Everyone is matched monogamously. ¤ Each man gets exactly one woman ¤ Each woman gets exactly one man ¨ Stability: No incentive for some pair of participants to undermine assignment by joint action. ¤ In matching M, an unmatched pair (m, w) is unstable if man m and woman w prefer each other to current partners. ¤ Unstable pair (m, w) could each improve by eloping. ¨ Stable matching: Perfect matching without unstable pairs. ¨ The stable matching problem: Given the preference lists of n men and n women, find a stable matching if one exists. ¤ The preference lists are complete and have no ties Opening 9 IRIS H.-R. JIANG Simple but Invalid ¨ Random matching and fixing up ¨ Q: Valid? ¨ A: This will NOT work since a loop can occur. Swaps can be made that might continually result in unstable pairs. ¤ Terminate? Opening 10 Simple-But-Invalid 1. Start with some matching 2. while (there is an unstable pair) do 3. Swap mates to make the pair stable IRIS H.-R. JIANG Propose and Reject ¨ Status of each person: free (unmarried) ~ engaged ~ married ¤ Deferred decision making: You may hesitate for a while before you are pretty sure you have got a reasonably good partner ¨ Goal: self-enforcing ¤ [Gale-Shapley 1962] Intuitive method: act in one’s self-interest ¨ Q: Correct? (Stable? or even perfect?) Terminate? Opening 11 Gale-Shapley 1. initialize each person to be free 2. while (some man m is free and hasn't proposed to every woman) do 3. w = highest ranked woman in m's list to whom m has not yet proposed 4. if (w is free) then 5. (m, w) become engaged 6. else if (w prefers m to her fiancé m') then 7. (m, w) become engaged 8. m' become free 9. return the set S of engaged pairs D. Gale and L. S. Shapley. College admissions and the stability of marriage. American Mathematical Monthly, vol. 69, pp. 9-14, 1962. 2012 Nobel Prize in Economics Example of Gale-Shapley Algorithm 12 Opening A flash demo can be found at http://mathsite.math.berkeley.edu/smp/smp.html
  • 11. IRIS H.-R. JIANG The Stable Matching Problem ¨ Perfect matching: Everyone is matched monogamously. ¤ Each man gets exactly one woman ¤ Each woman gets exactly one man ¨ Stability: No incentive for some pair of participants to undermine assignment by joint action. ¤ In matching M, an unmatched pair (m, w) is unstable if man m and woman w prefer each other to current partners. ¤ Unstable pair (m, w) could each improve by eloping. ¨ Stable matching: Perfect matching without unstable pairs. ¨ The stable matching problem: Given the preference lists of n men and n women, find a stable matching if one exists. ¤ The preference lists are complete and have no ties Opening 9 IRIS H.-R. JIANG Simple but Invalid ¨ Random matching and fixing up ¨ Q: Valid? ¨ A: This will NOT work since a loop can occur. Swaps can be made that might continually result in unstable pairs. ¤ Terminate? Opening 10 Simple-But-Invalid 1. Start with some matching 2. while (there is an unstable pair) do 3. Swap mates to make the pair stable IRIS H.-R. JIANG Propose and Reject ¨ Status of each person: free (unmarried) ~ engaged ~ married ¤ Deferred decision making: You may hesitate for a while before you are pretty sure you have got a reasonably good partner ¨ Goal: self-enforcing ¤ [Gale-Shapley 1962] Intuitive method: act in one’s self-interest ¨ Q: Correct? (Stable? or even perfect?) Terminate? Opening 11 Gale-Shapley 1. initialize each person to be free 2. while (some man m is free and hasn't proposed to every woman) do 3. w = highest ranked woman in m's list to whom m has not yet proposed 4. if (w is free) then 5. (m, w) become engaged 6. else if (w prefers m to her fiancé m') then 7. (m, w) become engaged 8. m' become free 9. return the set S of engaged pairs D. Gale and L. S. Shapley. College admissions and the stability of marriage. American Mathematical Monthly, vol. 69, pp. 9-14, 1962. 2012 Nobel Prize in Economics Example of Gale-Shapley Algorithm 12 Opening A flash demo can be found at http://mathsite.math.berkeley.edu/smp/smp.html
  • 12. IRIS H.-R. JIANG The Stable Matching Problem ¨ Perfect matching: Everyone is matched monogamously. ¤ Each man gets exactly one woman ¤ Each woman gets exactly one man ¨ Stability: No incentive for some pair of participants to undermine assignment by joint action. ¤ In matching M, an unmatched pair (m, w) is unstable if man m and woman w prefer each other to current partners. ¤ Unstable pair (m, w) could each improve by eloping. ¨ Stable matching: Perfect matching without unstable pairs. ¨ The stable matching problem: Given the preference lists of n men and n women, find a stable matching if one exists. ¤ The preference lists are complete and have no ties Opening 9 IRIS H.-R. JIANG Simple but Invalid ¨ Random matching and fixing up ¨ Q: Valid? ¨ A: This will NOT work since a loop can occur. Swaps can be made that might continually result in unstable pairs. ¤ Terminate? Opening 10 Simple-But-Invalid 1. Start with some matching 2. while (there is an unstable pair) do 3. Swap mates to make the pair stable IRIS H.-R. JIANG Propose and Reject ¨ Status of each person: free (unmarried) ~ engaged ~ married ¤ Deferred decision making: You may hesitate for a while before you are pretty sure you have got a reasonably good partner ¨ Goal: self-enforcing ¤ [Gale-Shapley 1962] Intuitive method: act in one’s self-interest ¨ Q: Correct? (Stable? or even perfect?) Terminate? Opening 11 Gale-Shapley 1. initialize each person to be free 2. while (some man m is free and hasn't proposed to every woman) do 3. w = highest ranked woman in m's list to whom m has not yet proposed 4. if (w is free) then 5. (m, w) become engaged 6. else if (w prefers m to her fiancé m') then 7. (m, w) become engaged 8. m' become free 9. return the set S of engaged pairs D. Gale and L. S. Shapley. College admissions and the stability of marriage. American Mathematical Monthly, vol. 69, pp. 9-14, 1962. 2012 Nobel Prize in Economics Example of Gale-Shapley Algorithm 12 Opening A flash demo can be found at http://mathsite.math.berkeley.edu/smp/smp.html
  • 13. Five Representative Problems 13 Opening IRIS H.-R. JIANG Interval Scheduling ¨ Given: Set of jobs with start times and finish times ¨ Goal: Find maximum cardinality subset of mutually compatible jobs Opening 14 jobs don’t overlap Time 0 1 2 3 4 5 6 7 8 9 10 11 f g h e a b c d h e b Maximum compatible set {b, e, h} IRIS H.-R. JIANG Weighted Interval Scheduling ¨ Given: Set of jobs with start times, finish times, and weights ¨ Goal: Find maximum weight subset of mutually compatible jobs Opening 15 Time 0 1 2 3 4 5 6 7 8 9 10 11 20 11 16 13 23 12 20 26 16 26 Maximum weighted compatible set {26, 16} IRIS H.-R. JIANG Bipartite Matching ¨ Given: Bipartite graph ¨ Goal: Find maximum cardinality matching Opening 16 1 2 3 4 5 A B C D E Maximum matching {(A, 1), (B, 2), (C, 4), (D, 3), (E, 5)}
  • 14. Five Representative Problems 13 Opening IRIS H.-R. JIANG Interval Scheduling ¨ Given: Set of jobs with start times and finish times ¨ Goal: Find maximum cardinality subset of mutually compatible jobs Opening 14 jobs don’t overlap Time 0 1 2 3 4 5 6 7 8 9 10 11 f g h e a b c d h e b Maximum compatible set {b, e, h} IRIS H.-R. JIANG Weighted Interval Scheduling ¨ Given: Set of jobs with start times, finish times, and weights ¨ Goal: Find maximum weight subset of mutually compatible jobs Opening 15 Time 0 1 2 3 4 5 6 7 8 9 10 11 20 11 16 13 23 12 20 26 16 26 Maximum weighted compatible set {26, 16} IRIS H.-R. JIANG Bipartite Matching ¨ Given: Bipartite graph ¨ Goal: Find maximum cardinality matching Opening 16 1 2 3 4 5 A B C D E Maximum matching {(A, 1), (B, 2), (C, 4), (D, 3), (E, 5)}
  • 15. Five Representative Problems 13 Opening IRIS H.-R. JIANG Interval Scheduling ¨ Given: Set of jobs with start times and finish times ¨ Goal: Find maximum cardinality subset of mutually compatible jobs Opening 14 jobs don’t overlap Time 0 1 2 3 4 5 6 7 8 9 10 11 f g h e a b c d h e b Maximum compatible set {b, e, h} IRIS H.-R. JIANG Weighted Interval Scheduling ¨ Given: Set of jobs with start times, finish times, and weights ¨ Goal: Find maximum weight subset of mutually compatible jobs Opening 15 Time 0 1 2 3 4 5 6 7 8 9 10 11 20 11 16 13 23 12 20 26 16 26 Maximum weighted compatible set {26, 16} IRIS H.-R. JIANG Bipartite Matching ¨ Given: Bipartite graph ¨ Goal: Find maximum cardinality matching Opening 16 1 2 3 4 5 A B C D E Maximum matching {(A, 1), (B, 2), (C, 4), (D, 3), (E, 5)}
  • 16. Five Representative Problems 13 Opening IRIS H.-R. JIANG Interval Scheduling ¨ Given: Set of jobs with start times and finish times ¨ Goal: Find maximum cardinality subset of mutually compatible jobs Opening 14 jobs don’t overlap Time 0 1 2 3 4 5 6 7 8 9 10 11 f g h e a b c d h e b Maximum compatible set {b, e, h} IRIS H.-R. JIANG Weighted Interval Scheduling ¨ Given: Set of jobs with start times, finish times, and weights ¨ Goal: Find maximum weight subset of mutually compatible jobs Opening 15 Time 0 1 2 3 4 5 6 7 8 9 10 11 20 11 16 13 23 12 20 26 16 26 Maximum weighted compatible set {26, 16} IRIS H.-R. JIANG Bipartite Matching ¨ Given: Bipartite graph ¨ Goal: Find maximum cardinality matching Opening 16 1 2 3 4 5 A B C D E Maximum matching {(A, 1), (B, 2), (C, 4), (D, 3), (E, 5)}
  • 17. IRIS H.-R. JIANG Independent Set ¨ Given: Graph ¨ Goal: Find maximum cardinality independent set Opening 17 subset of nodes s.t. no two joined by an edge 1 2 3 4 5 6 7 1 4 5 6 Maximum independent set {1, 4, 5, 6} IRIS H.-R. JIANG Competitive Facility Location ¨ Given: Graph with weight on each node ¨ Game: ¤ Two competing players alternate in selecting nodes ¤ Do not allow to select a node if any of its neighbors have been selected ¨ Goal: Select a maximum weight subset of nodes Opening 18 Second player can guarantee 20, but not 25 10 5 1 5 15 1 5 1 10 15 IRIS H.-R. JIANG Five Representative Problems ¨ Efficiently solvable ¤ Interval scheduling: nlogn greedy algorithm ¤ Weighted interval scheduling: nlogn dynamic programming algorithm ¤ Bipartite matching: nk max-flow based algorithm ¨ Hard ¤ Independent set: NP-complete ¤ Competitive facility location: PSPACE-complete (even harder!) Opening 19 Proofs Back to Stable Matching 20 Opening
  • 18. IRIS H.-R. JIANG Independent Set ¨ Given: Graph ¨ Goal: Find maximum cardinality independent set Opening 17 subset of nodes s.t. no two joined by an edge 1 2 3 4 5 6 7 1 4 5 6 Maximum independent set {1, 4, 5, 6} IRIS H.-R. JIANG Competitive Facility Location ¨ Given: Graph with weight on each node ¨ Game: ¤ Two competing players alternate in selecting nodes ¤ Do not allow to select a node if any of its neighbors have been selected ¨ Goal: Select a maximum weight subset of nodes Opening 18 Second player can guarantee 20, but not 25 10 5 1 5 15 1 5 1 10 15 IRIS H.-R. JIANG Five Representative Problems ¨ Efficiently solvable ¤ Interval scheduling: nlogn greedy algorithm ¤ Weighted interval scheduling: nlogn dynamic programming algorithm ¤ Bipartite matching: nk max-flow based algorithm ¨ Hard ¤ Independent set: NP-complete ¤ Competitive facility location: PSPACE-complete (even harder!) Opening 19 Proofs Back to Stable Matching 20 Opening
  • 19. IRIS H.-R. JIANG Independent Set ¨ Given: Graph ¨ Goal: Find maximum cardinality independent set Opening 17 subset of nodes s.t. no two joined by an edge 1 2 3 4 5 6 7 1 4 5 6 Maximum independent set {1, 4, 5, 6} IRIS H.-R. JIANG Competitive Facility Location ¨ Given: Graph with weight on each node ¨ Game: ¤ Two competing players alternate in selecting nodes ¤ Do not allow to select a node if any of its neighbors have been selected ¨ Goal: Select a maximum weight subset of nodes Opening 18 Second player can guarantee 20, but not 25 10 5 1 5 15 1 5 1 10 15 IRIS H.-R. JIANG Five Representative Problems ¨ Efficiently solvable ¤ Interval scheduling: nlogn greedy algorithm ¤ Weighted interval scheduling: nlogn dynamic programming algorithm ¤ Bipartite matching: nk max-flow based algorithm ¨ Hard ¤ Independent set: NP-complete ¤ Competitive facility location: PSPACE-complete (even harder!) Opening 19 Proofs Back to Stable Matching 20 Opening
  • 20. IRIS H.-R. JIANG Independent Set ¨ Given: Graph ¨ Goal: Find maximum cardinality independent set Opening 17 subset of nodes s.t. no two joined by an edge 1 2 3 4 5 6 7 1 4 5 6 Maximum independent set {1, 4, 5, 6} IRIS H.-R. JIANG Competitive Facility Location ¨ Given: Graph with weight on each node ¨ Game: ¤ Two competing players alternate in selecting nodes ¤ Do not allow to select a node if any of its neighbors have been selected ¨ Goal: Select a maximum weight subset of nodes Opening 18 Second player can guarantee 20, but not 25 10 5 1 5 15 1 5 1 10 15 IRIS H.-R. JIANG Five Representative Problems ¨ Efficiently solvable ¤ Interval scheduling: nlogn greedy algorithm ¤ Weighted interval scheduling: nlogn dynamic programming algorithm ¤ Bipartite matching: nk max-flow based algorithm ¨ Hard ¤ Independent set: NP-complete ¤ Competitive facility location: PSPACE-complete (even harder!) Opening 19 Proofs Back to Stable Matching 20 Opening
  • 21. IRIS H.-R. JIANG Formulating the Problem ¨ The stable matching problem ¨ Given: ¤ M: n men ¤ W: n women ¤ M x W: Each person has ranked all members of the opposite sex with a unique number between 1 and n in order of preference ¨ Goal: ¤ Marry the men and women off such that ¤ There are no two people of opposite sex who would both rather have each other than their current partners. n If there are no such people, all the marriages are stable. Opening 21 Clean! IRIS H.-R. JIANG Designing the Algorithm ¨ Correctness: ¤ Termination: G-S terminates after at most n2 iterations. ¤ Perfection: Everyone gets married. ¤ Stability: The marriages are stable. ¨ Male-optimal and female-pessimal ¨ All executions yield the same matching Opening 22 Clean! Gale-Shapley 1. initialize each person to be free 2. while (some man m is free and hasn't proposed to every woman) do 3. w = highest ranked woman in m's list to whom m has not yet proposed 4. if (w is free) then 5. (m, w) become engaged 6. else if (w prefers m to her fiancé m') then 7. (m, w) become engaged 8. m' become free 9. return the set S of engaged pairs IRIS H.-R. JIANG Correctness: Termination ¨ G-S terminates after at most n2 iterations of the while loop. ¨ Pf: ¤ At each iteration, a man proposes to a new woman. ¤ There are only n2 possible proposals. ¨ Observation 1: The sequence of women to whom m proposes gets worse and worse. ¨ Observation 2: Once a woman w receives her first proposal, w remains engaged; she only trades up. Opening 23 1st 2nd 3rd Xavier Yancey Zeus Amy Bertha Amy Bertha Amy Bertha Clare Clare Clare Men’s Preference Profile 1st 2nd 3rd Amy Bertha Clare Yancey Xavier Xavier Xavier Yancey Yancey Zeus Zeus Zeus Women’s Preference Profile Bertha Amy Clare Xavier Yancey Zeus Amy Bertha Zeus Zeus Don’t count free people IRIS H.-R. JIANG Correctness: Perfection ¨ The set S returned at termination is perfect matching. ¤ i.e., all men get married ¤ Prove by contradiction! ¨ Pf: ¤ Suppose that G-S algorithm terminates with a free man m. ¤ At termination, m had already proposed to every woman. Otherwise, the while loop would not have exited. ¤ Since there is a free man m, there must be at least a free woman, say w. w was never proposed to. ¤ This contradicts that m had already proposed to every woman. Opening 24 Gale-Shapley 1. initialize each person to be free 2. while (some man m is free and hasn't proposed to every woman) do 3. w = highest ranked woman in m's list to whom m has not yet proposed 4. if (w is free) then 5. (m, w) become engaged 6. else if (w prefers m to her fiancé m') then 7. (m, w) become engaged 8. m' become free 9. return the set S of engaged pairs
  • 22. IRIS H.-R. JIANG Formulating the Problem ¨ The stable matching problem ¨ Given: ¤ M: n men ¤ W: n women ¤ M x W: Each person has ranked all members of the opposite sex with a unique number between 1 and n in order of preference ¨ Goal: ¤ Marry the men and women off such that ¤ There are no two people of opposite sex who would both rather have each other than their current partners. n If there are no such people, all the marriages are stable. Opening 21 Clean! IRIS H.-R. JIANG Designing the Algorithm ¨ Correctness: ¤ Termination: G-S terminates after at most n2 iterations. ¤ Perfection: Everyone gets married. ¤ Stability: The marriages are stable. ¨ Male-optimal and female-pessimal ¨ All executions yield the same matching Opening 22 Clean! Gale-Shapley 1. initialize each person to be free 2. while (some man m is free and hasn't proposed to every woman) do 3. w = highest ranked woman in m's list to whom m has not yet proposed 4. if (w is free) then 5. (m, w) become engaged 6. else if (w prefers m to her fiancé m') then 7. (m, w) become engaged 8. m' become free 9. return the set S of engaged pairs IRIS H.-R. JIANG Correctness: Termination ¨ G-S terminates after at most n2 iterations of the while loop. ¨ Pf: ¤ At each iteration, a man proposes to a new woman. ¤ There are only n2 possible proposals. ¨ Observation 1: The sequence of women to whom m proposes gets worse and worse. ¨ Observation 2: Once a woman w receives her first proposal, w remains engaged; she only trades up. Opening 23 1st 2nd 3rd Xavier Yancey Zeus Amy Bertha Amy Bertha Amy Bertha Clare Clare Clare Men’s Preference Profile 1st 2nd 3rd Amy Bertha Clare Yancey Xavier Xavier Xavier Yancey Yancey Zeus Zeus Zeus Women’s Preference Profile Bertha Amy Clare Xavier Yancey Zeus Amy Bertha Zeus Zeus Don’t count free people IRIS H.-R. JIANG Correctness: Perfection ¨ The set S returned at termination is perfect matching. ¤ i.e., all men get married ¤ Prove by contradiction! ¨ Pf: ¤ Suppose that G-S algorithm terminates with a free man m. ¤ At termination, m had already proposed to every woman. Otherwise, the while loop would not have exited. ¤ Since there is a free man m, there must be at least a free woman, say w. w was never proposed to. ¤ This contradicts that m had already proposed to every woman. Opening 24 Gale-Shapley 1. initialize each person to be free 2. while (some man m is free and hasn't proposed to every woman) do 3. w = highest ranked woman in m's list to whom m has not yet proposed 4. if (w is free) then 5. (m, w) become engaged 6. else if (w prefers m to her fiancé m') then 7. (m, w) become engaged 8. m' become free 9. return the set S of engaged pairs
  • 23. IRIS H.-R. JIANG Formulating the Problem ¨ The stable matching problem ¨ Given: ¤ M: n men ¤ W: n women ¤ M x W: Each person has ranked all members of the opposite sex with a unique number between 1 and n in order of preference ¨ Goal: ¤ Marry the men and women off such that ¤ There are no two people of opposite sex who would both rather have each other than their current partners. n If there are no such people, all the marriages are stable. Opening 21 Clean! IRIS H.-R. JIANG Designing the Algorithm ¨ Correctness: ¤ Termination: G-S terminates after at most n2 iterations. ¤ Perfection: Everyone gets married. ¤ Stability: The marriages are stable. ¨ Male-optimal and female-pessimal ¨ All executions yield the same matching Opening 22 Clean! Gale-Shapley 1. initialize each person to be free 2. while (some man m is free and hasn't proposed to every woman) do 3. w = highest ranked woman in m's list to whom m has not yet proposed 4. if (w is free) then 5. (m, w) become engaged 6. else if (w prefers m to her fiancé m') then 7. (m, w) become engaged 8. m' become free 9. return the set S of engaged pairs IRIS H.-R. JIANG Correctness: Termination ¨ G-S terminates after at most n2 iterations of the while loop. ¨ Pf: ¤ At each iteration, a man proposes to a new woman. ¤ There are only n2 possible proposals. ¨ Observation 1: The sequence of women to whom m proposes gets worse and worse. ¨ Observation 2: Once a woman w receives her first proposal, w remains engaged; she only trades up. Opening 23 1st 2nd 3rd Xavier Yancey Zeus Amy Bertha Amy Bertha Amy Bertha Clare Clare Clare Men’s Preference Profile 1st 2nd 3rd Amy Bertha Clare Yancey Xavier Xavier Xavier Yancey Yancey Zeus Zeus Zeus Women’s Preference Profile Bertha Amy Clare Xavier Yancey Zeus Amy Bertha Zeus Zeus Don’t count free people IRIS H.-R. JIANG Correctness: Perfection ¨ The set S returned at termination is perfect matching. ¤ i.e., all men get married ¤ Prove by contradiction! ¨ Pf: ¤ Suppose that G-S algorithm terminates with a free man m. ¤ At termination, m had already proposed to every woman. Otherwise, the while loop would not have exited. ¤ Since there is a free man m, there must be at least a free woman, say w. w was never proposed to. ¤ This contradicts that m had already proposed to every woman. Opening 24 Gale-Shapley 1. initialize each person to be free 2. while (some man m is free and hasn't proposed to every woman) do 3. w = highest ranked woman in m's list to whom m has not yet proposed 4. if (w is free) then 5. (m, w) become engaged 6. else if (w prefers m to her fiancé m') then 7. (m, w) become engaged 8. m' become free 9. return the set S of engaged pairs
  • 24. IRIS H.-R. JIANG Formulating the Problem ¨ The stable matching problem ¨ Given: ¤ M: n men ¤ W: n women ¤ M x W: Each person has ranked all members of the opposite sex with a unique number between 1 and n in order of preference ¨ Goal: ¤ Marry the men and women off such that ¤ There are no two people of opposite sex who would both rather have each other than their current partners. n If there are no such people, all the marriages are stable. Opening 21 Clean! IRIS H.-R. JIANG Designing the Algorithm ¨ Correctness: ¤ Termination: G-S terminates after at most n2 iterations. ¤ Perfection: Everyone gets married. ¤ Stability: The marriages are stable. ¨ Male-optimal and female-pessimal ¨ All executions yield the same matching Opening 22 Clean! Gale-Shapley 1. initialize each person to be free 2. while (some man m is free and hasn't proposed to every woman) do 3. w = highest ranked woman in m's list to whom m has not yet proposed 4. if (w is free) then 5. (m, w) become engaged 6. else if (w prefers m to her fiancé m') then 7. (m, w) become engaged 8. m' become free 9. return the set S of engaged pairs IRIS H.-R. JIANG Correctness: Termination ¨ G-S terminates after at most n2 iterations of the while loop. ¨ Pf: ¤ At each iteration, a man proposes to a new woman. ¤ There are only n2 possible proposals. ¨ Observation 1: The sequence of women to whom m proposes gets worse and worse. ¨ Observation 2: Once a woman w receives her first proposal, w remains engaged; she only trades up. Opening 23 1st 2nd 3rd Xavier Yancey Zeus Amy Bertha Amy Bertha Amy Bertha Clare Clare Clare Men’s Preference Profile 1st 2nd 3rd Amy Bertha Clare Yancey Xavier Xavier Xavier Yancey Yancey Zeus Zeus Zeus Women’s Preference Profile Bertha Amy Clare Xavier Yancey Zeus Amy Bertha Zeus Zeus Don’t count free people IRIS H.-R. JIANG Correctness: Perfection ¨ The set S returned at termination is perfect matching. ¤ i.e., all men get married ¤ Prove by contradiction! ¨ Pf: ¤ Suppose that G-S algorithm terminates with a free man m. ¤ At termination, m had already proposed to every woman. Otherwise, the while loop would not have exited. ¤ Since there is a free man m, there must be at least a free woman, say w. w was never proposed to. ¤ This contradicts that m had already proposed to every woman. Opening 24 Gale-Shapley 1. initialize each person to be free 2. while (some man m is free and hasn't proposed to every woman) do 3. w = highest ranked woman in m's list to whom m has not yet proposed 4. if (w is free) then 5. (m, w) become engaged 6. else if (w prefers m to her fiancé m') then 7. (m, w) become engaged 8. m' become free 9. return the set S of engaged pairs
  • 25. IRIS H.-R. JIANG Correctness: Stability ¨ Consider an execution returns S. Set S is a stable matching. ¤ Assume an instability w.r.t. S and obtain a contradiction. ¨ Pf. ¤ This instability involve two pairs, (m, w) and (m', w'), in S with n m prefers w' to w n w' prefers m to m' ¤ In the execution, m’s last proposal was w. ¤ Did m propose to w' at some earlier point? n Case 1: No. n m must prefers w to w'. ®¬ n Case 2: Yes. n m was rejected by w' because of m'', w' prefers m'' to m n m'' = m' (final partner) ®¬ n w' prefers her final partner m' to m'' ®¬ Opening 25 w m m' w' IRIS H.-R. JIANG Uniqueness? ¨ Q: For a given instance, is stable matching is unique? ¨ A: Opening 26 1st 2nd 3rd Xavier Yancey Zeus Amy Bertha Amy Bertha Amy Bertha Clare Clare Clare Men’s Preference Profile 1st 2nd 3rd Amy Bertha Clare Yancey Xavier Xavier Xavier Yancey Yancey Zeus Zeus Zeus Women’s Preference Profile Bertha Amy Clare Xavier Yancey Zeus 1st 2nd 3rd Xavier Yancey Zeus Amy Bertha Amy Bertha Amy Bertha Clare Clare Clare Men’s Preference Profile 1st 2nd 3rd Amy Bertha Clare Yancey Xavier Xavier Xavier Yancey Yancey Zeus Zeus Zeus Women’s Preference Profile Bertha Amy Clare Xavier Yancey Zeus IRIS H.-R. JIANG Male-Optimality ¨ S* = {(m, best(m)): m Î M}: best possible outcome for all men ¤ w Î W is a valid partner of a man m if there is a stable matching that contains the pair (m, w) ¤ w = best(m): best valid partner of m if w is a valid partner of m and no woman whom m ranks higher than w is m’s valid partner ¨ Every execution of G-S algorithm results in the set S* ¤ Male-optimal (and female-pessimal) ¤ The same matching for all executions Opening 27 1st 2nd 3rd Xavier Yancey Zeus Amy Bertha Clare Bertha Amy Bertha Clare Clare Amy Men’s Preference Profile 1st 2nd 3rd Amy Bertha Clare Yancey Xavier Xavier Zeus Zeus Yancey Xavier Yancey Zeus Women’s Preference Profile Bertha Amy Clare Xavier Yancey Zeus IRIS H.-R. JIANG Male-Optimality ¨ G-S algorithm results in the set S* ¤ Again, by contradiction! ¨ Pf. ¤ Suppose some execution E of G-S yields S where some man is paired with someone other than his best valid partner. ¤ Since men propose in decreasing order of preference Þ some man is rejected by a valid partner during E. n Let m be first such man & w be first valid woman who rejects m n w = best(m) n By definition, there is a stable matching S' containing (m, w). ¤ In E, m was rejected by w because of m' Þ w prefers m' to m ¤ Assume (m', w') Î S', w' ¹ w. (w' is a valid partner of m') ¤ In E, (m, w) is the first rejection of a valid pair ¤ m' hadn’t been rejected by any valid partner when m' is engaged to w in E. ¤ m' proposed in decreasing order of preference (those women ranked before w are invalid). ¤ And w' is a valid partner of m' Þ m' must prefer w to w' ¤ Since (m', w) Ï S', it follows that (m', w) is an instability in S'. ®¬ Opening 28 w m m' w' S' S'
  • 26. IRIS H.-R. JIANG Correctness: Stability ¨ Consider an execution returns S. Set S is a stable matching. ¤ Assume an instability w.r.t. S and obtain a contradiction. ¨ Pf. ¤ This instability involve two pairs, (m, w) and (m', w'), in S with n m prefers w' to w n w' prefers m to m' ¤ In the execution, m’s last proposal was w. ¤ Did m propose to w' at some earlier point? n Case 1: No. n m must prefers w to w'. ®¬ n Case 2: Yes. n m was rejected by w' because of m'', w' prefers m'' to m n m'' = m' (final partner) ®¬ n w' prefers her final partner m' to m'' ®¬ Opening 25 w m m' w' IRIS H.-R. JIANG Uniqueness? ¨ Q: For a given instance, is stable matching is unique? ¨ A: Opening 26 1st 2nd 3rd Xavier Yancey Zeus Amy Bertha Amy Bertha Amy Bertha Clare Clare Clare Men’s Preference Profile 1st 2nd 3rd Amy Bertha Clare Yancey Xavier Xavier Xavier Yancey Yancey Zeus Zeus Zeus Women’s Preference Profile Bertha Amy Clare Xavier Yancey Zeus 1st 2nd 3rd Xavier Yancey Zeus Amy Bertha Amy Bertha Amy Bertha Clare Clare Clare Men’s Preference Profile 1st 2nd 3rd Amy Bertha Clare Yancey Xavier Xavier Xavier Yancey Yancey Zeus Zeus Zeus Women’s Preference Profile Bertha Amy Clare Xavier Yancey Zeus IRIS H.-R. JIANG Male-Optimality ¨ S* = {(m, best(m)): m Î M}: best possible outcome for all men ¤ w Î W is a valid partner of a man m if there is a stable matching that contains the pair (m, w) ¤ w = best(m): best valid partner of m if w is a valid partner of m and no woman whom m ranks higher than w is m’s valid partner ¨ Every execution of G-S algorithm results in the set S* ¤ Male-optimal (and female-pessimal) ¤ The same matching for all executions Opening 27 1st 2nd 3rd Xavier Yancey Zeus Amy Bertha Clare Bertha Amy Bertha Clare Clare Amy Men’s Preference Profile 1st 2nd 3rd Amy Bertha Clare Yancey Xavier Xavier Zeus Zeus Yancey Xavier Yancey Zeus Women’s Preference Profile Bertha Amy Clare Xavier Yancey Zeus IRIS H.-R. JIANG Male-Optimality ¨ G-S algorithm results in the set S* ¤ Again, by contradiction! ¨ Pf. ¤ Suppose some execution E of G-S yields S where some man is paired with someone other than his best valid partner. ¤ Since men propose in decreasing order of preference Þ some man is rejected by a valid partner during E. n Let m be first such man & w be first valid woman who rejects m n w = best(m) n By definition, there is a stable matching S' containing (m, w). ¤ In E, m was rejected by w because of m' Þ w prefers m' to m ¤ Assume (m', w') Î S', w' ¹ w. (w' is a valid partner of m') ¤ In E, (m, w) is the first rejection of a valid pair ¤ m' hadn’t been rejected by any valid partner when m' is engaged to w in E. ¤ m' proposed in decreasing order of preference (those women ranked before w are invalid). ¤ And w' is a valid partner of m' Þ m' must prefer w to w' ¤ Since (m', w) Ï S', it follows that (m', w) is an instability in S'. ®¬ Opening 28 w m m' w' S' S'
  • 27. IRIS H.-R. JIANG Correctness: Stability ¨ Consider an execution returns S. Set S is a stable matching. ¤ Assume an instability w.r.t. S and obtain a contradiction. ¨ Pf. ¤ This instability involve two pairs, (m, w) and (m', w'), in S with n m prefers w' to w n w' prefers m to m' ¤ In the execution, m’s last proposal was w. ¤ Did m propose to w' at some earlier point? n Case 1: No. n m must prefers w to w'. ®¬ n Case 2: Yes. n m was rejected by w' because of m'', w' prefers m'' to m n m'' = m' (final partner) ®¬ n w' prefers her final partner m' to m'' ®¬ Opening 25 w m m' w' IRIS H.-R. JIANG Uniqueness? ¨ Q: For a given instance, is stable matching is unique? ¨ A: Opening 26 1st 2nd 3rd Xavier Yancey Zeus Amy Bertha Amy Bertha Amy Bertha Clare Clare Clare Men’s Preference Profile 1st 2nd 3rd Amy Bertha Clare Yancey Xavier Xavier Xavier Yancey Yancey Zeus Zeus Zeus Women’s Preference Profile Bertha Amy Clare Xavier Yancey Zeus 1st 2nd 3rd Xavier Yancey Zeus Amy Bertha Amy Bertha Amy Bertha Clare Clare Clare Men’s Preference Profile 1st 2nd 3rd Amy Bertha Clare Yancey Xavier Xavier Xavier Yancey Yancey Zeus Zeus Zeus Women’s Preference Profile Bertha Amy Clare Xavier Yancey Zeus IRIS H.-R. JIANG Male-Optimality ¨ S* = {(m, best(m)): m Î M}: best possible outcome for all men ¤ w Î W is a valid partner of a man m if there is a stable matching that contains the pair (m, w) ¤ w = best(m): best valid partner of m if w is a valid partner of m and no woman whom m ranks higher than w is m’s valid partner ¨ Every execution of G-S algorithm results in the set S* ¤ Male-optimal (and female-pessimal) ¤ The same matching for all executions Opening 27 1st 2nd 3rd Xavier Yancey Zeus Amy Bertha Clare Bertha Amy Bertha Clare Clare Amy Men’s Preference Profile 1st 2nd 3rd Amy Bertha Clare Yancey Xavier Xavier Zeus Zeus Yancey Xavier Yancey Zeus Women’s Preference Profile Bertha Amy Clare Xavier Yancey Zeus IRIS H.-R. JIANG Male-Optimality ¨ G-S algorithm results in the set S* ¤ Again, by contradiction! ¨ Pf. ¤ Suppose some execution E of G-S yields S where some man is paired with someone other than his best valid partner. ¤ Since men propose in decreasing order of preference Þ some man is rejected by a valid partner during E. n Let m be first such man & w be first valid woman who rejects m n w = best(m) n By definition, there is a stable matching S' containing (m, w). ¤ In E, m was rejected by w because of m' Þ w prefers m' to m ¤ Assume (m', w') Î S', w' ¹ w. (w' is a valid partner of m') ¤ In E, (m, w) is the first rejection of a valid pair ¤ m' hadn’t been rejected by any valid partner when m' is engaged to w in E. ¤ m' proposed in decreasing order of preference (those women ranked before w are invalid). ¤ And w' is a valid partner of m' Þ m' must prefer w to w' ¤ Since (m', w) Ï S', it follows that (m', w) is an instability in S'. ®¬ Opening 28 w m m' w' S' S'
  • 28. IRIS H.-R. JIANG Correctness: Stability ¨ Consider an execution returns S. Set S is a stable matching. ¤ Assume an instability w.r.t. S and obtain a contradiction. ¨ Pf. ¤ This instability involve two pairs, (m, w) and (m', w'), in S with n m prefers w' to w n w' prefers m to m' ¤ In the execution, m’s last proposal was w. ¤ Did m propose to w' at some earlier point? n Case 1: No. n m must prefers w to w'. ®¬ n Case 2: Yes. n m was rejected by w' because of m'', w' prefers m'' to m n m'' = m' (final partner) ®¬ n w' prefers her final partner m' to m'' ®¬ Opening 25 w m m' w' IRIS H.-R. JIANG Uniqueness? ¨ Q: For a given instance, is stable matching is unique? ¨ A: Opening 26 1st 2nd 3rd Xavier Yancey Zeus Amy Bertha Amy Bertha Amy Bertha Clare Clare Clare Men’s Preference Profile 1st 2nd 3rd Amy Bertha Clare Yancey Xavier Xavier Xavier Yancey Yancey Zeus Zeus Zeus Women’s Preference Profile Bertha Amy Clare Xavier Yancey Zeus 1st 2nd 3rd Xavier Yancey Zeus Amy Bertha Amy Bertha Amy Bertha Clare Clare Clare Men’s Preference Profile 1st 2nd 3rd Amy Bertha Clare Yancey Xavier Xavier Xavier Yancey Yancey Zeus Zeus Zeus Women’s Preference Profile Bertha Amy Clare Xavier Yancey Zeus IRIS H.-R. JIANG Male-Optimality ¨ S* = {(m, best(m)): m Î M}: best possible outcome for all men ¤ w Î W is a valid partner of a man m if there is a stable matching that contains the pair (m, w) ¤ w = best(m): best valid partner of m if w is a valid partner of m and no woman whom m ranks higher than w is m’s valid partner ¨ Every execution of G-S algorithm results in the set S* ¤ Male-optimal (and female-pessimal) ¤ The same matching for all executions Opening 27 1st 2nd 3rd Xavier Yancey Zeus Amy Bertha Clare Bertha Amy Bertha Clare Clare Amy Men’s Preference Profile 1st 2nd 3rd Amy Bertha Clare Yancey Xavier Xavier Zeus Zeus Yancey Xavier Yancey Zeus Women’s Preference Profile Bertha Amy Clare Xavier Yancey Zeus IRIS H.-R. JIANG Male-Optimality ¨ G-S algorithm results in the set S* ¤ Again, by contradiction! ¨ Pf. ¤ Suppose some execution E of G-S yields S where some man is paired with someone other than his best valid partner. ¤ Since men propose in decreasing order of preference Þ some man is rejected by a valid partner during E. n Let m be first such man & w be first valid woman who rejects m n w = best(m) n By definition, there is a stable matching S' containing (m, w). ¤ In E, m was rejected by w because of m' Þ w prefers m' to m ¤ Assume (m', w') Î S', w' ¹ w. (w' is a valid partner of m') ¤ In E, (m, w) is the first rejection of a valid pair ¤ m' hadn’t been rejected by any valid partner when m' is engaged to w in E. ¤ m' proposed in decreasing order of preference (those women ranked before w are invalid). ¤ And w' is a valid partner of m' Þ m' must prefer w to w' ¤ Since (m', w) Ï S', it follows that (m', w) is an instability in S'. ®¬ Opening 28 w m m' w' S' S'
  • 29. IRIS H.-R. JIANG What Did We Learn? ¨ Powerful ideas learned from stable matching ¤ Isolate underlying structure of problem ¤ Create effective and efficient algorithms n Effectiveness: Logical proofs n Useful technique: proof by contradiction n Efficiency will be detailed in the next chapter Opening 29 For me, great algorithms are the poetry of computation. Just like verse, they can be terse, allusive, dense, and even mysterious. But once unlocked, they cast a brilliant new light on some aspect of computing. -- Francis Sullivan An algorithm must be seen to be believed. The best way to learn what an algorithm is all about is to try it. The reader should always take pencil and paper and work through an example... -- Donald Knuth IRIS H.-R. JIANG eBook ¨ Chapters 1, 6, 13 ¨ http://www.aw-bc.com/info/kleinberg/assets/downloads/ch1.pdf ¨ http://www.aw-bc.com/info/kleinberg/assets/downloads/ch6.pdf ¨ http://www.aw-bc.com/info/kleinberg/assets/downloads/ch13.pdf ¨ The whole book ¨ http://www.icsd.aegean.gr/kaporisa/index_files/Algorithm_Design.pdf Opening 30
  • 30. IRIS H.-R. JIANG What Did We Learn? ¨ Powerful ideas learned from stable matching ¤ Isolate underlying structure of problem ¤ Create effective and efficient algorithms n Effectiveness: Logical proofs n Useful technique: proof by contradiction n Efficiency will be detailed in the next chapter Opening 29 For me, great algorithms are the poetry of computation. Just like verse, they can be terse, allusive, dense, and even mysterious. But once unlocked, they cast a brilliant new light on some aspect of computing. -- Francis Sullivan An algorithm must be seen to be believed. The best way to learn what an algorithm is all about is to try it. The reader should always take pencil and paper and work through an example... -- Donald Knuth IRIS H.-R. JIANG eBook ¨ Chapters 1, 6, 13 ¨ http://www.aw-bc.com/info/kleinberg/assets/downloads/ch1.pdf ¨ http://www.aw-bc.com/info/kleinberg/assets/downloads/ch6.pdf ¨ http://www.aw-bc.com/info/kleinberg/assets/downloads/ch13.pdf ¨ The whole book ¨ http://www.icsd.aegean.gr/kaporisa/index_files/Algorithm_Design.pdf Opening 30