














Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
A detailed explanation of the assignment problem and the hungarian method, a technique used to solve it. The assignment problem involves allocating resources to tasks or tasks to resources in order to minimize or maximize a certain objective function. The hungarian method is a mathematical algorithm that can be used to find an optimal solution to the assignment problem. Examples and step-by-step instructions for using the hungarian method to solve assignment problems.
Typology: Lecture notes
1 / 22
This page cannot be seen from the preview
Don't miss anything!















The transportation problem is a special type of linear programming problem where the objective is to minimise the cost of distributing a product from a number of sources or origins to a number of destinations. Because of its special structure the usual simplex method is not suitable for solving transportation problems.
These problems require a special method of solution (transportation model). The origin of a transportation problem is the location from which shipments are dispatched. The destination of a transportation problem is the location to which shipments are transported. The unit transportation cost is the cost of transporting one unit of the consignment from an origin to a destination.
The areas where this model is applicable must have the following characteristics:
Objective
The problem is to allocate resources from one source to destinations so that the total cost of allocations for the system is minimized. The restrictions are:
For the transportation model to be used, then ∑Si = ∑Dj, i.e. it must be balanced. Expressing the
transportation problem as an LP problem we have the general LP model below. Cij = Cost of allocating a
unit of resource from each origin i to each destination j and xij = the number of units dispatched from source
i to destination j……
Network diagram
Capacity Source Destination Requirements
S 1 1 X 11 1 D 1 S 2 2 2 D 2 S 3 3 3 D 3 … … Sm m X1m n Dn
Objective function
Min costs, C = ∑(∑ cijXij)
Subject to
Constraints
Supply capacities: X 11 + X 12 + … + X1n ≤ S 1
….
Demand requirements: X 11 + X 21 + … + Xm1 ≤ D 1
…
Non – negativity constraints: X 11 , X 12 , … , Xmn ≥ 0
Illustration
Building Balast Company (BBC) has orders for 80 tons of bricks at three suburban locations as follows: Machakos -- 25 tons, Nairobi -- 45 tons, and Athi River -- 30 tons. BBC has two plants, each of which can produce 50 tons per week.
How should end of week shipments be made to fill the above orders given the following delivery cost per ton:
Machakos Nairobi Athi River Capacity Plant 1 24 30 40 50 Plant 2 30 40 42 50 Demand 25 45 30 100 Suburban Location
Machakos Nairobi Athi River Capacity Plant 1 25 24 25 30 40 50 25 0 Plant 2 30 20 40 30 42 50 30 0 Demand 25 0 45 20 0 30 0 100
Least Cost method Procedure
Show the initial schedule/ solution Plant Location Cost 1 Machakos 25 * 24 = 600 1 Nairobi 25 * 30 = 750 2 Nairobi 20 * 40 = 800 2 Athi River 30 * 42 = 1260 3410 VAM VAM Step 1: For each row and column of the transportation table, find the difference between the two lowest unit shipping costs. These numbers represent the difference between the distribution cost on the best route in the row or column and the second best route in the row or column. (This is the opportunity cost of not using the best route VAM Step 2: Identify the row or column with the greatest opportunity cost, or difference. VAM Step 3: Assign as many units as possible to the lowest cost square in the row or column selected. VAM Step 4: Eliminate any row or column that has just been completely satisfied by the assignment just made. VAM Step 5: Recompute the cost differences for the transportation table, omitting rows or columns crossed out in the preceding step. VAM Step 6: Return to step 2 and repeat the steps until an initial feasible solution has been obtained.
Suburban Location
Machakos Nairobi Athi river Capacity Penalty Plant 1 25 24 30 25 40 50 25 0 6 16 Plant 2 30 45 40 5 42 50 5 0 10 12 Demand 25 0 45 0 30 5 0 100 Penalty 6 6 10 - 2
Show the initial schedule/ solution (VAM)
Plant Location Cost 1 Machakos 25 * 24 = 600 1 Athi River 25 * 40 = 1000 2 Nairobi 45 * 40 = 1800 2 Athi River 5 * 42 = 210 3610
Illustration 2
A company has three depots, P, Q and R for its produce with capacity of 12, 36 and 42 units respectively. The depots supply the produce to four towns A, B, C and D whose demands are 18, 18, 24 and 30 units respectively. The per unit transport cost in UK pounds from one depot to a given town are given in the table
below. Obtain the initial basic feasible solutions using the following methods, NWC, LCM and VAM methods.
Town Depot A B C D Supply 1
Demand 18 18 24 30 90 Illustration 3 The cost of transportation per unit from three sources and four destinations are given in the table below. Obtain the initial basic feasible solutions using the following methods. NWC, LCM and VAM Transportation Model
Destination Source 1 2 3 4 Supply 1
Demand^200 400 300 300
Illustration 4 A mining company extracts gravel, the basic product it sells, from three mines, 1, 2 and 3. The weekly production of each mine is 75, 150 and 75 tonnes of gravel respectively. The gravel has to be transported to five main consumers, A, B, C, D and E requiring for their needs 100, 60, 40, 75 and 25 tonnes of gravel per week respectively.
The problem that concerns the company's management is the minimization of the required cost for the transportation of the product to the consumers. For this purpose a detailed cost analysis was carried out which gave the results of the following table (the numbers denote the transportation cost in £ per ton of gravel).
Cost table of gravel transportation Consumer Mine A B C D E
Solution schedule by the NWC method
Source (Supply point) University Delivery cost (Kshs) 1 2 2 2 3
Total delivery cost 5925
Initial or first solution using the Least Cost method (LCM) table
Solution schedule by the LCM method
Source (Supply point) University Delivery cost (Kshs) 1 B 25 * 8 = 200
Total delivery cost 4550
Initial or first solution using the Vogel’s Approximation Method (VAM) table
Solution schedule by the VAM method
Source (Supply point) University Delivery cost (Kshs) 1 2 3 3 3
Total delivery cost 5125
Assignment problem is a special type of linear programming problem which deals with the allocation of the
various resources to the various activities on a one to one basis. It does it in such a way that the cost or time
involved in the process is minimum and profit or sale is maximum. Though there are problems that can be
solved by the simplex method or by the transportation method the assignment model gives a simpler
approach for these problems.
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 optimality is reached, so proceed to step 7. If optimality 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.
For a maximization problem 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: Converting a maximization problem to a minimization problem. Reduce the matrix by selecting the
largest element in the matrix and subtract all the other elements from that element. Step 3: Follow all the other steps of a minimization problem as given above.
Illustration 1: Assign the four tasks to four operators. The assigning costs are given in Table. Assignment Problem
Operators Tasks 1 2 3 4 A 20 28 19 13 B 15 30 31 28
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 Operators Tasks 1 2 3 4 A 7 15 6 0 B 0 15 16 13 C 23 4 3 0 D 9 16 14 0
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 Operators Tasks 1 2 3 4 A 7 11 3 0 B 0 11 13 13 C 23 0 0 0 D 9 12 11 0 Step 4: Draw minimum number of lines possible to cover all the zeros in the matrix given in Table Matrix with all Zeros Covered
Operators Tasks 1 2 3 4 A 7 11 3 0 B 0 11 13 13 C 23 0 0 0 D 9 12 11 0 No. of lines drawn ≠ order of matrix 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.
Illustration 2: Solve the following assignment problem shown in Table using Hungarian method. The matrix entries are processing time of each man in hours.
Assignment Problem Man Job 1 2 3 4 5 I 20 15 18 20 25 II 18 20 12 14 15 III 21 23 25 27 25 IV 17 18 21 23 20 V 18 18 16 19 20 Solution: The row-wise reductions are shown in Table
Row-wise Reduction Matrix Man Job 1 2 3 4 5 I 5 0 3 5 10 II 6 8 0 2 3 III 0 2 4 6 4 IV 0 1 4 6 3 V 2 2 0 3 4 The column wise reductions are shown in Table.
Column-wise Reduction Matrix Man Job 1 2 3 4 5 I 5 0 √ 3 3 7 II 6 8 0 0 √ 0 III 0 √ 2 4 4 1 IV 0 1 4 4 0 √ V 2 2 0 √ 1 1 Matrix with minimum number of lines drawn to cover all zeros is shown in Table.
Matrix will all Zeros Covered
Man Job 1 2 3 4 5 I 5 0 3 3 7 II 6 8 0 0 0 III 0 2 4 4 1 IV 0 1 4 4 0 V 2 2 0 1 1
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
Man Job 1 2 3 4 5
Therefore, the optimal solution is: Job Man Time I II III IV V
Total time 86 hours
Illustration 3: A construction company has four large bulldozers located at four different garages. The bulldozers are to be moved to four different construction sites. The distances in kms between the bulldozers and the construction sites are given below.
Bulldozer / Site A B C D 1 90 75 75 80 2 35 85 55 65 3 125 95 90 105 4 45 110 95 115
How should the bulldozers be moved to the construction sites in order to minimize the total distance traveled?
Rows reduction
Bulldozer / Site A B C D 1 15 0 0 5 2 0 50 20 30 3 35 5 0 15 4 0 65 50 70
Columns reduction
Bulldozer / Site A B C D
Bulldozer Site Cost 1 B 75 2 D 65 3 C 90 4 A 45 Minimum total cost 275 Assignment 2 Bulldozer / Site A B C D 1 40 0X 5 0√ 2 0X 25 0√ 0X 3 55 0√ 0X 5 4 0√ 40 30 40
Bulldozer Site Cost 1 D 80 2 C 55 3 B 95 4 A 45 Minimum total cost 275
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.
Worker J1 J2 J3 J W1 82 83 69 92 W2 77 37 49 92 W3 11 69 5 86 W4 8 9 98 23
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:
Worker J1 J2 J3 J W1 13 14 0 23 (- 69) W2 40 0 12 55 (- 37) W3 6 64 0 81 (- 5) W4 0 1 90 15 (- 8)
Step 2: Subtract column minima
Similarly, we subtract the column minimum from each column, giving the following matrix:
Worker J1 J2 J3 J W1 13 14 0 8 W2 40 0 12 40 W3 6 64 0 66 W4 0 1 90 0 (- 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:
Worker J1 J2 J3 J W1 13 14 0 8 W2 40 0 12 40 W3 6 64 0 66 W4 0 1 90 0
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
The bids for five cars (in thousands of Kshs) on sale by a tour company are as follows:
Car model Buyer Vitz VanGuard Harrier VW Ford Can 300 250 330 260 310 John^350 300 280 280 Ben 280 290 390 230 360 Edna 330 310 340 290 350 Dolly 280 350 360 290 300
If no bidder is allowed to buy more than one car and all the cars are sold, determine the bids that the company accepts to maximize profit.
Example on maximization
Five different machines M1 to M5 can process different number of units of any one of the following five different products, A, B, C, D and E as shown in the table below. Determine the assignment that maximizes the number of units to be produced.
Product Machine A B C D E M1^30 37 40 28 M2 40 24 27 21 36 M3 40 32 33 30 35 M4 25 38 40 36 36 M5 29 62 41 34 39 Converting the maximization problem to a minimization problem Product Machine A B C D E M1 32 25 22 34 22 M2 22 38 35 41 26 M3 22 30 29 32 27 M4 37 24 22 26 26 M5 33 0 21 28 23
Row reduction step
Product Machine A B C D E M1 10 3 0 12 0 M2 0 16 13 19 4 M3 0 8 7 10 5 M4^15 2 0 4 M5 33 0 21 28 23
Column reduction and covering lines
Product Machine A B C D E M1 10 3 0 8 0 M2 0 16 13 15 4 M3^0 8 7 6 M4 15 2 0 0 4 M5 33 0 21 24 23
Covering lines step
Product Machine A B C D E M1 14 7 0√ 8 0 M2^0 16 19 11 0√ M3 0√ 8 3 2 1 M4 19 2 0 0√ 4 M5^33 0√^17 20
Optimal assignment
Machine Product Number of units M1 C 40 M2 E 36