0

To my understanding SMP will always have a stable solution as long as the graph is complete. In other words every male may are able to marry every female and vice versa.

But what if this does not hold true? Lets say that some males have a list of females that they can not marry under any circumstances.

Is this another problem or does it exist a good algorithm to solve this problem. This problem should not always have a solution I presume, but I would like to get an as good as possible solution.

Chippen
  • 349
  • 2
  • 9
  • The fact that complete graphs always have a stable solution does not imply that all non-complete graphs have no stable solution. – beaker Jun 02 '14 at 15:55
  • I agree, but the fact that there might not exist a solution where all nodes are matched means that the Hungarian algorithm probably isn't the best choice? – Chippen Jun 02 '14 at 16:22
  • Since the Hungarian algorithm is usable in general assignment problems, even those in which some costs are infinite, I would think that it would be applicable here. That's not an unequivocal answer, I know, which is why it's a comment rather than an answer. That being said, I have solved something similar as a constraint satisfaction problem using local search (I think I used a min-conflicts heuristic), if that helps any. Should be quicker than O(n^3) or whatever the Hungarian algorithm is. – beaker Jun 03 '14 at 18:57

1 Answers1

0

Not sure how efficient you need this to be but my standard matching algorithm is to just make a bipartite graph and run max flow on it. This would work here to find a matching, and would even work if some nodes are orphaned and can't be matched with anyone.

Now to find a good solution that is valid you could use min-cost max-flow. When constructing the graph 1 set is the males all connected to the source with a cost 0, capacity 1. Then the other set is the females connected to the sink cost 0, capacity 1. Now connect each male/female pair with an edge that has capacity 1, and a cost that is some metric of how good the match is (perhaps the sum of their indices in each others' preference list, or square of the sum?). Now your matching will be minimized based on whatever metric you choose.

Not exactly optimal but will probably have a good solution and you can tweak it based on your data.

kyldvs
  • 61
  • 3