forked from tdedecko/hungarian-algorithm
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathREADME
More file actions
32 lines (25 loc) · 967 Bytes
/
Copy pathREADME
File metadata and controls
32 lines (25 loc) · 967 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
Implementation of the Hungarian (Munkres) Algorithm using Python and NumPy.
Usage:
hungarian = Hungarian(costMatrix)
hungarian.calculate()
or
hungarian = Hungarian()
hungarian.calculate(costMatrix)
Handle Profit matrix:
hungarian = Hungarian(profitMatrix, isProfitMatrix=True)
or
costMatrix = Hungarian.makeCostMatrix(profitMatrix)
The matrix will be automatically padded if it is not square.
The matrix can be padded with:
paddedMatrix = Hungarian.padMatrix(costMatrix)
Get results and total potential after calculation:
hungarian.getResults()
hungarian.getTotalPotential()
Released under MIT License.
Source repository: git://github.com/tdedecko/hungarian-algorithm.git
References:
http://www.ams.jhu.edu/~castello/362/Handouts/hungarian.pdf
http://weber.ucsd.edu/~vcrawfor/hungar.pdf
http://en.wikipedia.org/wiki/Hungarian_algorithm
http://www.public.iastate.edu/~ddoty/HungarianAlgorithm.html
http://www.clapper.org/software/python/munkres/