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

 16 51 99 1 14 82 74 81 19 78 99 55 82 70 88 25

Subtract row minima

We subtract the row minimum from each row:

 15 50 98 0 (-1) 0 68 60 67 (-14) 0 59 80 36 (-19) 57 45 63 0 (-25)

Subtract column minima

We subtract the column minimum from each column:

 15 5 38 0 0 23 0 67 0 14 20 36 57 0 3 0 (-45) (-60)

Cover all zeros with a minimum number of lines

There are 4 lines required to cover all zeros:

 15 5 38 0 x 0 23 0 67 x 0 14 20 36 x 57 0 3 0 x

The optimal assignment

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

 15 5 38 0 0 23 0 67 0 14 20 36 57 0 3 0

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

 16 51 99 1 14 82 74 81 19 78 99 55 82 70 88 25

The optimal value equals 164.