Part A: 9 minutes
Tutor 0 goes to student 3 (1 minute), tutor 1 to student 1 (4), tutor 2 to student 0 (2) and
tutor 3 to student 2 (2): 9 minutes. Every other rota takes at least 13. Sending each tutor
in turn to their nearest free student starts with and then has to send tutor 3 to
student 1, which takes 9 minutes, so it costs 13. Taking the cheapest remaining pair each time
does the same.
Part B: a certificate
The potentials
satisfy for all 16 pairs, and add up to . So no rota is
shorter than 9 minutes, and the rota from part A is optimal. Certificates are not unique. Adding
the same number to every and subtracting it from every gives another, and other
choices work too.
Why the bound holds: an assignment uses each tutor once and each student once, so its cost is
Equality needs on every matched pair. This is complementary
slackness: the assignment may use only pairs whose constraint is tight.
Part C: the Hungarian method
The assignment problem is a linear program: choose with every row and column
summing to 1, minimising . Its dual is exactly the problem of part B:
maximise subject to . The Hungarian method works on
both at once:
- Keep feasible potentials. Call a pair tight when .
- Grow a matching using tight pairs only. To add tutor , search from for an alternating
path, through tight pairs, that ends at a free student.
- If the search gets stuck, let be the smallest reduced cost
from a reached tutor to an unreached student. Raise the reached tutors' by and
lower the reached students' by . Feasibility survives, matched pairs stay tight,
and at least one new pair becomes tight.
Each tutor is added after at most adjustments of work each, with the values
kept up to date, so the method runs in . When every tutor is matched, all matched pairs
are tight, so the potentials add up to the cost. That is the certificate the grader checks.
The same algorithm is successive shortest paths in a minimum-cost flow
network, with and as the node potentials that keep reduced costs non-negative. Any method
that returns a valid certificate passes.
Three near-misses fail the grader:
- Right rota, weak potentials. Each tutor's cheapest trip as , with , is
feasible, but on the statement's rota it proves only 6.
- Right sum, infeasible potentials. Charging each tutor exactly their own trip makes the
sum match the cost. But tutor 1 has a 1-minute trip, so .
- The cheapest remaining pair, again and again, gives a 13-minute rota. Reducing rows and
then columns gives potentials worth 9 here, the true optimum, so the grader reports that this
rota is the one that is wrong.
Going further
- Prices and auctions. Read as student 's price and as tutor 's profit at
those prices. Bertsekas's auction algorithm has tutors bid for their best student, raising the
price by the gap to their second best plus . It ends with a rota within
of optimal, which is exact for whole-number costs when .
- Whole numbers. The constraint matrix of the assignment LP is totally unimodular, so with
whole-number costs both the LP and its dual have whole-number optimal solutions. That is why
the potentials above are whole numbers. See
Polytopes and Integrality.
- Certificates in general. An optimisation answer that comes with a dual certificate can be
checked in far less time than it took to find, here against .
References
- H. W. Kuhn. The Hungarian method for the assignment problem. Naval Research Logistics
Quarterly 2, 1955.
- J. Munkres. Algorithms for the assignment and transportation problems. Journal of the SIAM
5(1), 1957.
- J. Edmonds, R. M. Karp. Theoretical improvements in algorithmic efficiency for network flow
problems. Journal of the ACM 19(2), 1972.
- D. P. Bertsekas. The auction algorithm: a distributed relaxation method for the assignment
problem. Annals of Operations Research 14, 1988.