且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

预约调度算法(N人有N个空闲-忙时隙,约束满足)

更新时间:2023-02-26 20:35:01

正如你所指出的,这个问题等价于在二部图中寻找最大匹配的问题(一组顶点是人和槽集上的其他人,如果该人可用于该槽,则该人与该槽之间存在边).

As you pointed out, the problem is equivalent to the problem of finding a maximum matching in a bipartite graph (one set of vertices is the set of people and the other on the set of slots, there is an edge between a person and a slot if the person is available for this slot).

这个问题可以用 Hopcroft-Karp 算法解决.

This problem can be solved with the Hopcroft-Karp algorithm.

最坏情况下的复杂度为 O(n^(5/2)),如果图稀疏则更好.

Complexity O(n^(5/2)) in the worst case, better if the graph is sparse.