Problemo Solved Assignment

An assignment problem can be easily solved by applying Hungarian method which consists of two phases. In the first phase, row reductions and column reductions are carried out. In the second phase, the solution is optimized on iterative basis.

Phase 1

Step 0: Consider the given matrix.
Step 1: In a given problem, if the number of rows is not equal to the number of columns and vice versa, then add a dummy row or a dummy column. The assignment costs for dummy cells are always assigned as zero.
Step 2: Reduce the matrix by selecting the smallest element in each row and subtract with other elements in that row.

Phase 2:

Step 3: Reduce the new matrix column-wise using the same method as given in step 2.
Step 4: Draw minimum number of lines to cover all zeros.
Step 5: If Number of lines drawn = order of matrix, then optimally is reached, so proceed to step 7. If optimally is not reached, then go to step 6.
Step 6: Select the smallest element of the whole matrix, which is NOT COVERED by lines. Subtract this smallest element with all other remaining elements that are NOT COVERED by lines and add the element at the intersection of lines. Leave the elements covered by single line as it is. Now go to step 4.
Step 7: Take any row or column which has a single zero and assign by squaring it. Strike off the remaining zeros, if any, in that row and column (X). Repeat the process until all the assignments have been made.
Step 8: Write down the assignment results and find the minimum cost/time.

Note: While assigning, if there is no single zero exists in the row or column, choose any one zero and assign it. Strike off the remaining zeros in that column or row, and repeat the same for other assignments also. If there is no single zero allocation, it means multiple numbers of solutions exist. But the cost will remain the same for different sets of allocations.

Example : Assign the four tasks to four operators. The assigning costs are given in Table.

Assignment Problem

Solution:

Step 1: The given matrix is a square matrix and it is not necessary to add a dummy row/column
Step 2: Reduce the matrix by selecting the smallest value in each row and subtracting from other values in that corresponding row. In row A, the smallest value is 13, row B is 15, row C is 17 and row D is 12. The row wise reduced matrix is shown in table below.

Row-wise Reduction

Step 3: Reduce the new matrix given in the following table by selecting the smallest value in
each column and subtract from other values in that corresponding column. In column 1, the smallest value is 0, column 2 is 4, column 3 is 3 and column 4 is 0. The column-wise reduction matrix is shown in the following table.

Column-wise Reduction Matrix

Step 4: Draw minimum number of lines possible to cover all the zeros in the matrix given in Table

Matrix with all Zeros Covered

The first line is drawn crossing row C covering three zeros, second line is drawn crossing column 4 covering two zeros and third line is drawn crossing column 1 (or row B) covering a single zero.
Step 5: Check whether number of lines drawn is equal to the order of the matrix, i.e., 3 ≠ 4. Therefore optimally is not reached. Go to step 6.
Step 6: Take the smallest element of the matrix that is not covered by single line, which is 3. Subtract 3 from all other values that are not covered and add 3 at the intersection of lines. Leave the values which are covered by single line. The following table shows the details.

Subtracted or Added to Uncovered Values and Intersection Lines Respectively

Step 7: Now, draw minimum number of lines to cover all the zeros and check for optimality. Here in table minimum number of lines drawn is 4 which are equal to the order of matrix. Hence optimality is reached.

Optimality Matrix

Step 8: Assign the tasks to the operators. Select a row that has a single zero and assign by squaring it. Strike off remaining zeros if any in that row or column. Repeat the assignment for other tasks. The final assignment is shown in table below.

Final Assignment

Therefore, optimal assignment is:

Example : Solve the following assignment problem shown in Table using Hungarian method. The matrix entries are processing time of each man in hours.

Assignment Problem

Solution: The row-wise reductions are shown in Table

Row-wise Reduction Matrix

The column wise reductions are shown in Table.

Column-wise Reduction Matrix

Matrix with minimum number of lines drawn to cover all zeros is shown in Table.

Matrix will all Zeros Covered

The number of lines drawn is 5, which is equal to the order of matrix. Hence optimality is reached. The optimal assignments are shown in Table.

Optimal Assignment

Therefore, the optimal solution is:

The Hungarian algorithm: An example

We consider an example where four jobs (J1, J2, J3, and J4) need to be executed by four workers (W1, W2, W3, and W4), one job per worker. The matrix below shows the cost of assigning a certain worker to a certain job. The objective is to minimize the total cost of the assignment.

J1J2J3J4
W182836992
W277374992
W31169586
W4899823

Below we will explain the Hungarian algorithm using this example. Note that a general description of the algorithm can be found here.

Step 1: Subtract row minima

We start with subtracting the row minimum from each row. The smallest element in the first row is, for example, 69. Therefore, we substract 69 from each element in the first row. The resulting matrix is:

J1J2J3J4
W11314023(-69)
W24001255(-37)
W3664081(-5)
W4019015(-8)

Step 2: Subtract column minima

Similarly, we subtract the column minimum from each column, giving the following matrix:

J1J2J3J4
W1131408
W24001240
W3664066
W401900
(-15)

Step 3: Cover all zeros with a minimum number of lines

We will now determine the minimum number of lines (horizontal or vertical) that are required to cover all zeros in the matrix. All zeros can be covered using 3 lines:

J1J2J3J4
W1131408
W24001240  x
W3664066
W401900  x
x

Because the number of lines required (3) is lower than the size of the matrix (n=4), we continue with Step 4.

Step 4: Create additional zeros

First, we find that the smallest uncovered number is 6. We subtract this number from all uncovered elements and add it to all elements that are covered twice. This results in the following matrix:

J1J2J3J4
W17802
W24001840
W3058060
W401960

Now we return to Step 3.

Step 3: Cover all zeros with a minimum number of lines

Again, We determine the minimum number of lines required to cover all zeros in the matrix. Now there are 4 lines required:

J1J2J3J4
W17802  x
W24001840  x
W3058060  x
W401960  x

Because the number of lines required (4) equals the size of the matrix (n=4), an optimal assignment exists among the zeros in the matrix. Therefore, the algorithm stops.

The optimal assignment

The following zeros cover an optimal assignment:

J1J2J3J4
W17802
W24001840
W3058060
W401960

This corresponds to the following optimal assignment in the original cost matrix:

J1J2J3J4
W182836992
W277374992
W31169586
W4899823

Thus, worker 1 should perform job 3, worker 2 job 2, worker 3 job 1, and worker 4 should perform job 4. The total cost of this optimal assignment is to 69 + 37 + 11 + 23 = 140.

Solve your own problem online

One thought on “Problemo Solved Assignment

Leave a Reply

Your email address will not be published. Required fields are marked *