This program implements the Gale-Shapley algorithm to produce a list of stable matches.
The program is given two files of unique names and each names' partner prefernces.
EX: File1: {"Alex: Devin, Frank, Erik", "Bob: Frank, Erik, Devin", "Charles: Devin, Erik, Frank"}
File2: {"Devin: Charles, Bob, Alex", "Erik: Bob, Charles, Alex", "Frank: Bob, Alex, Charles"}
Preferences are listed from left to right. In this case, Alex prefers to be partnered with Devin the most and Erik the least.
Once given two files in this format, the algorithm will begin to pair each person.
A match is considered stable if there are no two pairs (a, b) and (a’, b’) such that a’ is higher preference for b than a,
and b is higher preference for a’ than b’. (There are no two pairs where two people in different pairs prefer each other more than their current partners.)
For the lists above, a stable matching would be the following:
Alex + Erik, Bob + Frank, Charles + Devin
Although Alex and Erik prefer each other the least, since no other person prefers them over their current partner, the matches are still considered stable.
-
Notifications
You must be signed in to change notification settings - Fork 0
karinashin/Stable_Matching_Project
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
About
No description, website, or topics provided.
Resources
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published