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

 73 7 43 93 7 7 57 40 37 50 27 67 50 9 77 28

Subtract row minima

We subtract the row minimum from each row:

 66 0 36 86 (-7) 0 0 50 33 (-7) 10 23 0 40 (-27) 41 0 68 19 (-9)

Subtract column minima

We subtract the column minimum from each column:

 66 0 36 67 0 0 50 14 10 23 0 21 41 0 68 0 (-19)

Cover all zeros with a minimum number of lines

There are 4 lines required to cover all zeros:

 66 0 36 67 x 0 0 50 14 x 10 23 0 21 x 41 0 68 0 x

The optimal assignment

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

 66 0 36 67 0 0 50 14 10 23 0 21 41 0 68 0

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

 73 7 43 93 7 7 57 40 37 50 27 67 50 9 77 28

The optimal value equals 69.