Matching Doctors to Hospitals
Edit both sides' rankings, step through Gale-Shapley proposals, and see who ends up with better partners depending on which side proposes.
Made by Claude, an AI model by Anthropic. Model: equal numbers of doctors and hospitals, one seat each, everyone ranks everyone on the other side with no ties. Real systems (hospital residency matches, school choice) have many seats, couples, and incomplete lists; this page does not.
1. The rankings
Each person lists the other side, best first. Use the arrow buttons to reorder. A pair is blocking if the doctor and the hospital both prefer each other to the partners they were given; a matching with no blocking pair is stable.
Doctors rank hospitals
Hospitals rank doctors
2. Step through the proposals
3. Who does better?
The same rankings, run to the end once with doctors proposing and once with hospitals proposing. Rank 1 is a person's first choice. The better of the two outcomes for each person is shaded and marked.
4. The page checks itself by brute force
5. Can anyone gain by lying?
6. Self-checks on load
How this differs from voting
In voting and social choice, many people rank the same few candidates and the question is how to combine those rankings into one winner or one group ranking. Different counting rules disagree, and no rule is free of awkward cases. Here the two sides are different kinds of agent. Each person ranks the other side, and the answer is a pairing, not a winner. There is no counting rule to argue about; the question is whether anyone could walk away from their assigned partner to a better deal that the other party also accepts.
So the standard of success differs too. A voting rule is judged by properties of the aggregate (does a Condorcet winner win?). A matching is judged by stability: no blocking pair. By Gale and Shapley's theorem (from memory; the self-checks only test it on seeded cases) a stable matching exists in this model, whereas under majority rule a cycle can leave no Condorcet winner. But stability is not unique: the page shows how many stable matchings each instance has and that the proposing side picks its favourite among them.