‹ BackHN Continuity

Thread

Singapore govt dating app uses Gale-Shapley stable marriage algorithm

466 points · 499 comments · rzk

  1. qihqi · · focus · HN ↗
    Depending on the which gender does the initiation; the result is either male optimal (males get the best he can get, females gets the worst among those she would tolerate) or female optimal. I wonder which version this one is.
    1. jb1991 · · focus · HN ↗
      The article also mentioned that, but I don’t understand it. Receivers are also making choices, so why do they end up with the worst match?
      1. layman51 · · focus · HN ↗
        I think it can be a bit easier to think of the algorithm in terms of job applicants (who receive job offers) and employers (who propose job offers). And then due to the algorithm, it must be the case that the number of applicants is equal to the number of employers, and each employer is only trying to fill one position.

        An applicant (the receiver) will end up with a "worst" match in the sense that if you look at all "stable" pairings (there can be multiple configurations), the applicant is going to have the least favorable one among the different pairings.

        There's an important concept of a "blocking pair", and the Gale-Shapley algorithm is trying to eliminate all blocking pairs, and you could say that pairings are stable when no blocking pairs exist. A blocking pair is a job applicant and employer who aren't matched together, but both prefer each other over their current match.

        Suppose that after the algorithm is done with its work, Alice doesn't end up with a job offer from her top choice, Google. This must mean that Google never offered her a job because Alice was just too far down on their list, and Google made a deal with someone else they like better than Alice.

        1. jb1991 · · focus · HN ↗
          > configurations), the applicant is going to have the least favorable one among the different pairings.

          I don’t understand why this would always be true. In your example, Google may indeed like Alice, so they both get their top choice.

          1. layman51 · · focus · HN ↗
            If Google’s top choice is Alice, and Alice’s top choice is Google, then what will happen in the algorithm is that Alice will see an offer from Google and lock it down. Alice could get multiple offers but she will take the best one which is Google.

            When Alice and Google are not paired up, then they will always form a “blocking pair” in any matching where they aren’t together so that means any matching that doesn’t have Alice and Google paired is not stable.

            I think the confusion is that Alice only has one possible stable employer and thus her worst one happens to be her best one.

            If Alice’s top choice wasn’t Google, but some other company, then there might be multiple employers she could be matched with to form a stable pairing.

            This algorithm is definitely weird too though because it’s possible for some candidates to be paired with a company they don’t really like, but it’s considered a stable situation because the other companies don’t want them more than their current employees.

            I guess in real life, you could try improving yourself and then the matching becomes unstable again if preferences change.

            1. jb1991 · · focus · HN ↗
              > it’s possible for some candidates to be paired with a company they don’t really like, but it’s considered a stable situation

              Thus extrapolating to a dating app, it’s possible for someone in the matched pair to not really like the other person. Sounds like a rousingly success.

Open on Hacker News to reply ↗

Unofficial Hacker News client; not affiliated with Y Combinator.