A generic implementation of the Stable Match class of algorithms.