diff --git a/hungarian algorithm b/hungarian algorithm new file mode 100644 index 00000000..2b6cccbc --- /dev/null +++ b/hungarian algorithm @@ -0,0 +1,7 @@ +Core of the algorithm (assuming square matrix): + +For each row of the matrix, find the smallest element and subtract it from every element in its row. +Do the same (as step 1) for all columns. +Cover all zeros in the matrix using minimum number of horizontal and vertical lines. +Test for Optimality: If the minimum number of covering lines is n, an optimal assignment is possible and we are finished. Else if lines are lesser than n, we haven’t found the optimal assignment, and must proceed to step 5. +Determine the smallest entry not covered by any line. Subtract this entry from each uncovered row, and then add it to each covered column. Return to step 3.