How to Use the Hungarian Algorithm
How to Use the Hungarian Algorithm
The Hungarian algorithm allows a "minimum matching" to be found. This can be used in instances where there are multiple quotes for a group of activities and each activity must be done by a different person, to find the minimum cost to complete all of the activities.
Steps

Matrix1_393.jpgArrange your information in a matrix with the "people" on the left and the "activity" along the top, with the "cost" for each pair in the middle.

Matrix2_102.jpgEnsure that the matrix is square by the addition of dummy rows/columns if necessary. Conventionally, each element in the dummy row/column is the same as the largest number in the matrix.

Matrix3_952.jpgReduce the rows by subtracting the minimum value of each row from that row.

Matrix4_691.jpgIf there are columns without a zero, reduce the columns by subtracting the minimum value of each column from that column.

Matrix5_750.jpgCover the zero elements with the minimum number of lines it is possible to cover them with. (If the number of lines is equal to the number of rows then go to step 9)

Matrix6_172.jpgAdd the minimum uncovered element to every covered element. If an element is covered twice, add the minimum element to it twice.

Matrix7_164.jpgSubtract the minimum element from every element in the matrix.

Matrix8_43.jpgCover the zero elements again. If the number of lines covering the zero elements is not equal to the number of rows, return to step 6.

Matrix9_628.jpgSelect a matching by choosing a set of zeros so that each row or column has only one selected.

Matrix10_838.jpgApply the matching to the original matrix, disregarding dummy rows. This shows who should do which activity, and adding the costs will give the total minimum cost.

What's your reaction?

Comments

https://hapka.info/assets/images/user-avatar-s.jpg

0 comment

Write the first comment for this!