Gale-Shapley deferred acceptance matching advisors to students

This application takes individual student's and advisor's preferences as input.
Additionally, it also asks for advisors' capacities and returns the matching
of the students to advisors using the algorithm.

Implementing the student proposing matching

Students
Preference of Alice: Harpreet; Farzad; Ganesh;
Preference of Bob: Harpreet; Farzad; Ganesh;
Preference of Carol: Harpreet; Ganesh; Farzad;
Preference of Dave: Farzad; Harpreet; Ganesh;
Preference of Esther: Ganesh; Farzad; Harpreet;
Advisors
Preference of Farzad: Dave; Esther; Alice; Bob; Carol; Capacity = 1
Preference of Ganesh: Alice; Bob; Carol; Esther; Dave; Capacity = 2
Preference of Harpreet: Alice; Bob; Dave; Carol; Esther; Capacity = 1

Algorithm iterations

Student Alice approaches Advisor Harpreet
Advisor Harpreet tentatively accepts Student Alice
Student Bob approaches Advisor Harpreet
Advisor Harpreet rejects Student Bob
Student Bob approaches Advisor Farzad
Advisor Farzad tentatively accepts Student Bob
Student Carol approaches Advisor Harpreet
Advisor Harpreet rejects Student Carol
Student Carol approaches Advisor Ganesh
Advisor Ganesh tentatively accepts Student Carol
Student Dave approaches Advisor Farzad
Advisor Farzad rejects Student Bob and tentatively accepts Student Dave
Student Esther approaches Advisor Ganesh
Advisor Ganesh tentatively accepts Student Esther
Student Bob approaches Advisor Harpreet
Advisor Harpreet rejects Student Bob
Student Bob approaches Advisor Farzad
Advisor Farzad rejects Student Bob
Student Bob approaches Advisor Ganesh
Advisor Ganesh rejects Student Carol and tentatively accepts Student Bob
Student Carol approaches Advisor Harpreet
Advisor Harpreet rejects Student Carol
Student Carol approaches Advisor Ganesh
Advisor Ganesh rejects Student Esther and tentatively accepts Student Carol
Student Esther approaches Advisor Ganesh
Advisor Ganesh rejects Student Esther
Student Esther approaches Advisor Farzad
Advisor Farzad rejects Student Esther
Student Esther approaches Advisor Harpreet
Advisor Harpreet rejects Student Esther
Student Esther approaches Advisor Ganesh
Advisor Ganesh rejects Student Esther
Student Esther approaches Advisor Farzad
Advisor Farzad rejects Student Esther
Student Esther approaches Advisor Harpreet
Advisor Harpreet rejects Student Esther

Final assignment:

Advisor Farzad gets Dave;
Advisor Ganesh gets Bob; Carol;
Advisor Harpreet gets Alice;

Like this? Want more matching?