How do we allocate workers to tasks for the lowest total cost?
Model an assignment problem as a bipartite graph and solve it with the Hungarian algorithm to minimise total cost.
How to model an allocation as a bipartite matching, apply the Hungarian algorithm of row and column reduction and covering zeros, and read off the optimal minimum-cost assignment.
Reviewed by: AI editorial process; not yet individually human-reviewed
Have a quick question? Jump to the Q&A page
Jump to a section
What this dot point is asking
You must model the problem as a bipartite matching and apply the Hungarian algorithm to minimise total cost.
Modelling the problem
An assignment problem allocates each worker to exactly one task and each task to exactly one worker, minimising total cost (or time). The costs form a square matrix, with workers as rows and jobs as columns.
The matrix must be square (equal numbers of workers and jobs); if not, add a dummy row or column of zeros.
The Hungarian algorithm
The algorithm creates zeros that mark a least-cost allocation.
The optimal cost is found by reading the original-matrix costs of the chosen zero positions.
Unbalanced problems
If there are more jobs than workers (or vice versa), the cost matrix is not square and the algorithm cannot run. Add a dummy row or column of zeros to make it square: a dummy worker assigned to a job means that job is left undone (at zero recorded cost), which models the situation that not every task can be covered. Always balance the matrix before reducing.
Maximisation problems
If the goal is to maximise (for example, total profit), convert to a minimisation first: subtract every entry from the largest entry in the matrix, then run the Hungarian algorithm as normal. The resulting assignment maximises the original profit, and you read the total profit from the original matrix at the chosen positions.
Exam-style practice questions
Practice questions written in the style of SCSA exam questions on this dot point, with worked answer explainers. The year tag is the paper they imitate, not the source.
WACE 20227 marksThree workers must each do one of three jobs . The cost matrix (hours) is row , row , row . Use the Hungarian algorithm to find the allocation that minimises total time.Show worked answer →
Reduce rows, then columns, then cover the zeros.
Row reduction (subtract each row minimum, ): , , . (2 marks)
Column reduction (column minima ): , , . (2 marks)
Cover all zeros: minimum lines needed equals (size of matrix), so an optimal assignment exists. Assign zeros uniquely: (), (), (). Total hours. (3 marks)
Markers reward correct row and column reductions, the covering-lines test, and a unique zero assignment giving total .
WACE 20245 marksExplain why an assignment problem is modelled as a bipartite graph, and describe the first two steps of the Hungarian algorithm used to minimise total cost.Show worked answer →
The two distinct sets being matched make the graph bipartite.
An assignment problem matches one set (workers) to a separate set (jobs), with each worker doing exactly one job and each job done by exactly one worker. The two disjoint sets with edges only between them make it a bipartite graph, and the goal is a minimum-cost perfect matching. (2 marks)
Step 1: subtract the smallest entry in each row from every entry in that row (row reduction). Step 2: subtract the smallest entry in each column from every entry in that column (column reduction), creating zeros that mark candidate assignments. (3 marks)
Markers reward the bipartite-matching description and the row-then-column reduction steps.
