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

 26 37 41 19 56 4 4 11 41 38 43 42 31 6 15 56

Subtract row minima

We subtract the row minimum from each row:

 7 18 22 0 (-19) 52 0 0 7 (-4) 3 0 5 4 (-38) 25 0 9 50 (-6)

Subtract column minima

We subtract the column minimum from each column:

 4 18 22 0 49 0 0 7 0 0 5 4 22 0 9 50 (-3)

Cover all zeros with a minimum number of lines

There are 4 lines required to cover all zeros:

 4 18 22 0 x 49 0 0 7 x 0 0 5 4 x 22 0 9 50 x

The optimal assignment

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

 4 18 22 0 49 0 0 7 0 0 5 4 22 0 9 50

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

 26 37 41 19 56 4 4 11 41 38 43 42 31 6 15 56

The optimal value equals 70.