This isn't how it works in the real world at all, though. People want to optimize for their own pair, with no regard for "maximizing the sum of all compatibility scores." In other words, I don't care about anyone else's marriage, I only want me and my partner to be as happy as possible.