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

## Presentation on theme: "Stable Matching Problems with Constant Length Preference Lists Rob Irving, David Manlove, Gregg OMalley University Of Glasgow Department of Computing Science."— Presentation transcript:

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

SMI Formulation Set n 1 men S M = {m 1, m 2, …., m n 1 } Set n 1 men S M = {m 1, m 2, …., m n 1 } Set n 2 women S W = {w 1, w 2, …., w n 2 } Set n 2 women S W = {w 1, w 2, …., w n 2 } Each man ranks a subset of S W in strict order of preference. Each man ranks a subset of S W in strict order of preference. Each woman ranks a subset of S M in strict order of preference. Each woman ranks a subset of S M in strict order of preference. A matching M is a bijection between the men and women. A matching M is a bijection between the men and women. We say a (man, woman) pair (m,w) blocks M if: We say a (man, woman) pair (m,w) blocks M if: m prefers w to his partner in M, and m prefers w to his partner in M, and w prefers m to her partner in M. w prefers m to her partner in M. A matching that admits no blocking pair is said to be stable A matching that admits no blocking pair is said to be stable Can t improve by making an arrangement outside the matching. Can t improve by making an arrangement outside the matching. We can always find a stable matching for an instance of SMI by an adaptation of an algorithm known as the Gale/Shapley algorithm (1962). We can always find a stable matching for an instance of SMI by an adaptation of an algorithm known as the Gale/Shapley algorithm (1962). Gale and Sotomayor also proved in 1985 that for an instance of SMI all stable matchings have the same size. Gale and Sotomayor also proved in 1985 that for an instance of SMI all stable matchings have the same size.

SMTI Formalisation Set of n 1 men S M = {m 1, m 2, …., m n 1 } Set of n 1 men S M = {m 1, m 2, …., m n 1 } Set of n 2 women S W = {w 1, w 2, …., w n 2 } Set of n 2 women S W = {w 1, w 2, …., w n 2 } Each man m i ranks a subset of S W in preference order, and m i s list may contain ties. Each man m i ranks a subset of S W in preference order, and m i s list may contain ties. Each woman w j ranks a subset of S M in preference order, and w j s list may contain ties. Each woman w j ranks a subset of S M in preference order, and w j s list may contain ties. A matching M is a set of (man, woman) pairs (m,w) such that each of m and w appear in at most one pair, and m and w are on each others list. A matching M is a set of (man, woman) pairs (m,w) such that each of m and w appear in at most one pair, and m and w are on each others list. We say a (man, woman) pair (m, w) blocks M if: We say a (man, woman) pair (m, w) blocks M if: Either m is unmatched or m strictly prefers w to his partner in M, and Either m is unmatched or m strictly prefers w to his partner in M, and Either w is unmatched or w strictly prefers m to her partner in M. Either w is unmatched or w strictly prefers m to her partner in M. A matching that admits no blocking pair is said to be stable A matching that admits no blocking pair is said to be stable Can t improve by making an arrangement outside the matching. Can t improve by making an arrangement outside the matching.

Properties When no ties are allowed in a participants list: When no ties are allowed in a participants list: A stable matching for an instance of SMI can always be found using a slightly modified version of an algorithm known as the Gale/Shapley algorithm (1962). A stable matching for an instance of SMI can always be found using a slightly modified version of an algorithm known as the Gale/Shapley algorithm (1962). Gale and Sotomayor also proved in 1985 that for an instance of SMI all stable matchings have the same size. Gale and Sotomayor also proved in 1985 that for an instance of SMI all stable matchings have the same size. When ties are allowed in a participants list: When ties are allowed in a participants list: Again we can always find a stable matching for an instance of SMTI by breaking the ties arbitrarily and running the Gale/Shapley algorithm. Again we can always find a stable matching for an instance of SMTI by breaking the ties arbitrarily and running the Gale/Shapley algorithm. However stable matchings may have different sizes in this case. However stable matchings may have different sizes in this case.

SMTI Example m 1 : w 1 w 2 w 1 : (m 1 m 2 ) m 2 : w 1 w 2 : m 1 Mens preferencesWomens preferences Two possible stable matchings are: Two possible stable matchings are: M = {(m 1, w 1 )} M = {( m 1, w 2 ), (m 2, w 1 )}

The History A natural problem to consider is finding a stable matching that matches the largest number of men and women. We denote this problem by MAX-SMTI. A natural problem to consider is finding a stable matching that matches the largest number of men and women. We denote this problem by MAX-SMTI. MAX-SMTI was shown to be NP-hard by Iwama et al. in 1999. MAX-SMTI was shown to be NP-hard by Iwama et al. in 1999. A further natural restriction of MAX-SMTI is finding a maximum stable matching when the preference lists are of a constant length. A further natural restriction of MAX-SMTI is finding a maximum stable matching when the preference lists are of a constant length. This has applications for the matching of graduating medical students to hospitals posts in many countries – as typically students lists are small and of fixed length. This has applications for the matching of graduating medical students to hospitals posts in many countries – as typically students lists are small and of fixed length. The above problem is the one-to-many generalisation of SMTI called the Hospitals/Residents problem with Ties (HRT). The above problem is the one-to-many generalisation of SMTI called the Hospitals/Residents problem with Ties (HRT).

The History cont.. Mens list size Womens list size P or NP-hardCite 74NP-hard Halldórsson et al. 03 55NP-hard 34NP-hard DFM & GOM 06 The following table shows a list of the known results for the case of constant length preference lists. The numbers indicate the upper bounds on the length of the preference lists. The following table shows a list of the known results for the case of constant length preference lists. The numbers indicate the upper bounds on the length of the preference lists.

Our Contribution. We show MAX-SMTI is polynomial-time solvable where mens lists are of size 2 and contain no ties, and the womens lists are of unbounded length and may contain ties. We show MAX-SMTI is polynomial-time solvable where mens lists are of size 2 and contain no ties, and the womens lists are of unbounded length and may contain ties.

(2,n)-MAX-SMTI The algorithm is presented in 3 phases. The algorithm is presented in 3 phases. Phase 1 : adapted Gale/Shapley algorithm. Phase 1 : adapted Gale/Shapley algorithm. Phase 2 : network flow stage. Phase 2 : network flow stage. Phase 3 : continuation of phase 1. Phase 3 : continuation of phase 1. An allocation (similar to matching only women can be multiply assigned) is produced by phase 1. An allocation (similar to matching only women can be multiply assigned) is produced by phase 1. Phase 2 attempts to move men from multiply assigned women to unassigned women. Phase 2 attempts to move men from multiply assigned women to unassigned women. Phase 3 may or may not be need, it reallocates men still assigned to multiply assigned women. Phase 3 may or may not be need, it reallocates men still assigned to multiply assigned women.

Phase 1 men propose to the women; men propose to the women; women hold proposals; women hold proposals; if some woman w j receives a proposal from man m i, then she deletes all strict successors of m i from her list; if some woman w j receives a proposal from man m i, then she deletes all strict successors of m i from her list; Terminates with an allocation A 1 Terminates with an allocation A 1

Phase 1 Example m 1 : w 1 w 2 w 1 : (m 1 m 2 m 3 ) m 5 m 2 : w 1 w 4 w 2 : (m 1 m 4 ) (m 3 m 5 ) m 3 : w 1 w 2 w 3 : m 4 m 4 : w 2 w 3 w 4 : m 2 m 5 : w 1 w 2 Mens preferencesWomens preferences

m 1 : w 1 w 2 w 1 : ( m 1 m 2 m 3 ) m 5 m 2 : w 1 w 4 w 2 : ( m 1 m 4 ) ( m 3 m 5 ) m 3 : w 1 w 2 w 3 : m 4 m 4 : w 2 w 3 w 4 : m 2 m 5 : w 1 w 2 Mens preferencesWomens preferences Phase 1 Example Allocation A 1 output by phase 1: A 1 = { ( m 1, w 1 ), ( m 2, w 1 ), ( m 3, w 1 ), ( m 4, w 2 ) } We note here that w 1 is multiply assigned. We note here that w 1 is multiply assigned.

Phase 2 : Network Construction Add source node s and sink node t. Add source node s and sink node t. For each multiply assigned woman w j, edge (s, w j ) with capacity 1 less than the number of assignees to w j. For each multiply assigned woman w j, edge (s, w j ) with capacity 1 less than the number of assignees to w j. For each unassigned woman w j, edge (w j, t) of capacity 1. For each unassigned woman w j, edge (w j, t) of capacity 1. Let m i be a man with 2 women left on his list. Let w j be m i s first-choice and w k be m i s second-choice. Add the edges (w j, m i ) and (m i, w k ) with capacity 1. Let m i be a man with 2 women left on his list. Let w j be m i s first-choice and w k be m i s second-choice. Add the edges (w j, m i ) and (m i, w k ) with capacity 1. Women with only 1 partner may be represented by a vertex as a result of this step. Women with only 1 partner may be represented by a vertex as a result of this step.

Phase 2 : Network st w1w1 w2w2 w3w3 w4w4 m2m2 m1m1 m4m4 2 1 1 11 1 1 1 1

Phase 2 : Lists m 1 : w 1 w 2 w 1 : ( m 1 m 2 m 3 ) m 5 m 2 : w 1 w 4 w 2 : ( m 1 m 4 ) ( m 3 m 5 ) m 3 : w 1 w 2 w 3 : m 4 m 4 : w 2 w 3 w 4 : m 2 m 5 : w 1 w 2 Mens preferencesWomens preferences

Phase 2 : Max Flow st w1w1 w2w2 w3w3 w4w4 m2m2 m1m1 m4m4 2 1 1 11 1 1 1 1 The maximum (saturating) flow gives rise to the following: The maximum (saturating) flow gives rise to the following: m 1 being moved from w 1 to w 2 ; m 1 being moved from w 1 to w 2 ; m 4 being moved from w 2 to w 3 ; m 4 being moved from w 2 to w 3 ; m 2 being moved from w 1 to w 4. m 2 being moved from w 1 to w 4.

Phase 2 : Allocation m 1 : w 1 w 2 w 1 : ( m 1 m 2 m 3 ) m 5 m 2 : w 1 w 4 w 2 : ( m 1 m 4 ) ( m 3 m 5 ) m 3 : w 1 w 2 w 3 : m 3 m 4 : w 2 w 3 w 4 : m 4 m 5 : w 1 w 2 Mens preferencesWomens preferences In this case we have found the maximum stable matching, namely: In this case we have found the maximum stable matching, namely: M = {( m 1, w 2 ), ( m 2,w 4 ), ( m 3,w 1 ), ( m 4,w 3 )}

Phase 3 In general there may still be women who are multiply assigned after phase 2. In general there may still be women who are multiply assigned after phase 2. It can proven, however, that if the remaining ties are broken arbitrarily and we continue with phase 1, a stable matching of maximum size is obtained. It can proven, however, that if the remaining ties are broken arbitrarily and we continue with phase 1, a stable matching of maximum size is obtained.

Open Problems Is (2,n)-MAX-HRT polynomial-time solvable? Is (2,n)-MAX-HRT polynomial-time solvable? Is the generalisation of (2,n)-MAX-SMTI and (2,n)-MAX-HRT in which both sides preference lists contain ties polynomial-time solvable? Is the generalisation of (2,n)-MAX-SMTI and (2,n)-MAX-HRT in which both sides preference lists contain ties polynomial-time solvable? Finding the exact boundary between P and NP- hard cases, i.e. when both men and women have preference lists of size at most 3 and their lists contain ties. Finding the exact boundary between P and NP- hard cases, i.e. when both men and women have preference lists of size at most 3 and their lists contain ties.

Download ppt "Stable Matching Problems with Constant Length Preference Lists Rob Irving, David Manlove, Gregg OMalley University Of Glasgow Department of Computing Science."

Similar presentations