# 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):

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

This is the original cost matrix:

 97 26 51 9 93 39 15 58 83 59 73 65 76 21 44 70

Subtract row minima

We subtract the row minimum from each row:

 88 17 42 0 (-9) 78 24 0 43 (-15) 24 0 14 6 (-59) 55 0 23 49 (-21)

Subtract column minima

We subtract the column minimum from each column:

 64 17 42 0 54 24 0 43 0 0 14 6 31 0 23 49 (-24)

Cover all zeros with a minimum number of lines

There are 4 lines required to cover all zeros:

 64 17 42 0 x 54 24 0 43 x 0 0 14 6 x 31 0 23 49 x

The optimal assignment

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

 64 17 42 0 54 24 0 43 0 0 14 6 31 0 23 49

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

 97 26 51 9 93 39 15 58 83 59 73 65 76 21 44 70

The optimal value equals 128.