Notes on the Assignment problem (Also known as the marriage

advertisement
Notes on the Assignment problem
(Also known as the marriage problem)
Problem: There are n workers to be assigned to n jobs. The cost of assigning the i th
worker to the jth job is cij. Find an assignment that assigns every job to a
person and at the same time minimizes the total cost of the assignment.
Input: A set of workers W and a set of jobs J and cost measures cij > 0 for all iW and jJ.
Output: An assignment (one-one correspondence) f such that  ca, f(a) is minimized. An
assignment is expressed as an n-tuple (a1, a2, …, an) where worker i performs
job ai.
Example
J
W

1
2
3
a
4
17
3
b
2
6
1
c
13
9
4
An assignment may be expressed as (i, j, k) where worker a performs job i, b performs j,
and c performs k. In this case, there are 3! = 6 possible solutions corresponding to the
permutation of the jobs. So, if we want to examine all possible assignments, we must
systematically generate the permutations. If we consider the solution (3, 2, 1) it has
cost 3 + 6 + 13 = 22.
We can use backtracking to generate all possible assignments.
Looking at the tree we see there are three optimal assignments: (1, 2, 3), (1, 3, 2), and
(3, 1, 2) each with cost 14.
You’ll notice that the nodes below (2) were not explored. Since the tree is build using a
depth-first model (go left until you reach a leaf and then backup to a previous decision
that can be changed). Since (1, 2, 3) was obtained with assignment cost 14, then there
is no point in exploring the branches in which a is assigned to job 2. Similarly, since all
three workers must receive jobs, there is no point in assigning job 1 to worker c.
Pruning a backtrack search tree by using the cost of the best solution found so far is
called branch-and-bound.
Let’s look at another example
W

J
1
2
3
4
a
8
1
4
6
b
3
5
9
4
11
8
2
3
2
4
7
7
c
d
The tree below is an incomplete backtracking tree for this instance. (It gets a lot
bigger.) As above, each level represents a different worker.
Going all the way down the left branch, we get an initial cost of 22 at the node labeled
(1,2,3,4). Using this value to bound other solutions, we can cut off expansion below
the nodes labeled (1,3,2) and (1,3,4) because the costs at that point already exceed 22.
You’ll notice that when the second job is assigned to worker a and we move down to the
leaf labeled (2,1,3,4) that he cost at that point is 13 which is smaller than the 22 we
have been using as a bound. Thus at this point the new bound is 13. You should
finish the tree (or at least enough of it to convince yourself you know how it works). The
optimal solution is (2,4,3,1) with a cost of 9.
We could also modify the building of the tree by creating bounds before doing any
expansion of the notes. One way to do this is to pick an arbitrary assignment of jobs
and use the value of that assignment as an upper bound. For example we saw that
(1,2,3,4) has cost 22, and (1,4,3,2) has cost 16, Thus, we know the cost of the optimal
solution  min{22, 16} = 16.
How would we find a lower bound on the solution? In other words, find an x such that
every solution has cost greater than or equal to x. Here are two ways to do this. (Note
that neither method is guaranteed to produce a feasible assignment.)
Method 1: Since every worker must be assigned a job, and every job is matched with a
worker, let’s add together the min costs in each row
minimum cost of a job performed by worker a is 1
minimum cost of a job performed by worker b is 3
minimum cost of a job performed by worker c is 2
minimum cost of a job performed by worker d is 2 where the total is 8
Method 2: Similarly since every job must be assigned,
minimum cost for job 1 is 2
minimum cost for job 2 is 1
minimum cost for job 3 is 2
minimum cost for job 4 is 3 where again the total is 8.
Thus, the cost of an optimal solution must be  max{8, 8} = 8
Since we already have a solution of cost 16, 8  |optimal soln|  16
Download