Closed agt64 closed 4 years ago
Hi there. Thanks for raising this issue @magnate64. The issue here is that S
has not ranked G
meaning that G
may try to either match with or hold out for S
without any reciprocation. This, and the other constraints of the game, are discussed in the documentation if you want to read more around the topic.
I appreciate that the exception raised isn't the clearest as it should read as something along the lines of Exception: G has not ranked all (and only) the residents that ranked it: {S, J, L, D} != {J, L, D}
. This is something I'll be looking into improving in an upcoming release (#89).
Awesome! Thank you for the clarification!
Awesome package!
I took your example from https://pypi.org/project/matching/ and changed it very slightly, but it throws and exception "Exception: G has not ranked all the residents that ranked it: {S, J, L, D} != {J, L, D}."
I simply added resident "S" to hospital "G"s preference list at the end. That is, instead of "G": ["D", "J","L"], I added "G": ["D", "J","L","S" ] and I receive the exception and the program doesn't run.
Am I misunderstanding why hospital G can't put resident S? As far as the exception, I did try to address it by putting all the residents in G's preference list as well.
Here is my full code which causes the exception: from matching import Player resident_prefs = { "A": ["C"], "S": ["C", "M"], "D": ["C", "M", "G"], "J": ["C", "G", "M"], "L": ["M", "C", "G"], } hospital_prefs = { "M": ["D", "L", "S", "J"], "C": ["D", "A", "S", "L", "J"], "G": ["D", "J","L","S" ], } capacities = {hosp: 2 for hosp in hospital_prefs}
from matching.games import HospitalResident game = HospitalResident.create_from_dictionaries( resident_prefs, hospital_prefs, capacities ) results = game.solve() print(results)