Solve an assignment problem online

Fill in the cost matrix of an assignment problem and click on 'Solve'. The optimal assignment will be determined and a step by step explanation of the hungarian algorithm will be given.

Fill in the cost matrix (random cost matrix):

Size: 3x3 4x4 5x5 6x6 7x7 8x8 9x9 10x10

Don't show the steps of the Hungarian algorithm
Maximize the total cost

This is the original cost matrix:

95347707093
245158632598
31801592441
384367349575
18749982159
823621826073

Subtract row minima

We subtract the row minimum from each row:

04438616184(-9)
0273439174(-24)
30790582340(-1)
493306141(-34)
11042911452(-7)
61150613952(-21)

Subtract column minima

We subtract the column minimum from each column:

04438616044
0273439034
3079058220
49330601
11042911312
61150613812
(-1)(-40)

Cover all zeros with a minimum number of lines

There are 6 lines required to cover all zeros:

04438616044  x
0273439034  x
3079058220  x
49330601  x
11042911312  x
61150613812  x

The optimal assignment

Because there are 6 lines required, the zeros cover an optimal assignment:

04438616044
0273439034
3079058220
49330601
11042911312
61150613812

This corresponds to the following optimal assignment in the original cost matrix:

95347707093
245158632598
31801592441
384367349575
18749982159
823621826073

The optimal value equals 137.