The Hungarian Algorithm is used to find an allocation to minimise cost, but can be adapted to find an allocation that maximises profit. This is done by making each entry in the profit matrix negative and and a fixed number to each element in the resulting table to make it non – zero.
The following table shows the profit made by each worker doing one of four tasks.
Task 1 
Task 2 
Task 3 
Task 4 

Worker A 
3 
6 
1 
7 
Worker B 
9 
8 
4 
12 
Worker C 
1 

2 
10 
Worker D 
16 
12 
7 
4 
Making each entry negative gives the matrix:
Task 1 
Task 2 
Task 3 
Task 4 

Worker A 
3 
6 
1 
7 
Worker B 
9 
8 
4 
12 
Worker C 
1 
4 
2 
10 
Worker D 
16 
12 
7 
4 
The most negative entry is now 16, so add 16 to each entry to give the matrix below.
Task 1 
Task 2 
Task 3 
Task 4 

Worker A 
13 
10 
15 
9 
Worker B 
7 
8 
12 
4 
Worker C 
15 
12 
14 
6 
Worker D 
0 
4 
9 
12 
Subtract the smallest entry in each row from every element in that row to give the matrix below.
Task 1 
Task 2 
Task 3 
Task 4 

Worker A 
4 
1 
6 
0 
Worker B 
3 
5 
8 
0 
Worker C 
9 
6 
8 
0 
Worker D 
0 
4 
9 
12 
Subtracting the smallest element in each column from every entry in that column gives the matrix below.
Task 1 
Task 2 
Task 3 
Task 4 

Worker A 
4 
0 
0 
0 
Worker B 
3 
4 
2 
0 
Worker C 
9 
5 
2 
0 
Worker D 
0 
3 
3 
12 
Three lines are needed to cover all the zeros.
Task 1 
Task 2 
Task 3 
Task 4 

Worker A 
4 
0 
0 
0 
Worker B 
3 
4 
2 
0 
Worker C 
9 
5 
2 
0 
Worker D 
0 
3 
3 
12 
The smallest uncovered element is 2. Add 2 to each element covered by a line, and 4 to each element covered covered twice.
Task 1 
Task 2 
Task 3 
Task 4 

Worker A 
6 
2 
2 
4 
Worker B 
3 
4 
2 
2 
Worker C 
9 
5 
2 
2 
Worker D 
2 
5 
5 
16 
Now subtract 2 from each element, giving the matrix below. Four lines are required to cover all the zeros.
Task 1 
Task 2 
Task 3 
Task 4 

Worker A 
4 
0 
0 
2 
Worker B 
3 
4 
0 
0 
Worker C 
9 
5 
0 
0 
Worker D 
0 
3 
3 
14 
The allocation is:
Worker A does task 2, worker B does task 3, worker C does task 3 and worker D does task 1. The total profit produced is found by referring to the original matrix. It is 6+4+10+16=36.