Is there good implementation of Hungarian algorithm in standard python libraries?
1) Find the minimum number in each row and subtract it from all elements in the row. 2) Find the minimum number in each column and subtract it from all elements in the column. 3) Cover all zeroes with minimum number of vertical and/or horizontal lines.
The Hungarian Algorithm is used to find the minimum cost in assignment problems that involve assigning people to activities. To use this algorithm, we start by organizing our data into a matrix with people as the rows and activities as the columns.
This association problem can be optimally solved using the Hungarian algorithm. The Hungarian algorithm allows you to select n elements from an n by n matrix so that there is exactly one element in each row and one in each column, and the sum of the related costs is either minimized or maximized.
The Hungarian Method is based on the principle that if a constant is added to every element of a row and/or a column of cost matrix, the optimum solution of the resulting assignment problem is the same as the original problem and vice versa.
I just tried:
pip install munkres
and it worked. Here you can find a short explanation on how to use it.
I got an error trying to install "hungarian".
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With