Hungarian Method
Hungarian Method
The first thing we have is the matrix that is given at the beginning of the problem.
A B C D E
1 5 6 4 8 3
2 6 4 9 8 5
3 4 3 2 5 4
4 7 2 4 5 3
5 3 6 4 5 9
A B C D E
1 2 3 1 5 0
2 2 0 5 4 1
3 2 1 0 3 2
4 5 0 2 3 1
5 0 3 1 2 6
Following the rule we try to cover all the zeros with the least lines
A B C D E
1 2 3 1 3 0
2 2 0 5 2 1
3 2 1 0 1 2
4 5 0 2 1 1
5 0 3 1 0 6
Since we have not enough lines we do the steps necessary to have one more
A B C D E
1 2 4 1 3 0
2 1 0 4 1 0
3 2 2 0 3 2
4 4 0 1 0 0
5 0 4 1 2 6
A B C D E
1 5 6 4 8 3
2 6 4 9 8 5
3 4 3 2 5 4
4 7 2 4 5 3
5 3 6 4 5 9