埃德蒙兹在PHP最大匹配算法 [英] Edmonds maximum matching algorithm in PHP

查看:480
本文介绍了埃德蒙兹在PHP最大匹配算法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已搜查所有在互联网上试图找到例如code在PHP,但我不能这样做。我所试图做的是比赛的课程,房间,课程有集客房,他们是兼容的。

I have searched all over the internet trying to find example code in PHP but I am unable to do so. What I am trying to do is match courses to rooms where courses have a set of rooms that they are compatible with.

例如:课程A可以在房间X,Y和Z讲授,课程B室P和Q等

example: course A can be taught in rooms X, Y and Z, Course B rooms P and Q ect.

每个过程可以匹配到恰好一个室在给定的时隙。我要创建将接受这两套房间,课程内容和输出的最大匹配的功能。任何人都可以提供源$ C ​​$ C在PHP中,可以让我开始?我从来没有建立一个算法之前匹配和真的不知道从哪里开始。

Each course can be matched to exactly one room in a given timeslot. I have to create a function that will accept these two sets of rooms and courses and output a maximum matching. Can anyone provide source code in PHP that could get me started? I've never built an algorithm for matching before and don't really know where to begin.

推荐答案

您可以尝试伊戈尔Naverniouk的 $ C $下偶匹配。它是用C ++编写的,但你可以很容易地将其转换为PHP。

You can try Igor Naverniouk's library code for Bipartite Matching. It's written in C++, but you can easily convert it to PHP.

这篇关于埃德蒙兹在PHP最大匹配算法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆