The BipartiteMatching command has been extended to support weighted graphs, on which it computes a minimum weight maximum matching using the Kuhn-Munkres algorithm, also known as the Hungarian algorithm.
We begin with a 7x7 matrix whose rows represent seven workers and whose columns represent seven tasks, in which entry represents the cost for worker to complete task . Our goal is to find an assignment of tasks to workers which minimizes the total cost.
>
|
|
>
|
|
We now transform into a 14x14 block matrix which will be the weight matrix for a bipartite graph:
>
|
|
The 14 vertices of this graph will be the seven workers and seven tasks.
>
|
|
| (2.1) |
>
|
|
| (2.2) |
Here we see an optimal solution for this problem, assigning Task 1 to Person 7, Task 2 to Person 2, etc.
>
|
|
| (2.3) |
Here is constructed the bipartite graph explicitly, but we can optionally also simply provide the original 7x7 matrix directly to BipartiteMatching to produce a similar result:
>
|
|
| (2.4) |