On Stable Marriages and Greedy Matchings
Fredrik Manne University of Bergen, Norway
- Md. Naim, Håkon Lerring, Mahantesh Halappanavar
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
Fredrik Manne University of Bergen, Norway
Objec&ve:
and compu&ng Greedy Matchings. Consequences:
The Stable Marriage (SM) problem has a long and rigorous history. Greedy Matchings (GM) have applica&ons in CSC applica&ons.
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
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
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
4 3 5 2 1 6
w(greedy) ≥ 0.5 w(optimal)
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
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:
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
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
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
for the many-to-many stable assignment problem.
makes no such assumption.
in O(m) time?
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)