Hungarian Method Calculator
Hungarian Method Calculator
We use cookies to improve your experience on our site and to show you relevant advertising. By browsing this website, you agree to our use of cookies. Learn more Acce
Support us
I want to sell my website www.AtoZmath.com with complete code
Home > Operation Research calculators > Assignment Problem calculator (Using Hungarian method-1)
Job 1 2 3 4 5 6
Work
A 12 13 16 13 13 12
B 16 20 21 22 21 16
C 20 21 23 23 21 20
D 25 22 22 22 24 22
E 23 23 25 25 20 20
F 17 19 19 17 17 18
A 12 13 16 13 13 12
B 16 20 21 22 21 16
C 20 21 23 23 21 20
D 25 22 22 22 24 22
E 23 23 25 25 20 20
F 17 19 19 17 17 18
Solution:
https://cbom.atozmath.com/CBOM/Assignment.aspx?q=hm&q1=12%2c13%2c16%2c13%2c13%2c12%3b16%2c20%2c21%2c22%2c21%2c16%… 1/7
6/14/23, 11:12 PM Hungarian method calculator
The number of rows = 6 and columns = 6
1 2 3 4 5 6
A 12 13 16 13 13 12
B 16 20 21 22 21 16
C 20 21 23 23 21 20
D 25 22 22 22 24 22
E 23 23 25 25 20 20
F 17 19 19 17 17 18
Here the problem is of Maximazition type and convert it into minimization by substracting it from maximum
1 2 3 4 5 6
A 13 12 9 12 12 13
B 9 5 4 3 4 9
C 5 4 2 2 4 5
D 0 3 3 3 1 3
E 2 2 0 0 5 5
F 8 6 6 8 8 7
Step-1: Find out the each row minimum element and subtract it from that row
1 2 3 4 5 6
A 4 3 0 3 3 4 (-9)
B 6 2 1 0 1 6 (-3)
C 3 2 0 0 2 3 (-2)
D 0 3 3 3 1 3 (-0)
E 2 2 0 0 5 5 (-0)
F 2 0 0 2 2 1 (-6)
Step-2: Find out the each column minimum element and subtract it from that column.
1 2 3 4 5 6
A 4 3 0 3 2 3
B 6 2 1 0 0 5
C 3 2 0 0 1 2
D 0 3 3 3 0 2
E 2 2 0 0 4 4
F 2 0 0 2 1 0
(-0) (-0) (-0) (-0) (-1) (-1)
Iteration-1 of steps 3 to 6
+ Step-3: Make assignment in the opporunity cost table
Step-3: Make assignment in the opporunity cost table
(1) Rowwise cell (A, 3) is assigned, so columnwise cell (C, 3),(E, 3),(F, 3) crossed off.
(2) Rowwise cell (C, 4) is assigned, so columnwise cell (B, 4),(E, 4) crossed off.
(3) Rowwise cell (B, 5) is assigned, so columnwise cell (D, 5) crossed off.
(5) Columnwise cell (F, 2) is assigned, so rowwise cell (F, 6) crossed off.
https://cbom.atozmath.com/CBOM/Assignment.aspx?q=hm&q1=12%2c13%2c16%2c13%2c13%2c12%3b16%2c20%2c21%2c22%2c21%2c16%… 2/7
6/14/23, 11:12 PM Hungarian method calculator
B 6 2 1 0 [0] 5
C 3 2 0 [0] 1 2
D [0] 3 3 3 0 2
E 2 2 0 0 4 4
F 2 [0] 0 2 1 0
+ Step-5: Draw a set of horizontal and vertical lines to cover all the 0
Step-5: Cover the 0 with minimum number of lines
(1) Mark(✓) row E since it has no assignment
(6) Since no other rows or columns can be marked, therefore draw straight lines through the unmarked row
marked columns 3, 4
D [0] 3 3 3 0 2
E 2 2 0 0 4 4 ✓(1)
F 2 [0] 0 2 1 0
✓ ✓
(2) (3)
A 3 2 0 3 1 2
B 6 2 2 1 0 5
C 2 1 0 0 0 1
D 0 3 4 4 0 2
E 1 1 0 0 3 3
F 2 0 1 3 1 0
Iteration : 1
https://cbom.atozmath.com/CBOM/Assignment.aspx?q=hm&q1=12%2c13%2c16%2c13%2c13%2c12%3b16%2c20%2c21%2c22%2c21%2c16%… 3/7
6/14/23, 11:12 PM Hungarian method calculator
Iteration-2 of steps 3 to 6
Step-3: Make assignment in the opporunity cost table
(1) Rowwise cell (A, 3) is assigned, so columnwise cell (C, 3),(E, 3) crossed off.
(2) Rowwise cell (B, 5) is assigned, so columnwise cell (C, 5),(D, 5) crossed off.
(3) Rowwise cell (C, 4) is assigned, so columnwise cell (E, 4) crossed off.
(5) Columnwise cell (F, 2) is assigned, so rowwise cell (F, 6) crossed off.
C 2 1 0 [0] 0 1
D [0] 3 4 4 0 2
E 1 1 0 0 3 3
F 2 [0] 1 3 1 0
(8) Since no other rows or columns can be marked, therefore draw straight lines through the unmarked row
columns 3, 4, 5
E 1 1 0 0 3 3 ✓(1)
F 2 [0] 1 3 1 0
✓ ✓ ✓
(2) (3) (6)
Step-6: Develop the new revised table by selecting the smallest element, among the cells not covered by a
Subtract k = 1 from every element in the cell not covered by a line.
Add k = 1 to every elment in the intersection cell of two lines.
B 5 1 2 1 0 4
C 1 0 0 0 0 0
D 0 3 5 5 1 2
https://cbom.atozmath.com/CBOM/Assignment.aspx?q=hm&q1=12%2c13%2c16%2c13%2c13%2c12%3b16%2c20%2c21%2c22%2c21%2c16%… 4/7
6/14/23, 11:12 PM Hungarian method calculator
E 0 0 0 0 3 2
F 2 0 2 4 2 0
Iteration : 2
Iteration-3 of steps 3 to 6
Step-3: Make assignment in the opporunity cost table
(1) Rowwise cell (A, 3) is assigned, so columnwise cell (C, 3),(E, 3) crossed off.
(2) Rowwise cell (B, 5) is assigned, so columnwise cell (C, 5) crossed off.
(3) Rowwise cell (D, 1) is assigned, so columnwise cell (E, 1) crossed off.
(4) Rowwise cell (E, 2) is assigned, so columnwise cell (C, 2),(F, 2) crossed off., so rowwise cell (E, 4) cross
(5) Rowwise cell (F, 6) is assigned, so columnwise cell (C, 6) crossed off.
C 1 0 0 [0] 0 0
D [0] 3 5 5 1 2
E 0 [0] 0 0 3 2
F 2 0 2 4 2 [0]
A 2 1 [0] 3 1 1
B 5 1 2 1 [0] 4
C 1 0 0 [0] 0 0
D [0] 3 5 5 1 2
E 0 [0] 0 0 3 2
F 2 0 2 4 2 [0]
Optimal solution is
Work Job Cost
A 3 16
B 5 21
C 4 23
D 1 25
E 2 23
F 6 18
Total 126
Alternate Solution-2
https://cbom.atozmath.com/CBOM/Assignment.aspx?q=hm&q1=12%2c13%2c16%2c13%2c13%2c12%3b16%2c20%2c21%2c22%2c21%2c16%… 5/7
6/14/23, 11:12 PM Hungarian method calculator
opporunity cost table
1 2 3 4 5 6
A 2 1 0 3 1 1
B 5 1 2 1 0 4
C 1 0 0 0 0 0
D 0 3 5 5 1 2
E 0 0 0 0 3 2
F 2 0 2 4 2 0
(2) Rowwise cell (B, 5) is assigned, so columnwise cell (C, 5) crossed off.
(3) Rowwise cell (D, 1) is assigned, so columnwise cell (E, 1) crossed off.
(4) Rowwise cell (E, 4) is assigned, so columnwise cell (C, 4) crossed off., so rowwise cell (E, 2) crossed off
(5) Rowwise cell (C, 2) is assigned, so columnwise cell (F, 2) crossed off., so rowwise cell (C, 6) crossed off
A 2 1 [0] 3 1 1
B 5 1 2 1 [0] 4
C 1 [0] 0 0 0 0
D [0] 3 5 5 1 2
E 0 0 0 [0] 3 2
F 2 0 2 4 2 [0]
B 5 1 2 1 [0] 4
C 1 [0] 0 0 0 0
D [0] 3 5 5 1 2
E 0 0 0 [0] 3 2
F 2 0 2 4 2 [0]
Optimal solution is
Work Job Cost
A 3 16
B 5 21
C 2 21
D 1 25
E 4 25
F 6 18
Total 126
https://cbom.atozmath.com/CBOM/Assignment.aspx?q=hm&q1=12%2c13%2c16%2c13%2c13%2c12%3b16%2c20%2c21%2c22%2c21%2c16%… 6/7