1.1.0 • Published 4 years ago

matchingev-one v1.1.0

Weekly downloads
3
License
ISC
Repository
github
Last release
4 years ago

This module is based on the stable marriage algorithm, two groups or people rate the other group based on preference and the matcher will create couples according to each persons preference, for more info : https://en.wikipedia.org/wiki/Stable_marriage_problem

START:

npm install matchingev-one

FROM YOUR COMPONENT: import Matcher from 'matchingev-one'

Create new instance of Matcher matcher = new Matcher()

If you already have two teams build up with each person of the team rating the people on opposite team just call the matching function matcher.match(a, b)

In both teams each person choses who they want to pair with from the other team, in order of preference. a = { sara: 'mike', 'martha', linda: 'martha', 'mike', }

b = { martha: 'sara', 'linda', mike: 'sara', 'linda' }

If teams are not build yet:

matcher.addGroupA(..names) matcher.addGroupB(...matches)

//make sure both teams have the same number of members

For each person add their preferences:

matcher.addByPreference('sara', 'mike', 'martha') ...

Once teams are built call the matcher without arguments

matcher.match()

[ 'sara', 'mike', 'martha', 'linda' ]

1.1.0

4 years ago

1.0.9

4 years ago

1.0.8

4 years ago

1.0.7

4 years ago

1.0.6

4 years ago

1.0.5

4 years ago

1.0.4

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago