py school match是一个python包,它实现了学生到学校分配问题的匹配算法。

py-school-match的Python项目详细描述


https://img.shields.io/badge/License-GPL%20v3-blue.svg

py学校匹配

py school match是一个开源的python包,它实现了多个匹配算法,以便分配 学生们去学校。

它提供了多种随时可用的算法:

  • 最高交易周期(TTC)
  • 多次拆线延迟验收(DAMTB)
  • 单次拆线延迟验收(DASTB)
  • 稳定改善周期(SiC)
  • 延迟验收,多个系紧断裂,加上稳定循环(MSIC)
  • 延迟验收,单系断开,加上非稳定循环(NSIC)

py school match是专门为学生到学校分配问题设计的。因为这个, 您可以专注于评估不同的设置和算法,而无需调整或开发 完整的解决方案。

示例代码

importpy_school_matchaspsm# Creating three students.st0=psm.Student()st1=psm.Student()st2=psm.Student()# Creating a criteria. This means 'vulnerable' is now a boolean.vulnerable=psm.Criteria('vulnerable',bool)# Assigning st1 as vulnerablestudent_vulnerable=psm.Characteristic(vulnerable,True)st1.add_characteristic(student_vulnerable)# Creating three schools, each with one seat available.sc0=psm.School(1)sc1=psm.School(1)sc2=psm.School(1)# Defining preferences (from most desired to least desired)st0.preferences=[sc0,sc1,sc2]st1.preferences=[sc0,sc2,sc1]st2.preferences=[sc2,sc1,sc0]# Creating a lists with the students and schools defined above.schools=[sc0,sc1,sc2]students=[st0,st1,st2]# Defining a rulesetruleset=psm.RuleSet()# Defining a new rule from the criteria above.rule_vulnerable=psm.Rule(vulnerable)# Adding the rule to the ruleset. This means that a 'vulnerable' student has a higher priority.# Note that rules are added in order (from higher priority to lower priority)ruleset.add_rule(rule_vulnerable)# Creating a social planner using the objects above.planner=psm.SocialPlanner(students,schools,ruleset)# Selecting an algorithmalgorithm=psm.SIC()# Running the algorithm.planner.run_matching(algorithm)# inspecting the obtained assignationforstudentinstudents:print("Student {} was assigned to School {}".format(student.id,student.assigned_school.id))

安装

依赖关系

  • 图形工具(>;=2.27)

用户安装

pip install py-school-match

或者您可以克隆repo并安装它:

git clone https://github.com/igarizio/py-school-match
cd py-school-match
python setup.py install

记得先安装graph-tool

开发
贡献是非常受欢迎的。请随时提出问题或与我联系!
请记住,此软件包不提供任何形式的担保。

如何引用?

在此处插入引文。

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
Java:在迭代器类型(接口/实现类)之间转换?   java“Click Method”不断返回“Stale Element Exceoption”?   Android应用程序/进程的java生命周期?   java在发布消息时收到“无法识别的Windowssocket错误:0:recv失败”   java如何返回第二个值   java将基本授权头添加到一些请求中   使用改型安卓的java Post请求错误   PropertyPlaceHolderConfigure位置内的java Spring占位符   java是导入com的工具。谷歌。安卓gms。gcm无法解决,Google Play服务已经安装   java如何获取JSON数据的多个可选值?   java如何使用ApachePOI从word中的形状读取文本   安卓 java。Eclipse中的lang.NoClassDefFoundError,但不适用于Ant   如何在Java中用stream()将Map<v1,Set<v2>>转换为Map<v2,Set<v1>>   循环在java中循环时,如何从数组列表中删除某些内容?