From e7cbbf92efdd56db0b83951799f457dc838807c0 Mon Sep 17 00:00:00 2001 From: Chinmay Lohani <56592002+Golden-Hunter@users.noreply.github.com> Date: Thu, 14 Oct 2021 12:00:58 +0530 Subject: [PATCH] algorithm for assignment problem --- hungarian algorithm | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 hungarian algorithm 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.