Gale-Shapley stable matching algorithm implemented in Java.
I think the following implements the Gale-Shapley algorithm where each person's preference ordering is given as an array of scores over the members of the opposite sex. As an aside, I just found out that David Gale passed away. A JAVA Program for the Gale-Shapley Algorithm. Department of Mathematics. Iona College.
Input: a text file that defines the preference list of each man and woman, where there are n number of men and n number of women. Each person lists n people in their pref list.
On each line of the input file, the first word is the person that is listing their preferences, and the following words on that line are their preferences in order of importance.
![Gale shapley algorithm java Gale shapley algorithm java](/uploads/1/2/5/2/125218888/630275415.png)
Output: Each line represents a couple. Each couple, obviously, consists of one man and one woman. There are n number of couples (or lines) in the output, and they are paired such that they are a stable matching.
Gale-Shapley stable matching algorithm implemented in Java.
Input: a text file that defines the preference list of each man and woman, where there are n number of men and n number of women. Each person lists n people in their pref list.
On each line of the input file, the first word is the person that is listing their preferences, and the following words on that line are their preferences in order of importance.
Output: Each line represents a couple. Each couple, obviously, consists of one man and one woman. There are n number of couples (or lines) in the output, and they are paired such that they are a stable matching.