Class WeaklyStableMarriage<T>

  • Type Parameters:
    T - the type of the record.
    All Implemented Interfaces:
    Assigner<T>, BipartiteMatcher<T>

    public final class WeaklyStableMarriage<T>
    extends AbstractStableMarriage<T>
    Implements a weakly stable matching based on the stable marriage with indifference (i.e., ties).

    "A matching will be called weakly stable unless there is a couple each of whom strictly prefers the other to his/her partner in the matching. It is not hard to see that, in the stable marriage case, if ties are broken arbitrarily, any matching that is stable in the resulting (strict) instance is weakly stable in the original instance. So the Gale/Shapley algorithm (or other algorithms that find a stable matching in the classical case) may be applied in this context to find a weakly stable matching."[1]

    The preference list may be incomplete if some pairs absolutely do not want to matched. However, in this case, there may be fewer matches than elements.

    [1] Irving, Robert W. (1994-02-15). "Stable marriage and indifference". Discrete Applied Mathematics. 48 (3): 261–272. doi:10.1016/0166-218X(92)00179-P.

    • Constructor Detail

      • WeaklyStableMarriage

        public WeaklyStableMarriage()
    • Method Detail

      • createMatcher

        protected AbstractStableMarriage.Matcher createMatcher​(java.util.List<? extends java.util.Queue<java.util.List<java.lang.Integer>>> mensFavoriteWomen,
                                                               java.util.List<? extends java.util.Queue<java.util.List<java.lang.Integer>>> womensFavoriteMen)
        Specified by:
        createMatcher in class AbstractStableMarriage<T>
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • equals

        public boolean equals​(java.lang.Object o)
        Overrides:
        equals in class java.lang.Object
      • canEqual

        protected boolean canEqual​(java.lang.Object other)
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object