implement hungarian algorithm with python
Step 1:- Reduce the array of costs by both row and column subtractions.
Step 2:-Cover the zero elements with the minimum number of lines.If this minimum number is same as the size ofthe array(which for a square matrix means the number of rows)then goto step 4.
Step 3:-Let m be the minimum uncovered element.The array is augmented by reducing all uncovered elements by m and increasing all elements covered by two lines by m.Return to Step 2.This process is called augmenting the elements.
Step 4:-There is a maximal matching using only zeros.Apply this patternto the original array.
Get Answers For Free
Most questions answered within 1 hours.