class StableMarriage

Constants

VERSION

Attributes

match_set[R]

Public Class Methods

new() click to toggle source
# File lib/stable_marriage.rb, line 5
def initialize
  @match_set = MatchSet.new
end

Public Instance Methods

add_match(suitor, suitee, score) click to toggle source

The the matching between the suitor and suitee with the match score.

@param suitor [Object] the proposal maker in the Gale-Shapely algorithm.

This party tends to fare better than the suitee in the algorithm.

@param suitee [Object] the proposal acceptor/rejector in the Gale-Shapely

algorithm.

@param score [Numeric] a numeric representation of the strength of the

match. A higher score means a better match.
# File lib/stable_marriage.rb, line 17
def add_match(suitor, suitee, score)
  match_set.add(suitor, suitee, score)
end
proposals() click to toggle source

A map with suitors as keys and suitees as objects

@return [Hash<Object, Object>] the final matching between suitors and

suitees.
# File lib/stable_marriage.rb, line 25
def proposals
  MatchMaker.new(match_set).proposals
end