Closed Simon-Leroy closed 4 years ago
Hello and thank you for raising this issue. I have good news and bad news, however.
In the first case, yes, you can remove the obligation. This could be done by filtering out some list of banned pairs (or with a banned
dictionary) from the hospital and resident preferences before passing them to HospitalResident
:
resident_prefs = {
"A": ["C"],
"S": ["C", "M"],
"D": ["C", "M", "G"],
"J": ["C", "G", "M"],
"L": ["M", "C", "G"],
}
hospital_prefs = {
"M": ["D", "J"],
"C": ["D", "A", "S", "L", "J"],
"G": ["D", "A", "J", "L"],
}
banned_pairs = [("M", "L"), ("C", "J")]
for hospital, resident in banned_pairs:
hprefs = hospital_prefs[hospital]
rprefs = resident_prefs[resident]
if resident in hprefs:
hprefs.remove(resident)
hospital_prefs[hospital] = hprefs
if hospital in rprefs:
rprefs.remove(hospital)
resident_prefs[resident] = rprefs
Unfortunately, however, you can't allow hospital agents to be paired with resident agents that they do not find mutually acceptable. If that were allowed, the algorithm would not be able to terminate.
What I would recommend is effectively completing the process again with the new preferences found during the interview stage. The runtime of the algorithm should be very low even for a game with several hundred agents so that aspect should be alright.
I hope that makes sense!
Thanks a lot ! I'll try this
Hello there ! I’m trying to use this library to assign students to student societies at my university in France. Each student gives its preferences and each student society does the same but sometimes a society can refuse a student and not put him or her on the list. So I was wondering if there is a way to remove the obligation for a hospital to rank every residents who ranked it? And also have the hospitals rank residents that did not rank them? (After an interview between the two parties the whole process is kind of secret, a student doesn’t know if he will ranked by a society and vice-versa). It’s not a problem if some residents are unassigned or if some hospitals are not full. Sorry if I’m not very clear, my English is not perfect. Thanks a lot!