夫妻稳定匹配问题的一个包
scarfmatch的Python项目详细描述
围巾
scarf是一个python库,用于解决夫妻之间的稳定匹配问题,其中一个应用程序是National Resident Matching Program。该软件包以围巾引理和算法的发明者hebert scarf命名。
功能
- 用Python写的。
- 考虑到医生和医院的偏好以及医院的能力,求解近似可行的稳定匹配。
- 生成随机的医生医院实例。
- 用麻木加速。太快了!
接受的输入格式:
- python列表
- json
算法:
- 迭代舍入的scarf算法[Nguyen and Vohra 2016]
安装
pip install scarfmatch
用法
import scarf
single_pref = [[0, 1, 2],
[1, 0]]
couple_pref = [[(0, 0), (1, 1), (1, 0), (0, 1), (2, 2)],
[(1, 1), (2, 2), (1, -1)]]
hospital_pref = [0, (0, 1), 1, (1, 0), (0, 0), (1, 1)]
hospital_cap = [2, 3, 1]
S = scarf.create_instance(single_pref, couple_pref, hospital_pref, hospital_cap)
sol = scarf.solve(S)
支架
许可证
根据麻省理工学院许可证发布
Copyright (c) 2019 Dengwang Tang <dwtang@umich.edu>