48
Discrete Optimization Lecture-11 Ngày 2 tháng 11 năm 2011 () Discrete Optimization Lecture-11 Ngày 2 tháng 11 năm 2011 1 / 12

Discrete Optimization Lecture-11 · During this 12 days period every ship has to stop at some port and remain there for the remaining period for maintenance. So if ship S2 decides

  • Upload
    others

  • View
    0

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Discrete Optimization Lecture-11 · During this 12 days period every ship has to stop at some port and remain there for the remaining period for maintenance. So if ship S2 decides

Discrete OptimizationLecture-11

Ngày 2 tháng 11 năm 2011

() Discrete Optimization Lecture-11 Ngày 2 tháng 11 năm 2011 1 / 12

Page 2: Discrete Optimization Lecture-11 · During this 12 days period every ship has to stop at some port and remain there for the remaining period for maintenance. So if ship S2 decides

A scheduling problem

DiscussionA company owns 7 ships. During a 12 days period they are scheduledto visit 7 ports.See the schedule table in the next slide.Due to size limitations no two ships can dock on the same day in thesame port. During this 12 days period every ship has to stop at someport and remain there for the remaining period for maintenance.So if ship S2 decides to stop on day 2 in port No. 3 it will not visit theremaining ports on its schedule and it will block the ship S3 which isnot acceptable.

() Discrete Optimization Lecture-11 Ngày 2 tháng 11 năm 2011 1 / 12

Page 3: Discrete Optimization Lecture-11 · During this 12 days period every ship has to stop at some port and remain there for the remaining period for maintenance. So if ship S2 decides

We need to find a schedule to assign the ships to the ports accordingto the given schedule subject to the following rules:

a. No two ships should be docked at the same port on the same day.

b. Once a ship chooses a port to stop (according to its schedule) itstays there until the end of the period.

c. No ship will interfere with the schedule of another ship; thus S5cannot decide to stop at port 2 on day 1 because it will block S1on day 2 or S3 on day 5.

QuestionThis sounds like a matching problem, matching ships to ports withconstraints.So how do we approach this problem?

We can try a greedy selection:

() Discrete Optimization Lecture-11 Ngày 2 tháng 11 năm 2011 2 / 12

Page 4: Discrete Optimization Lecture-11 · During this 12 days period every ship has to stop at some port and remain there for the remaining period for maintenance. So if ship S2 decides

We need to find a schedule to assign the ships to the ports accordingto the given schedule subject to the following rules:

a. No two ships should be docked at the same port on the same day.b. Once a ship chooses a port to stop (according to its schedule) it

stays there until the end of the period.

c. No ship will interfere with the schedule of another ship; thus S5cannot decide to stop at port 2 on day 1 because it will block S1on day 2 or S3 on day 5.

QuestionThis sounds like a matching problem, matching ships to ports withconstraints.So how do we approach this problem?

We can try a greedy selection:

() Discrete Optimization Lecture-11 Ngày 2 tháng 11 năm 2011 2 / 12

Page 5: Discrete Optimization Lecture-11 · During this 12 days period every ship has to stop at some port and remain there for the remaining period for maintenance. So if ship S2 decides

We need to find a schedule to assign the ships to the ports accordingto the given schedule subject to the following rules:

a. No two ships should be docked at the same port on the same day.b. Once a ship chooses a port to stop (according to its schedule) it

stays there until the end of the period.c. No ship will interfere with the schedule of another ship; thus S5

cannot decide to stop at port 2 on day 1 because it will block S1on day 2 or S3 on day 5.

QuestionThis sounds like a matching problem, matching ships to ports withconstraints.So how do we approach this problem?

We can try a greedy selection:

() Discrete Optimization Lecture-11 Ngày 2 tháng 11 năm 2011 2 / 12

Page 6: Discrete Optimization Lecture-11 · During this 12 days period every ship has to stop at some port and remain there for the remaining period for maintenance. So if ship S2 decides

We need to find a schedule to assign the ships to the ports accordingto the given schedule subject to the following rules:

a. No two ships should be docked at the same port on the same day.b. Once a ship chooses a port to stop (according to its schedule) it

stays there until the end of the period.c. No ship will interfere with the schedule of another ship; thus S5

cannot decide to stop at port 2 on day 1 because it will block S1on day 2 or S3 on day 5.

QuestionThis sounds like a matching problem, matching ships to ports withconstraints.So how do we approach this problem?

We can try a greedy selection:

() Discrete Optimization Lecture-11 Ngày 2 tháng 11 năm 2011 2 / 12

Page 7: Discrete Optimization Lecture-11 · During this 12 days period every ship has to stop at some port and remain there for the remaining period for maintenance. So if ship S2 decides

We need to find a schedule to assign the ships to the ports accordingto the given schedule subject to the following rules:

a. No two ships should be docked at the same port on the same day.b. Once a ship chooses a port to stop (according to its schedule) it

stays there until the end of the period.c. No ship will interfere with the schedule of another ship; thus S5

cannot decide to stop at port 2 on day 1 because it will block S1on day 2 or S3 on day 5.

QuestionThis sounds like a matching problem, matching ships to ports withconstraints.So how do we approach this problem?

We can try a greedy selection:

() Discrete Optimization Lecture-11 Ngày 2 tháng 11 năm 2011 2 / 12

Page 8: Discrete Optimization Lecture-11 · During this 12 days period every ship has to stop at some port and remain there for the remaining period for maintenance. So if ship S2 decides

We need to find a schedule to assign the ships to the ports accordingto the given schedule subject to the following rules:

a. No two ships should be docked at the same port on the same day.b. Once a ship chooses a port to stop (according to its schedule) it

stays there until the end of the period.c. No ship will interfere with the schedule of another ship; thus S5

cannot decide to stop at port 2 on day 1 because it will block S1on day 2 or S3 on day 5.

QuestionThis sounds like a matching problem, matching ships to ports withconstraints.So how do we approach this problem?

We can try a greedy selection:

() Discrete Optimization Lecture-11 Ngày 2 tháng 11 năm 2011 2 / 12

Page 9: Discrete Optimization Lecture-11 · During this 12 days period every ship has to stop at some port and remain there for the remaining period for maintenance. So if ship S2 decides

A schedule sample

A greedy selection will assign S6 to port 5 on day 12, S7 to port 6 onday 12, S5 to port 4 on day 11, S1 to port 7 on day 11 and so on?

Day S1 S2 S3 S4 S5 S6 S7

1 * * 1 * 2 * *

2 2 3 * 1 5 * *

3 3 * 5 * * 6 2

4 * 4 3 2 * 7 1

5 4 * 2 7 1 3 5

6 * 1 * 6 * 4 *

7 1 6 * 3 7 * 4

8 5 2 * * 3 1 7

9 * 7 4 * 6 2 3

10 6 5 7 4 * * *

11 7 * 6 5 4 * *

12 * * * * * 5 6

() Discrete Optimization Lecture-11 Ngày 2 tháng 11 năm 2011 3 / 12

Page 10: Discrete Optimization Lecture-11 · During this 12 days period every ship has to stop at some port and remain there for the remaining period for maintenance. So if ship S2 decides

The stable marriage problem

The stable marriage problem is a very famous combinatorialoptimization problem with many applications. Google it and you willfind hundreds of references. Basically, it is a matching problem withconstraints.

The origin of the problem is not clear. It seems that the first referenceto the problem was an attempt to place medical interns in variousdepartments in a hospital.Here is what happened: Trung was placed in dermatology, but heprefered surgery. So he enquired with the surgery department, theychecked the list of interns that were assigned to them and indeedfound out that they prefered Trung on Hoang, so they dumped Hoangand offered Trung an internishp. Hoang was not terriby disappointed ashe prefered gynecology. So he applied to them, they checked their listand found out that they liked Hoang better than Duy, so they dunpedDuy and offered the internship to Hoang, so now Duy...you canimagine the rest of the story.

() Discrete Optimization Lecture-11 Ngày 2 tháng 11 năm 2011 4 / 12

Page 11: Discrete Optimization Lecture-11 · During this 12 days period every ship has to stop at some port and remain there for the remaining period for maintenance. So if ship S2 decides

The stable marriage problem

The stable marriage problem is a very famous combinatorialoptimization problem with many applications. Google it and you willfind hundreds of references. Basically, it is a matching problem withconstraints.The origin of the problem is not clear. It seems that the first referenceto the problem was an attempt to place medical interns in variousdepartments in a hospital.

Here is what happened: Trung was placed in dermatology, but heprefered surgery. So he enquired with the surgery department, theychecked the list of interns that were assigned to them and indeedfound out that they prefered Trung on Hoang, so they dumped Hoangand offered Trung an internishp. Hoang was not terriby disappointed ashe prefered gynecology. So he applied to them, they checked their listand found out that they liked Hoang better than Duy, so they dunpedDuy and offered the internship to Hoang, so now Duy...you canimagine the rest of the story.

() Discrete Optimization Lecture-11 Ngày 2 tháng 11 năm 2011 4 / 12

Page 12: Discrete Optimization Lecture-11 · During this 12 days period every ship has to stop at some port and remain there for the remaining period for maintenance. So if ship S2 decides

The stable marriage problem

The stable marriage problem is a very famous combinatorialoptimization problem with many applications. Google it and you willfind hundreds of references. Basically, it is a matching problem withconstraints.The origin of the problem is not clear. It seems that the first referenceto the problem was an attempt to place medical interns in variousdepartments in a hospital.Here is what happened: Trung was placed in dermatology, but heprefered surgery. So he enquired with the surgery department, theychecked the list of interns that were assigned to them and indeedfound out that they prefered Trung on Hoang, so they dumped Hoangand offered Trung an internishp. Hoang was not terriby disappointed ashe prefered gynecology. So he applied to them, they checked their listand found out that they liked Hoang better than Duy, so they dunpedDuy and offered the internship to Hoang, so now Duy...you canimagine the rest of the story.

() Discrete Optimization Lecture-11 Ngày 2 tháng 11 năm 2011 4 / 12

Page 13: Discrete Optimization Lecture-11 · During this 12 days period every ship has to stop at some port and remain there for the remaining period for maintenance. So if ship S2 decides

What is a stable marriage?

In 1962 David Gale and Lloyd Shapley asked whether it is possible todesign an algorithm that will assign people to jobs that will be stable.That is if Duy will try to apply to surgery, surgery will not accept himbecuase they prefer all their current recruits and if gynecology will tryto recruit Hang she will not accept the invitation because she preferspediatrics where she is currently accepted.

A simple version of the problem gave it its name. Assume that we haven females and n men. Each person submits a list of preferences inwhich he/she lists all persons of opposite sex in order of preference.

DefinitionA matching M is stable if it is perfect and there is no pair of matchesfi ↔ mi and fj ↔ mj such that fi prefers mj over mi and mj prefers fiover fj .

() Discrete Optimization Lecture-11 Ngày 2 tháng 11 năm 2011 5 / 12

Page 14: Discrete Optimization Lecture-11 · During this 12 days period every ship has to stop at some port and remain there for the remaining period for maintenance. So if ship S2 decides

What is a stable marriage?

In 1962 David Gale and Lloyd Shapley asked whether it is possible todesign an algorithm that will assign people to jobs that will be stable.That is if Duy will try to apply to surgery, surgery will not accept himbecuase they prefer all their current recruits and if gynecology will tryto recruit Hang she will not accept the invitation because she preferspediatrics where she is currently accepted.A simple version of the problem gave it its name. Assume that we haven females and n men. Each person submits a list of preferences inwhich he/she lists all persons of opposite sex in order of preference.

DefinitionA matching M is stable if it is perfect and there is no pair of matchesfi ↔ mi and fj ↔ mj such that fi prefers mj over mi and mj prefers fiover fj .

() Discrete Optimization Lecture-11 Ngày 2 tháng 11 năm 2011 5 / 12

Page 15: Discrete Optimization Lecture-11 · During this 12 days period every ship has to stop at some port and remain there for the remaining period for maintenance. So if ship S2 decides

Example

Let us match 4 couples. This is their list of preferences:

1 −→ (3,1,2,4) 1 −→ (2,4,1,3)2 −→ (1,4,3,2) 2 −→ (2,1,4,3)3 −→ (3,2,1,4) 3 −→ (4,1,2,3)4 −→ (3,2,4,1) 4 −→ (2,1,4,3)

Is the match (i , i) Stable?

Try to find a a stable matching.

() Discrete Optimization Lecture-11 Ngày 2 tháng 11 năm 2011 6 / 12

Page 16: Discrete Optimization Lecture-11 · During this 12 days period every ship has to stop at some port and remain there for the remaining period for maintenance. So if ship S2 decides

Example

Let us match 4 couples. This is their list of preferences:

1 −→ (3,1,2,4) 1 −→ (2,4,1,3)2 −→ (1,4,3,2) 2 −→ (2,1,4,3)3 −→ (3,2,1,4) 3 −→ (4,1,2,3)4 −→ (3,2,4,1) 4 −→ (2,1,4,3)

Is the match (i , i) Stable?

Try to find a a stable matching.

() Discrete Optimization Lecture-11 Ngày 2 tháng 11 năm 2011 6 / 12

Page 17: Discrete Optimization Lecture-11 · During this 12 days period every ship has to stop at some port and remain there for the remaining period for maintenance. So if ship S2 decides

The algorithm

Given a list of preferences by n females and males does a stablemarriage exist and can it be constructed efficiently.

CommentOnce again, we face a problem which is conceptually very simple. Tryall permutations. For each permutation check whether it is stable.

Easier said than done. Imagine doing it just for a small list of 50 pairs.

The Gale-Shapley algorithm is an efficient implementation of analgorithm that also proves that a stable marriage exists regardless ofthe preference lists.

During the algorihtm the men go thorugh three stages:

a. Free.b. engaged.c. Matched.

() Discrete Optimization Lecture-11 Ngày 2 tháng 11 năm 2011 7 / 12

Page 18: Discrete Optimization Lecture-11 · During this 12 days period every ship has to stop at some port and remain there for the remaining period for maintenance. So if ship S2 decides

The algorithm

Given a list of preferences by n females and males does a stablemarriage exist and can it be constructed efficiently.

CommentOnce again, we face a problem which is conceptually very simple. Tryall permutations. For each permutation check whether it is stable.

Easier said than done. Imagine doing it just for a small list of 50 pairs.

The Gale-Shapley algorithm is an efficient implementation of analgorithm that also proves that a stable marriage exists regardless ofthe preference lists.

During the algorihtm the men go thorugh three stages:

a. Free.b. engaged.c. Matched.

() Discrete Optimization Lecture-11 Ngày 2 tháng 11 năm 2011 7 / 12

Page 19: Discrete Optimization Lecture-11 · During this 12 days period every ship has to stop at some port and remain there for the remaining period for maintenance. So if ship S2 decides

The algorithm

Given a list of preferences by n females and males does a stablemarriage exist and can it be constructed efficiently.

CommentOnce again, we face a problem which is conceptually very simple. Tryall permutations. For each permutation check whether it is stable.Easier said than done. Imagine doing it just for a small list of 50 pairs.

The Gale-Shapley algorithm is an efficient implementation of analgorithm that also proves that a stable marriage exists regardless ofthe preference lists.

During the algorihtm the men go thorugh three stages:

a. Free.b. engaged.c. Matched.

() Discrete Optimization Lecture-11 Ngày 2 tháng 11 năm 2011 7 / 12

Page 20: Discrete Optimization Lecture-11 · During this 12 days period every ship has to stop at some port and remain there for the remaining period for maintenance. So if ship S2 decides

The algorithm

Given a list of preferences by n females and males does a stablemarriage exist and can it be constructed efficiently.

CommentOnce again, we face a problem which is conceptually very simple. Tryall permutations. For each permutation check whether it is stable.Easier said than done. Imagine doing it just for a small list of 50 pairs.

The Gale-Shapley algorithm is an efficient implementation of analgorithm that also proves that a stable marriage exists regardless ofthe preference lists.

During the algorihtm the men go thorugh three stages:

a. Free.b. engaged.c. Matched.

() Discrete Optimization Lecture-11 Ngày 2 tháng 11 năm 2011 7 / 12

Page 21: Discrete Optimization Lecture-11 · During this 12 days period every ship has to stop at some port and remain there for the remaining period for maintenance. So if ship S2 decides

The algorithm

Given a list of preferences by n females and males does a stablemarriage exist and can it be constructed efficiently.

CommentOnce again, we face a problem which is conceptually very simple. Tryall permutations. For each permutation check whether it is stable.Easier said than done. Imagine doing it just for a small list of 50 pairs.

The Gale-Shapley algorithm is an efficient implementation of analgorithm that also proves that a stable marriage exists regardless ofthe preference lists.

During the algorihtm the men go thorugh three stages:a. Free.

b. engaged.c. Matched.

() Discrete Optimization Lecture-11 Ngày 2 tháng 11 năm 2011 7 / 12

Page 22: Discrete Optimization Lecture-11 · During this 12 days period every ship has to stop at some port and remain there for the remaining period for maintenance. So if ship S2 decides

The algorithm

Given a list of preferences by n females and males does a stablemarriage exist and can it be constructed efficiently.

CommentOnce again, we face a problem which is conceptually very simple. Tryall permutations. For each permutation check whether it is stable.Easier said than done. Imagine doing it just for a small list of 50 pairs.

The Gale-Shapley algorithm is an efficient implementation of analgorithm that also proves that a stable marriage exists regardless ofthe preference lists.

During the algorihtm the men go thorugh three stages:a. Free.b. engaged.

c. Matched.

() Discrete Optimization Lecture-11 Ngày 2 tháng 11 năm 2011 7 / 12

Page 23: Discrete Optimization Lecture-11 · During this 12 days period every ship has to stop at some port and remain there for the remaining period for maintenance. So if ship S2 decides

The algorithm

Given a list of preferences by n females and males does a stablemarriage exist and can it be constructed efficiently.

CommentOnce again, we face a problem which is conceptually very simple. Tryall permutations. For each permutation check whether it is stable.Easier said than done. Imagine doing it just for a small list of 50 pairs.

The Gale-Shapley algorithm is an efficient implementation of analgorithm that also proves that a stable marriage exists regardless ofthe preference lists.

During the algorihtm the men go thorugh three stages:a. Free.b. engaged.c. Matched.

() Discrete Optimization Lecture-11 Ngày 2 tháng 11 năm 2011 7 / 12

Page 24: Discrete Optimization Lecture-11 · During this 12 days period every ship has to stop at some port and remain there for the remaining period for maintenance. So if ship S2 decides

Gale-Shapley’s algorithm

1 Initially all men and women are free.2 Select a free man mi . Let him propose to a woman on top of his

preference list among the women he has not proposed to yet. Ifshe is free then the algorithm matches them as engaged.

3 If she is in a tentaive match with mk but she prefers mi then weengagedly match them and make mk free. Else mi remains freeand we choose another man.

4 When there are no more free men the algorihtm returns the list ofengaged matches. This is a stable match.

() Discrete Optimization Lecture-11 Ngày 2 tháng 11 năm 2011 8 / 12

Page 25: Discrete Optimization Lecture-11 · During this 12 days period every ship has to stop at some port and remain there for the remaining period for maintenance. So if ship S2 decides

Gale-Shapley’s algorithm

1 Initially all men and women are free.

2 Select a free man mi . Let him propose to a woman on top of hispreference list among the women he has not proposed to yet. Ifshe is free then the algorithm matches them as engaged.

3 If she is in a tentaive match with mk but she prefers mi then weengagedly match them and make mk free. Else mi remains freeand we choose another man.

4 When there are no more free men the algorihtm returns the list ofengaged matches. This is a stable match.

() Discrete Optimization Lecture-11 Ngày 2 tháng 11 năm 2011 8 / 12

Page 26: Discrete Optimization Lecture-11 · During this 12 days period every ship has to stop at some port and remain there for the remaining period for maintenance. So if ship S2 decides

Gale-Shapley’s algorithm

1 Initially all men and women are free.2 Select a free man mi . Let him propose to a woman on top of his

preference list among the women he has not proposed to yet. Ifshe is free then the algorithm matches them as engaged.

3 If she is in a tentaive match with mk but she prefers mi then weengagedly match them and make mk free. Else mi remains freeand we choose another man.

4 When there are no more free men the algorihtm returns the list ofengaged matches. This is a stable match.

() Discrete Optimization Lecture-11 Ngày 2 tháng 11 năm 2011 8 / 12

Page 27: Discrete Optimization Lecture-11 · During this 12 days period every ship has to stop at some port and remain there for the remaining period for maintenance. So if ship S2 decides

Gale-Shapley’s algorithm

1 Initially all men and women are free.2 Select a free man mi . Let him propose to a woman on top of his

preference list among the women he has not proposed to yet. Ifshe is free then the algorithm matches them as engaged.

3 If she is in a tentaive match with mk but she prefers mi then weengagedly match them and make mk free. Else mi remains freeand we choose another man.

4 When there are no more free men the algorihtm returns the list ofengaged matches. This is a stable match.

() Discrete Optimization Lecture-11 Ngày 2 tháng 11 năm 2011 8 / 12

Page 28: Discrete Optimization Lecture-11 · During this 12 days period every ship has to stop at some port and remain there for the remaining period for maintenance. So if ship S2 decides

Gale-Shapley’s algorithm

1 Initially all men and women are free.2 Select a free man mi . Let him propose to a woman on top of his

preference list among the women he has not proposed to yet. Ifshe is free then the algorithm matches them as engaged.

3 If she is in a tentaive match with mk but she prefers mi then weengagedly match them and make mk free. Else mi remains freeand we choose another man.

4 When there are no more free men the algorihtm returns the list ofengaged matches. This is a stable match.

() Discrete Optimization Lecture-11 Ngày 2 tháng 11 năm 2011 8 / 12

Page 29: Discrete Optimization Lecture-11 · During this 12 days period every ship has to stop at some port and remain there for the remaining period for maintenance. So if ship S2 decides

Analysis

The algorithm has the following properties:1 During the execution of the algorithm every man and female is in

one of three stages: free, engaged or matched.

2 Every person is engaged to at mots one other person.3 Once a female is engaged, she will remain engaged (not

necessarily to the same male) till the end of the algorithm.4 Males can be engaged or become free.5 A step in the algorihtm is when mi proposes to wj (step number 2

in the G-S algorithm).6 Every pair (mi ,wj) is considered at most once during the

execution of the algorithm.7 At the end of the algorithm everyone will be engaged.

() Discrete Optimization Lecture-11 Ngày 2 tháng 11 năm 2011 9 / 12

Page 30: Discrete Optimization Lecture-11 · During this 12 days period every ship has to stop at some port and remain there for the remaining period for maintenance. So if ship S2 decides

Analysis

The algorithm has the following properties:1 During the execution of the algorithm every man and female is in

one of three stages: free, engaged or matched.2 Every person is engaged to at mots one other person.

3 Once a female is engaged, she will remain engaged (notnecessarily to the same male) till the end of the algorithm.

4 Males can be engaged or become free.5 A step in the algorihtm is when mi proposes to wj (step number 2

in the G-S algorithm).6 Every pair (mi ,wj) is considered at most once during the

execution of the algorithm.7 At the end of the algorithm everyone will be engaged.

() Discrete Optimization Lecture-11 Ngày 2 tháng 11 năm 2011 9 / 12

Page 31: Discrete Optimization Lecture-11 · During this 12 days period every ship has to stop at some port and remain there for the remaining period for maintenance. So if ship S2 decides

Analysis

The algorithm has the following properties:1 During the execution of the algorithm every man and female is in

one of three stages: free, engaged or matched.2 Every person is engaged to at mots one other person.3 Once a female is engaged, she will remain engaged (not

necessarily to the same male) till the end of the algorithm.

4 Males can be engaged or become free.5 A step in the algorihtm is when mi proposes to wj (step number 2

in the G-S algorithm).6 Every pair (mi ,wj) is considered at most once during the

execution of the algorithm.7 At the end of the algorithm everyone will be engaged.

() Discrete Optimization Lecture-11 Ngày 2 tháng 11 năm 2011 9 / 12

Page 32: Discrete Optimization Lecture-11 · During this 12 days period every ship has to stop at some port and remain there for the remaining period for maintenance. So if ship S2 decides

Analysis

The algorithm has the following properties:1 During the execution of the algorithm every man and female is in

one of three stages: free, engaged or matched.2 Every person is engaged to at mots one other person.3 Once a female is engaged, she will remain engaged (not

necessarily to the same male) till the end of the algorithm.4 Males can be engaged or become free.

5 A step in the algorihtm is when mi proposes to wj (step number 2in the G-S algorithm).

6 Every pair (mi ,wj) is considered at most once during theexecution of the algorithm.

7 At the end of the algorithm everyone will be engaged.

() Discrete Optimization Lecture-11 Ngày 2 tháng 11 năm 2011 9 / 12

Page 33: Discrete Optimization Lecture-11 · During this 12 days period every ship has to stop at some port and remain there for the remaining period for maintenance. So if ship S2 decides

Analysis

The algorithm has the following properties:1 During the execution of the algorithm every man and female is in

one of three stages: free, engaged or matched.2 Every person is engaged to at mots one other person.3 Once a female is engaged, she will remain engaged (not

necessarily to the same male) till the end of the algorithm.4 Males can be engaged or become free.5 A step in the algorihtm is when mi proposes to wj (step number 2

in the G-S algorithm).

6 Every pair (mi ,wj) is considered at most once during theexecution of the algorithm.

7 At the end of the algorithm everyone will be engaged.

() Discrete Optimization Lecture-11 Ngày 2 tháng 11 năm 2011 9 / 12

Page 34: Discrete Optimization Lecture-11 · During this 12 days period every ship has to stop at some port and remain there for the remaining period for maintenance. So if ship S2 decides

Analysis

The algorithm has the following properties:1 During the execution of the algorithm every man and female is in

one of three stages: free, engaged or matched.2 Every person is engaged to at mots one other person.3 Once a female is engaged, she will remain engaged (not

necessarily to the same male) till the end of the algorithm.4 Males can be engaged or become free.5 A step in the algorihtm is when mi proposes to wj (step number 2

in the G-S algorithm).6 Every pair (mi ,wj) is considered at most once during the

execution of the algorithm.

7 At the end of the algorithm everyone will be engaged.

() Discrete Optimization Lecture-11 Ngày 2 tháng 11 năm 2011 9 / 12

Page 35: Discrete Optimization Lecture-11 · During this 12 days period every ship has to stop at some port and remain there for the remaining period for maintenance. So if ship S2 decides

Analysis

The algorithm has the following properties:1 During the execution of the algorithm every man and female is in

one of three stages: free, engaged or matched.2 Every person is engaged to at mots one other person.3 Once a female is engaged, she will remain engaged (not

necessarily to the same male) till the end of the algorithm.4 Males can be engaged or become free.5 A step in the algorihtm is when mi proposes to wj (step number 2

in the G-S algorithm).6 Every pair (mi ,wj) is considered at most once during the

execution of the algorithm.7 At the end of the algorithm everyone will be engaged.

() Discrete Optimization Lecture-11 Ngày 2 tháng 11 năm 2011 9 / 12

Page 36: Discrete Optimization Lecture-11 · During this 12 days period every ship has to stop at some port and remain there for the remaining period for maintenance. So if ship S2 decides

Analysis

Discussion

A1. Since there are n2 distinct pairs and each pair is considered atmost once, the algorithn executes at most n2 steps, in other words,it is “efficient.”

A2. By the end of the algorithm, if a free man remains, there will alsobe a free woman. So he will be able to propose to her.

A3. We still need to prove that a stable matching will be produced bythe algorithm.

TheoremThe gale-Shapley algorithm produces a stable marriage.

() Discrete Optimization Lecture-11 Ngày 2 tháng 11 năm 2011 10 / 12

Page 37: Discrete Optimization Lecture-11 · During this 12 days period every ship has to stop at some port and remain there for the remaining period for maintenance. So if ship S2 decides

Analysis

Discussion

A1. Since there are n2 distinct pairs and each pair is considered atmost once, the algorithn executes at most n2 steps, in other words,it is “efficient.”

A2. By the end of the algorithm, if a free man remains, there will alsobe a free woman. So he will be able to propose to her.

A3. We still need to prove that a stable matching will be produced bythe algorithm.

TheoremThe gale-Shapley algorithm produces a stable marriage.

() Discrete Optimization Lecture-11 Ngày 2 tháng 11 năm 2011 10 / 12

Page 38: Discrete Optimization Lecture-11 · During this 12 days period every ship has to stop at some port and remain there for the remaining period for maintenance. So if ship S2 decides

Analysis

Discussion

A1. Since there are n2 distinct pairs and each pair is considered atmost once, the algorithn executes at most n2 steps, in other words,it is “efficient.”

A2. By the end of the algorithm, if a free man remains, there will alsobe a free woman. So he will be able to propose to her.

A3. We still need to prove that a stable matching will be produced bythe algorithm.

TheoremThe gale-Shapley algorithm produces a stable marriage.

() Discrete Optimization Lecture-11 Ngày 2 tháng 11 năm 2011 10 / 12

Page 39: Discrete Optimization Lecture-11 · During this 12 days period every ship has to stop at some port and remain there for the remaining period for maintenance. So if ship S2 decides

Analysis

Discussion

A1. Since there are n2 distinct pairs and each pair is considered atmost once, the algorithn executes at most n2 steps, in other words,it is “efficient.”

A2. By the end of the algorithm, if a free man remains, there will alsobe a free woman. So he will be able to propose to her.

A3. We still need to prove that a stable matching will be produced bythe algorithm.

TheoremThe gale-Shapley algorithm produces a stable marriage.

() Discrete Optimization Lecture-11 Ngày 2 tháng 11 năm 2011 10 / 12

Page 40: Discrete Optimization Lecture-11 · During this 12 days period every ship has to stop at some port and remain there for the remaining period for maintenance. So if ship S2 decides

Analysis

Discussion

A1. Since there are n2 distinct pairs and each pair is considered atmost once, the algorithn executes at most n2 steps, in other words,it is “efficient.”

A2. By the end of the algorithm, if a free man remains, there will alsobe a free woman. So he will be able to propose to her.

A3. We still need to prove that a stable matching will be produced bythe algorithm.

TheoremThe gale-Shapley algorithm produces a stable marriage.

() Discrete Optimization Lecture-11 Ngày 2 tháng 11 năm 2011 10 / 12

Page 41: Discrete Optimization Lecture-11 · During this 12 days period every ship has to stop at some port and remain there for the remaining period for maintenance. So if ship S2 decides

We can prove this by induction.

RemarkWe first note that if there are k stable engagements and mk+1 proposesto w and w is free, then adding the pair (mk+1,w) cannot cause aninstability because none of the men on w’s preference list that sheprefers over mk+1 proposed to her earlier, or she would not be free.

() Discrete Optimization Lecture-11 Ngày 2 tháng 11 năm 2011 11 / 12

Page 42: Discrete Optimization Lecture-11 · During this 12 days period every ship has to stop at some port and remain there for the remaining period for maintenance. So if ship S2 decides

Chứng minh.Induction hypothesis: When the algorithm engages k pairs, theengagements are stable.

1 Obviously true for k = 1.2 Assume true for k = m and we now execute step 2 in the

algorithm.3 mk+1 is proposing to w .4 If she is free then they become engaged and clearly there is no

in-stability in this engagement.5 If she is engaged and prefers mk+1 she will become engaged to

him. So we still have only k stable engagements.6 Since every male has all n females on his list of preferences and

only k females are engaged, this process cannot cycle indefinitely.Eventually the k + 1 attempt to add a stable engagement wilsucceed by finding a free female in his list.

l() Discrete Optimization Lecture-11 Ngày 2 tháng 11 năm 2011 12 / 12

Page 43: Discrete Optimization Lecture-11 · During this 12 days period every ship has to stop at some port and remain there for the remaining period for maintenance. So if ship S2 decides

Chứng minh.Induction hypothesis: When the algorithm engages k pairs, theengagements are stable.

1 Obviously true for k = 1.

2 Assume true for k = m and we now execute step 2 in thealgorithm.

3 mk+1 is proposing to w .4 If she is free then they become engaged and clearly there is no

in-stability in this engagement.5 If she is engaged and prefers mk+1 she will become engaged to

him. So we still have only k stable engagements.6 Since every male has all n females on his list of preferences and

only k females are engaged, this process cannot cycle indefinitely.Eventually the k + 1 attempt to add a stable engagement wilsucceed by finding a free female in his list.

l() Discrete Optimization Lecture-11 Ngày 2 tháng 11 năm 2011 12 / 12

Page 44: Discrete Optimization Lecture-11 · During this 12 days period every ship has to stop at some port and remain there for the remaining period for maintenance. So if ship S2 decides

Chứng minh.Induction hypothesis: When the algorithm engages k pairs, theengagements are stable.

1 Obviously true for k = 1.2 Assume true for k = m and we now execute step 2 in the

algorithm.

3 mk+1 is proposing to w .4 If she is free then they become engaged and clearly there is no

in-stability in this engagement.5 If she is engaged and prefers mk+1 she will become engaged to

him. So we still have only k stable engagements.6 Since every male has all n females on his list of preferences and

only k females are engaged, this process cannot cycle indefinitely.Eventually the k + 1 attempt to add a stable engagement wilsucceed by finding a free female in his list.

l() Discrete Optimization Lecture-11 Ngày 2 tháng 11 năm 2011 12 / 12

Page 45: Discrete Optimization Lecture-11 · During this 12 days period every ship has to stop at some port and remain there for the remaining period for maintenance. So if ship S2 decides

Chứng minh.Induction hypothesis: When the algorithm engages k pairs, theengagements are stable.

1 Obviously true for k = 1.2 Assume true for k = m and we now execute step 2 in the

algorithm.3 mk+1 is proposing to w .

4 If she is free then they become engaged and clearly there is noin-stability in this engagement.

5 If she is engaged and prefers mk+1 she will become engaged tohim. So we still have only k stable engagements.

6 Since every male has all n females on his list of preferences andonly k females are engaged, this process cannot cycle indefinitely.Eventually the k + 1 attempt to add a stable engagement wilsucceed by finding a free female in his list.

l() Discrete Optimization Lecture-11 Ngày 2 tháng 11 năm 2011 12 / 12

Page 46: Discrete Optimization Lecture-11 · During this 12 days period every ship has to stop at some port and remain there for the remaining period for maintenance. So if ship S2 decides

Chứng minh.Induction hypothesis: When the algorithm engages k pairs, theengagements are stable.

1 Obviously true for k = 1.2 Assume true for k = m and we now execute step 2 in the

algorithm.3 mk+1 is proposing to w .4 If she is free then they become engaged and clearly there is no

in-stability in this engagement.

5 If she is engaged and prefers mk+1 she will become engaged tohim. So we still have only k stable engagements.

6 Since every male has all n females on his list of preferences andonly k females are engaged, this process cannot cycle indefinitely.Eventually the k + 1 attempt to add a stable engagement wilsucceed by finding a free female in his list.

l() Discrete Optimization Lecture-11 Ngày 2 tháng 11 năm 2011 12 / 12

Page 47: Discrete Optimization Lecture-11 · During this 12 days period every ship has to stop at some port and remain there for the remaining period for maintenance. So if ship S2 decides

Chứng minh.Induction hypothesis: When the algorithm engages k pairs, theengagements are stable.

1 Obviously true for k = 1.2 Assume true for k = m and we now execute step 2 in the

algorithm.3 mk+1 is proposing to w .4 If she is free then they become engaged and clearly there is no

in-stability in this engagement.5 If she is engaged and prefers mk+1 she will become engaged to

him. So we still have only k stable engagements.

6 Since every male has all n females on his list of preferences andonly k females are engaged, this process cannot cycle indefinitely.Eventually the k + 1 attempt to add a stable engagement wilsucceed by finding a free female in his list.

l() Discrete Optimization Lecture-11 Ngày 2 tháng 11 năm 2011 12 / 12

Page 48: Discrete Optimization Lecture-11 · During this 12 days period every ship has to stop at some port and remain there for the remaining period for maintenance. So if ship S2 decides

Chứng minh.Induction hypothesis: When the algorithm engages k pairs, theengagements are stable.

1 Obviously true for k = 1.2 Assume true for k = m and we now execute step 2 in the

algorithm.3 mk+1 is proposing to w .4 If she is free then they become engaged and clearly there is no

in-stability in this engagement.5 If she is engaged and prefers mk+1 she will become engaged to

him. So we still have only k stable engagements.6 Since every male has all n females on his list of preferences and

only k females are engaged, this process cannot cycle indefinitely.Eventually the k + 1 attempt to add a stable engagement wilsucceed by finding a free female in his list.

l() Discrete Optimization Lecture-11 Ngày 2 tháng 11 năm 2011 12 / 12