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

 6 11 94 77 10 71 60 18 36 34 83 82 70 14 13 54

Subtract row minima

We subtract the row minimum from each row:

 0 5 88 71 (-6) 0 61 50 8 (-10) 2 0 49 48 (-34) 57 1 0 41 (-13)

Subtract column minima

We subtract the column minimum from each column:

 0 5 88 63 0 61 50 0 2 0 49 40 57 1 0 33 (-8)

Cover all zeros with a minimum number of lines

There are 4 lines required to cover all zeros:

 0 5 88 63 x 0 61 50 0 x 2 0 49 40 x 57 1 0 33 x

The optimal assignment

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

 0 5 88 63 0 61 50 0 2 0 49 40 57 1 0 33

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

 6 11 94 77 10 71 60 18 36 34 83 82 70 14 13 54

The optimal value equals 71.