On Stable Marriages and Greedy Matchings Fredrik Manne University - - PowerPoint PPT Presentation

on stable marriages and greedy matchings
SMART_READER_LITE
LIVE PREVIEW

On Stable Marriages and Greedy Matchings Fredrik Manne University - - PowerPoint PPT Presentation

On Stable Marriages and Greedy Matchings Fredrik Manne University of Bergen, Norway Md. Naim, Hkon Lerring, Mahantesh Halappanavar Background The Stable Marriage (SM) problem has a long and rigorous history. Greedy Matchings (GM) have


slide-1
SLIDE 1

On Stable Marriages and Greedy Matchings

Fredrik Manne University of Bergen, Norway

  • Md. Naim, Håkon Lerring, Mahantesh Halappanavar
slide-2
SLIDE 2

Background

Objec&ve:

  • Formalize the connec&ons between the Stable Marriage problem

and compu&ng Greedy Matchings. Consequences:

  • Many ”new” algorithms for compu&ng GM are variants of algorithms for SM.
  • Parallel algorithms for compu&ng GM can also be applied to SM.

The Stable Marriage (SM) problem has a long and rigorous history. Greedy Matchings (GM) have applica&ons in CSC applica&ons.

slide-3
SLIDE 3

The Stable Marriage Problem

m1 w1 m2 w2 m3 w3 m4 w4 (w3, w2, w1, w4) (w1, w4, w3, w2) (w1, w2, w3, w4) (w2, w4, w3, w1) (m4, m2, m3, m1) (m1, m2, m3, m4) (m3, m2, m1, m4) (m2, m4, m3, m1) 1 2 3 4 1 2 3 4

slide-4
SLIDE 4

The Gale-Shapley Algorithm

m1 w1 m2 w2 m3 w3 m4 w4 (w3, w2, w1, w4) (w1, w4, w3, w2) (w1, w2, w3, w4) (w2, w4, w3, w1) (m4, m2, m3, m1) (m1, m2, m3, m4) (m3, m2, m1, m4) (m2, m4, m3, m1) 1 2 3 4 1 2 3 4

slide-5
SLIDE 5

The McVitie-Wilson Algorithm

m1 w1 m2 w2 m3 w3 m4 w4 (w3, w2, w1, w4) (w1, w4, w3, w2) (w1, w2, w3, w4) (w2, w4, w3, w1) (m4, m2, m3, m1) (m1, m2, m3, m4) (m3, m2, m1, m4) (m2, m4, m3, m1) 1 2 3 4 1 2 3 4 Implementation: GS uses a queue while MW uses a stack for the remaining men

slide-6
SLIDE 6

Greedy Matching

4 3 5 2 1 6

M = Ø While there are edges remaining e = heaviest edge M = M U {e} remove edges incident on e

w(greedy) ≥ 0.5 w(optimal)

slide-7
SLIDE 7

Computing a Greedy Matching using a Stable Marriage algorithm

4 3 5 2 1 6 m1 w1 m2 w2 m3 w3 m4 w4 (w3, w4, w2) (w1, w3, w4) (w1, w2, w4) (w1, w3, w2) (m3, m4, m2) (m1, m3, m4) (m1, m2, m4) (m1, m3, m2) 1 2 3 4

slide-8
SLIDE 8

Using McVitie-Wilson directly

m1 m3 m4 (m3, m4, m2) (m1, m3, m4) (m1, m2, m4) (m1, m3, m2) m2

This is exactly the suitor-algorithm [Manne & Halappanavar 14] which builds on:

  • The pointer algorithm [Manne & Bisseling 08]
  • The Preis algorithm [Preis 99]
slide-9
SLIDE 9

Going parallel

t1 t2 t3 t4 Use compare-and-swap to protect “women” Threads run either the Gayle-Shapley or the McVitie-Wilson algorithm Implementations using both OpenMP and GPU

slide-10
SLIDE 10

“Easy” problems

  • Each man selects between log n and 2 log n women and ranks randomly.
  • Women rank men who rank them (randomly).
  • Expected total work n log n

OpenMP: Using 36 threads on two Intel Xeon E5-2699 processors GPU: Tesla K40m with 2880 cores

5M 10M 15M 20M 25M 0.2 0.4 0.6 0.8 1 1.2 N Time (seconds) OpenMP: McVitie-Wilson OpenMP: Gale-Shapley GPU: McVitie-Wilson 5M 10M 15M 20M 25M 6 8 10 12 14 16 18 N Speedup Gale-Shapley OpenMP speedup McVitie-Wilson GPU speedup

slide-11
SLIDE 11

“Hard” problems

  • Each man uses the same total ranking of all the women
  • Each woman uses the same total ranking of all the men.
  • Expect high contention for the same “women”
  • Total work will be (n+1)n/2

100K 200K 300K 400K 500K 50 100 150 200 250 N Time (seconds) OpenMP: McVitie-Wilson OpenMP: Gale-Shapley GPU: McVitie-Wilson 1 9 18 27 36 5 10 15 20 Threads Speedup 400K McVitie-Wilson 400K Gale-Shapley 500K McVitie-Wilson 500K Gale-Shapley

slide-12
SLIDE 12

Concluding Remarks

  • Recent greedy b-matching algorithms also follows directly from algorithms

for the many-to-many stable assignment problem.

  • Major open question [Manlove 13]: Is Stable Marriage in NC?
  • Maybe not so relevant…
  • Stable Marriage assumes sorted priority lists, whereas Greedy Matching

makes no such assumption.

  • Preis solved Greedy Matching in O(m) time.
  • Can Stable Matching with unsorted weighted priority lists also be solved

in O(m) time?

slide-13
SLIDE 13

Gale-Shapley implementation

Place all vertices in queue Q while Q ≠ Ø u = Q.first() p = nextCandidate(u) while rp(u) > rp(suitor(p)) p = nextCandidate(u) if suitor(p) ≠ null Q.add(suitor(p)) suitor(p) = u (w3, w2, w1, w4) (m4, m2, m3, m1) u p p p p suitor(p)