匈牙利算法又称KM算法,这是一个组合优化算法,
解决分配问题,维基地址:http://en.wikipedia.org/wiki/KM_algorithm
Assumption: There are n “jobs” and n “machines”.
Step 0: If necessary, convert the problem from a maximum assignment into a minimum
assignment. We do this by letting C = maximum value in the assignment matrix.
Replace each cij with C − cij . (see example 2).
Step1: From each row subtract off the row min.
Step 2: From each column subtract off the row column min.
Step 3: Use as few lines as possible to cover all the zeros in the matrix. There is no easy
rule to do this – basically trial and error.
Suppose you use k lines.
• If k < n, let m be the minimum uncovered number. Subtract m from every
uncovered number. Add m to every number covered with two lines. Go back
to the start of step 3.
• If k = n, goto step 4.
Step 4: Starting with the top row, work your way downwards as you make assignments.
An assignment can be (uniquely) made when there is exactly one zero in a row. Once
an assignment it made, delete that row and column from the matrix.
If you cannot make all n assignments and all the remaining rows contain more than
one zero, switch to columns. Starting with the left column, work your way rightwards
as you make assignments.
Iterate between row assignments and column assignments until you’ve made as many
unique assignments as possible. If still haven’t made n assignments and you cannot
make a unique assignment either with rows or columns, make one arbitrarily by
selecting a cell with a zero in it. Then try to make unique row and/or column
assignments. (See the examples below).
分享到:
相关推荐
使用java语言实现匈牙利算法。可实现任务最优分配,以及旅行商问题
指派问题的匈牙利算法,基本算法实现。 Hungarian algorithm for assignment problem
Hungarian algorithm + Kalman filter 采用匈牙利算法和卡尔曼滤波实现多个目标的跟踪,实现跟踪目标的交叉
用C语言编写的匈牙利算法,程序较长,可以运行。
著名的匈牙利算法介绍,Hungarian algorithm,用于解决矩形分配问题。该文档是Springer出版图书“50 Years of Integer Programming 1958-2008”的第二章节。
关于匈牙利算法的一个文档,匈牙利算法能解决常见的矩形分配问题。
图论中的匈牙利算法,对于研究网络的人十分的有用
Hungarian-algorithm-By-matlab:匈牙利算法 matlab 实现
The algorithm for munkres assignment allocation
匈牙利算法源码,封装为函数,可以直接调用,可以运行
匈牙利算法的 Julia 实现,用于在二分加权图中进行最佳匹配。
Hungarian Algorithm in Java
Algorithm-hungarian.zip,匈牙利算法的C 实现,算法是为计算机程序高效、彻底地完成任务而创建的一组详细的准则。
hungarian allocation algorithm for you
对异构网络下的信道环境进行建模,包括路径损耗,多径衰落效应,小尺度衰落,并给出了匈牙利算法的实现
学习该算法的可以借鉴一下!希望对你有用!
匈牙利算法第5号用于二部图的匈牙利匹配算法的实现,包括顶点权重。
1946 蒙特卡罗方法 1947 单纯形法 1950 Krylov子空间迭代法 1957 优化的Fortran编译器 1959-1961 计算矩阵特征值的QR算法 1962 快速排序算法 1965 快速傅立叶变换 1977 整数关系探测算法 1987 快速多极算法 ...
匈牙利算法可以描述为最佳解决工人与工作分配问题,从而最大程度地降低了总成本。 此实现假设成本矩阵为平方,即工作数量等于从事这些工作的工人数量。
hungarian算法的程序,有助于学习此算法的人