Convert the maximisation to a minimisation
M=9,cij′=M−cij:W1W2W3W4W5J107669J224389J376589J426329J511139 Subtracting every profit from the largest profit M makes the problem a minimisation.
Add a dummy row/column of equal costs
add 1 dummy rows of 0 cost The dummy has equal (zero) costs and squares the matrix without affecting the real assignment.
Row reduction: subtract the smallest entry of each row
W1W2W3W4W5J106540J223260J375460J425200J510010 This creates at least one zero in every row.
Column reduction leaves the matrix unchanged
each column already contains a 0 Every column already has a zero, so nothing is subtracted.
Cover the zeros with the fewest lines (iteration 1)
rows {1,4,5}, cols {5}, lines=4<5 Fewer than n lines means the matrix is not yet optimal.
Augment: subtract θ from uncovered entries, add at intersections
θ=2:W1W2W3W4W5J104340J221060J373260J423000J530032 This creates a new zero while keeping every entry non-negative.
Check optimality: n lines are now needed
minimum covering lines=5=n When the minimum number of covering lines equals n, a complete assignment of zeros exists.
Select a complete set of zeros, one in each row and column
W1→J1, W2→J5, W3→J2, W4→J4, W5→J3 These zeros give an assignment of zero reduced cost, which is optimal.
Confirm no assignment does better
W1→J1, W2→J2, W3→J5, W4→J4, W5→J3: 29 ≤ 30 The next best assignment is strictly worse, so the optimum is unique.
Compute the total from the original table
9+8+6+7+0=30 The reductions found the assignment; its profit is the sum of the original entries.
Recall what the Hungarian algorithm does
Hungarian algorithm⇒minimum-cost assignment It finds an assignment of each worker to exactly one job that minimises the total cost.
Recall the row-reduction step
cij→cij−jmincij Subtracting the smallest entry of each row from that row creates a zero in every row.
Recall the column-reduction step
cij→cij−imincij Subtracting the smallest entry of each column from that column creates a zero in every column.
Recall the optimality test
minimum covering lines=n⟺optimal assignment exists An assignment of zero reduced cost exists exactly when n lines are needed to cover the zeros.
State the maximum total profit
maximum total profit=30 The dummy assignments cost nothing, so this is the real optimum.