Download as pdf or txt
Download as pdf or txt
You are on page 1of 14

Industrial

• Faculty of Engineering Engineering


Department
Transportation, Assignment,
and Transshipment Problems
• Transportation Problem
– Network Representation
Linear Programming – General LP Formulation
• Assignment Problem
Transportation – Network Representation
– General LP Formulation
• Transshipment Problem
– Network Representation
– General LP Formulation
Dr. Ahmed Mohib
Dr. Ahmed Mohib 2

Transportation, Assignment, • Each of the three models can be formulated


and Transshipment Problems as linear programs and solved by general
purpose linear programming codes.
• A network model is one which can be • For each of the three models, if the right-
represented by a set of nodes, a set of arcs, hand side of the linear programming
and functions (e.g. costs, supplies, demands, formulations are all integers, the optimal
etc.) associated with the arcs and/or nodes. solution will be in terms of integer values for
• Transportation, assignment, and the decision variables.
transshipment problems as well as the • However, there are many computer
packages (including The Management
PERT/CPM problems are all examples of
Scientist) that contain separate computer
network problems. codes for these models which take
advantage of their network structure.
Dr. Ahmed Mohib 3 Dr. Ahmed Mohib 4

Transportation Problem Transportation Problem


• Network Representation
• The transportation problem seeks to
minimize the total shipping costs of 1 d1
transporting goods from m origins (each with c11
s1 1 c12
a supply si) to n destinations (each with a
c13
demand dj), when the unit shipping cost from 2 d2
c21
an origin, i, to a destination, j, is cij.
s2 2 c22
c23
3 d3

Sources Destinations

Dr. Ahmed Mohib 5 Dr. Ahmed Mohib 6

1
Transportation Problem
Transportation Problem
• LP Formulation
The LP formulation in terms of the amounts • LP Formulation Special Cases
shipped from the origins to the destinations, xij , can The following special-case modifications to
be written as: the linear programming formulation can be
made:
Min ΣΣcijxij
ij – Minimum shipping guarantee from i to j:
s.t. Σxij < si for each origin i xij > Lij
j

Σxij = dj for each destination j – Maximum route capacity from i to j:


i
xij < Lij
xij > 0 for all i and j
– Unacceptable route:
Remove the corresponding decision variable.
Dr. Ahmed Mohib 7 Dr. Ahmed Mohib 8

Example: Acme Block Co. Example: Acme Block Co.

Acme Block Company has orders for 80 tons of „ Delivery Cost Per Ton
concrete blocks at three suburban locations
as follows: Northwood -- 25 tons, Northwood Westwood Eastwood
Westwood -- 45 tons, and Plant 1 24 30 40
Eastwood -- 10 tons. Acme Plant 2 30 40 42
e
has two plants, each of which
can produce 50 tons per week.
Acm
Delivery cost per ton from each plant
to each suburban location is shown on the next slide.
How should end of week shipments be made to fill
the above orders?

Dr. Ahmed Mohib 9 Dr. Ahmed Mohib 10

Transportation Simplex Method Transportation Simplex Method


• To solve the transportation problem by its special
• A transportation tableau is given below. Each cell
purpose algorithm, the sum of the supplies at the represents a shipping route (which is an arc on the network
origins must equal the sum of the demands at the and a decision variable in the LP formulation), and the unit
destinations. shipping costs are given in an upper right hand box in the
– If the total supply is greater than the total demand, a cell.
dummy destination is added with demand equal to the
D1 D2 D3 Supply
excess supply, and shipping costs from all origins are
zero. 15 30 20
S1 50
– Similarly, if total supply is less than total demand, a
dummy origin is added. 30 40 35
S2 30
• When solving a transportation problem by its special
purpose algorithm, unacceptable shipping routes are Demand 25 45 10
given a cost of +M (a large number).
Dr. Ahmed Mohib 11 Dr. Ahmed Mohib 12

2
Transportation Simplex Method Transportation Simplex Method
• The transportation problem is solved in two phases: • Phase I - Minimum-Cost Method
– Phase I -- Finding an initial feasible solution – Step 1: Select the cell with the least cost. Assign to
this cell the minimum of its remaining row supply or
– Phase II – Iterating to the optimal solution
remaining column demand.
• In Phase I, the Minimum-Cost Method can be used – Step 2: Decrease the row and column availabilities
to establish an initial basic feasible solution without by this amount and remove from consideration all
doing numerous iterations of the simplex method. other cells in the row or column with zero
availability/demand. (If both are simultaneously
• In Phase II, the Stepping Stone Method, using the
reduced to 0, assign an allocation of 0 to any other
MODI method for evaluating the reduced costs may unoccupied cell in the row or column before deleting
be used to move from the initial feasible solution to both.) GO TO STEP 1.
the optimal one.

Dr. Ahmed Mohib 13 Dr. Ahmed Mohib 14

Transportation Simplex Method Transportation Simplex Method


• Phase II - Stepping Stone Method • Phase II - Stepping Stone Method (continued)
– Step 1: For each unoccupied cell, calculate the – Step 3: Add this allocation to all cells where
reduced cost by the MODI method described below. additions are to be made, and subtract this allocation
Select the unoccupied cell with the most to all cells where subtractions are to be made along
negative reduced cost. (For maximization problems
select the unoccupied cell with the largest reduced the stepping stone path.
cost.) If none, STOP. (Note: An occupied cell on the stepping
– Step 2: For this unoccupied cell generate a stepping stone path now becomes 0 (unoccupied). If more
stone path by forming a closed loop with this cell and than one cell becomes 0, make only one
occupied cells by drawing connecting alternating unoccupied; make the others occupied with 0's.)
horizontal and vertical lines between them. GO TO STEP 1.
Determine the minimum allocation where a
subtraction is to be made along this path.

Dr. Ahmed Mohib 15 Dr. Ahmed Mohib 16

Transportation Simplex Method Example: Acme Block Co. (ABC)

„ MODI Method (for obtaining reduced costs) Acme Block Company has orders for 80 tons of
Associate a number, ui, with each row and vj with concrete blocks at three suburban locations
each column. as follows: Northwood -- 25 tons,
• Step 1: Set u1 = 0. Westwood -- 45 tons, and
• Step 2: Calculate the remaining ui's and vj's by Eastwood -- 10 tons. Acme
e
Acm
solving the relationship cij = ui + vj for occupied cells. has two plants, each of which
• Step 3: For unoccupied cells (i,j), the reduced cost = can produce 50 tons per week.
cij - ui - vj.
Delivery cost per ton from each plant
to each suburban location is shown on the next slide.
How should end of week shipments be made to fill
the above orders?

Dr. Ahmed Mohib 17 Dr. Ahmed Mohib 18

3
Example: ABC Example: ABC

„ Delivery Cost Per Ton „ Initial Transportation Tableau


Since total supply = 100 and total demand = 80, a
Northwood Westwood Eastwood dummy destination is created with demand of 20 and 0
Plant 1 24 30 40 unit costs.
Plant 2 30 40 42 Westwood Dummy Supply
Northwood Eastwood
24 30 40 0
Plant 1 50

30 40 42 0
Plant 2 50

Demand 25 45 10 20

Dr. Ahmed Mohib 19 Dr. Ahmed Mohib 20

Example: ABC Example: ABC

„ Least Cost Starting Procedure „ Least Cost Starting Procedure (continued)


• Iteration 1: Tie for least cost (0), arbitrarily select x14. • Iteration 3: Of the remaining cells the least cost is 30
Allocate 20. Reduce s1 by 20 to 30 and delete the for x12. Allocate 5. Reduce the Westwood column to
Dummy column. 40 and eliminate the Plant 1 row.
• Iteration 2: Of the remaining cells the least cost is 24 • Iteration 4: Since there is only one row with two
for x11. Allocate 25. Reduce s1 by 25 to 5 and cells left, make the final allocations of 40 and 10 to x22
eliminate the Northwood column. and x23, respectively.

continued

Dr. Ahmed Mohib 21 Dr. Ahmed Mohib 22

Example: ABC Example: ABC

„ Iteration 1 „ Iteration 1
• MODI Method • MODI Method (continued)
1. Set u1 = 0 Calculate the reduced costs (circled numbers on the
2. Since u1 + vj = c1j for occupied cells in row 1, then next slide) by cij - ui + vj.
v1 = 24, v2 = 30, v4 = 0. Unoccupied Cell Reduced Cost
3. Since ui + v2 = ci2 for occupied cells in column 2, (1,3) 40 - 0 - 32 = 8
then u2 + 30 = 40, hence u2 = 10.
(2,1) 30 - 24 -10 = -4
4. Since u2 + vj = c2j for occupied cells in row 2, then
(2,4) 0 - 10 - 0 = -10
10 + v3 = 42, hence v3 = 32.

Dr. Ahmed Mohib 23 Dr. Ahmed Mohib 24

4
Example: ABC Example: ABC

„ Iteration 1 Tableau „ Iteration 1


• Stepping Stone Method
Westwood Dummy The stepping stone path for cell (2,4) is (2,4), (1,4),
Northwood Eastwood ui
(1,2), (2,2). The allocations in the subtraction cells are 20
24 30 40 0
Plant 1 25 5 +8 20 0 and 40, respectively. The minimum is 20, and hence
reallocate 20 along this path. Thus for the next tableau:
30 40 42 0 x24 = 0 + 20 = 20 (0 is its current allocation)
Plant 2 -4 40 10 -10 10
x14 = 20 - 20 = 0 (blank for the next tableau)
vj 24 30 32 0 x12 = 5 + 20 = 25
x22 = 40 - 20 = 20
The other occupied cells remain the same.

Dr. Ahmed Mohib 25 Dr. Ahmed Mohib 26

Example: ABC Example: ABC

„ Iteration 2 „ Iteration 2
• MODI Method • MODI Method (continued)
The reduced costs are found by calculating Calculate the reduced costs (circled numbers on the
the ui's and vj's for this tableau. next slide) by cij - ui + vj.
1. Set u1 = 0.
Unoccupied Cell Reduced Cost
2. Since u1 + vj = cij for occupied cells in row 1, then
(1,3) 40 - 0 - 32 = 8
v1 = 24, v2 = 30.
(1,4) 0 - 0 - (-10) = 10
3. Since ui + v2 = ci2 for occupied cells in column 2,
(2,1) 30 - 10 - 24 = -4
then u2 + 30 = 40, or u2 = 10.
4. Since u2 + vj = c2j for occupied cells in row 2, then
10 + v3 = 42 or v3 = 32; and, 10 + v4 = 0 or v4 = -10.

Dr. Ahmed Mohib 27 Dr. Ahmed Mohib 28

Example: ABC Example: ABC

„ Iteration 2 Tableau „ Iteration 2


• Stepping Stone Method
Westwood Dummy The most negative reduced cost is = -4 determined
Northwood Eastwood ui
by x21. The stepping stone path for this cell is
24 30 40 0 (2,1),(1,1),(1,2),(2,2). The allocations in the subtraction
Plant 1 25 25 +8 +10 0
cells are 25 and 20 respectively. Thus the new solution
30 40 42 0 is obtained by reallocating 20 on the stepping stone
Plant 2 -4 20 10 20 10
path. Thus for the next tableau:
vj 24 30 36 -6
x21 = 0 + 20 = 20 (0 is its current allocation)
x11 = 25 - 20 = 5
x12 = 25 + 20 = 45
x22 = 20 - 20 = 0 (blank for the next tableau)
The other occupied cells remain the same.

Dr. Ahmed Mohib 29 Dr. Ahmed Mohib 30

5
Example: ABC Example: ABC

„ Iteration 3 „ Iteration 3
• MODI Method • MODI Method (continued)
The reduced costs are found by calculating Calculate the reduced costs (circled numbers on the
the ui's and vj's for this tableau. next slide) by cij - ui + vj.
1. Set u1 = 0
Unoccupied Cell Reduced Cost
2. Since u1 + vj = c1j for occupied cells in row 1, then
(1,3) 40 - 0 - 36 = 4
v1 = 24 and v2 = 30.
(1,4) 0 - 0 - (-6) = 6
3. Since ui + v1 = ci1 for occupied cells in column 2,
(2,2) 40 - 6 - 30 = 4
then u2 + 24 = 30 or u2 = 6.
4. Since u2 + vj = c2j for occupied cells in row 2, then
6 + v3 = 42 or v3 = 36, and 6 + v4 = 0 or v4 = -6.

Dr. Ahmed Mohib 31 Dr. Ahmed Mohib 32

Example: ABC Example: ABC

„ Iteration 3 Tableau „ Optimal Solution


Since all the reduced costs are non-negative, this is
the optimal tableau. From To Amount Cost
Plant 1 Northwood 5 120
Westwood Dummy ui Plant 1 Westwood 45 1,350
Northwood Eastwood
24 30 40 0 Plant 2 Northwood 20 600
Plant 1 5 45 +4 +6 0
Plant 2 Eastwood 10 420
30 40 42 0 Total Cost = $2,490
Plant 2 20 +4 10 20 6

vj 24 30 36 -6

Dr. Ahmed Mohib 33 Dr. Ahmed Mohib 34

Example: Acme Block Co. Example: Acme Block Co.

„ Partial Spreadsheet Showing Problem Data „ Partial Spreadsheet Showing Optimal Solution
A B C D E F G H A B C D E F G
1 LHS Coefficients 10 X11 X12 X13 X21 X22 X23
11 Dec.Var.Values 5 45 0 20 0 10
2 Constraint X11 X12 X13 X21 X22 X23 RHS
12 Minimized Total Shipping Cost 2490
3 #1 1 1 1 50
13
4 #2 1 1 1 50
14 LHS RHS
Constraints
5 #3 1 1 25 15 P1.Cap. 50 <= 50
6 #4 1 1 45 16 P2.Cap. 30 <= 50
7 #5 1 1 10 17 N.Dem. 25 = 25
8 Obj.Coefficients 24 30 40 30 40 42 30 18 W.Dem. 45 = 45
19 E.Dem. 10 = 10

Dr. Ahmed Mohib 35 Dr. Ahmed Mohib 36

6
Example: Acme Block Co. Example: Acme Block Co.

„ Optimal Solution „ Partial Sensitivity Report (first half)

From To Amount Cost Adjustable Cells


Plant 1 Northwood 5 120 Final Reduced Objective Allowable Allowable
Cell Name Value Cost Coefficient Increase Decrease
Plant 1 Westwood 45 1,350 $C$12 X11 5 0 24 4 4
Plant 2 Northwood 20 600 $D$12 X12 45 0 30 4 1E+30
Plant 2 Eastwood 10 420 $E$12 X13 0 4 40 1E+30 4
Total Cost = $2,490 $F$12 X21 20 0 30 4 4
$G$12 X22 0 4 40 1E+30 4
$H$12 X23 10.000 0.000 42 4 1E+30

Dr. Ahmed Mohib 37 Dr. Ahmed Mohib 38

Example: Acme Block Co.


Transshipment Problem
„ Partial Sensitivity Report (second half)
• Transshipment problems are transportation problems in
Constraints which a shipment may move through intermediate nodes
Final Shadow Constraint Allowable Allowable (transshipment nodes)before reaching a particular
Cell Name Value Price R.H. Side Increase Decrease destination node.
$E$17 P2.Cap 30.0 0.0 50 1E+30 20 • Transshipment problems can be converted to larger
$E$18 N.Dem 25.0 30.0 25 20 20 transportation problems and solved by a special
$E$19 W.Dem 45.0 36.0 45 5 20 transportation program.
$E$20 E.Dem 10.0 42.0 10 20 10 • Transshipment problems can also be solved by general
$E$16 P1.Cap 50.0 -6.0 50 20 5 purpose linear programming codes.
• The network representation for a transshipment problem
with two sources, three intermediate nodes, and two
destinations is shown on the next slide.

Dr. Ahmed Mohib 39 Dr. Ahmed Mohib 40

Transshipment Problem Transshipment Problem


• Network Representation
c36 • Linear Programming Formulation
3 xij represents the shipment from node i to node j
c13
s1 1
c37 6 d1
c14 Min ΣΣcijxij
c15 c46 ij
Supply 4 c47 Demand s.t. Σxij < si for each origin i
c23 j
c24 c56 Σxik - Σxkj = 0 for each intermediate
s2 2 7 d2
c25 i j node k
5 c57
Sources Destinations Σxij = dj for each destination j
Intermediate Nodes i
xij > 0 for all i and j

Dr. Ahmed Mohib 41 Dr. Ahmed Mohib 42

7
Example: Zeron Shelving
Example: Zeron Shelving
Because of long standing contracts based on past
The Northside and Southside facilities of orders, unit costs from the manufacturers to the
Zeron Industries supply three firms (Zrox, suppliers are:
Hewes, Rockrite) with customized shelving for
its offices. They both order shelving from the Zeron N Zeron S
Arnold 5 8
same two manufacturers, Arnold
Supershelf 7 4
Manufacturers and Supershelf, Inc.
Currently weekly demands by the users The costs to install the shelving at the various
are 50 for Zrox, 60 for Hewes, and 40 for locations are:
Rockrite. Both Arnold and Supershelf can
supply at most 75 units to its customers. Zrox Hewes Rockrite
Thomas 1 5 8
Additional data is shown on the next slide. Washburn 3 4 4

Dr. Ahmed Mohib 43 Dr. Ahmed Mohib 44

Example: Zeron Shelving Example: Zeron Shelving


• Network Representation • Linear Programming Formulation
ZROX – Decision Variables Defined
Zrox 50 xij = amount shipped from manufacturer i to supplier j
5 1 xjk = amount shipped from supplier j to customer k
Zeron
75 ARNOLD
Arnold
N 5 where i = 1 (Arnold), 2 (Supershelf)
8 8 j = 3 (Zeron N), 4 (Zeron S)
Hewes 60
HEWES
k = 5 (Zrox), 6 (Hewes), 7 (Rockrite)
7 3 – Objective Function Defined
Super Zeron 4 Minimize Overall Shipping Costs:
75 Shelf WASH
S
4 BURN
4 Min 5x13 + 8x14 + 7x23 + 4x24 + 1x35 + 5x36 + 8x37
Rock-
Rite 40 + 3x45 + 4x46 + 4x47

Dr. Ahmed Mohib 45 Dr. Ahmed Mohib 46

Example: Zeron Shelving


Example: Zeron Shelving
„ Optimal Solution (from The Management Scientist )
• Constraints Defined
Amount Out of Arnold: x13 + x14 < 75 Objective Function Value = 1150.000
Amount Out of Supershelf: x23 + x24 < 75 Variable Value Reduced Costs
Amount Through Zeron N: x13 + x23 - x35 - x36 - x37 = X13 75.000 0.000
0 X14 0.000 2.000
Amount Through Zeron S: x14 + x24 - x45 - x46 - x47 = X23 0.000 4.000
X24 75.000 0.000
0
X35 50.000 0.000
Amount Into Zrox: x35 + x45 = 50 X36 25.000 0.000
Amount Into Hewes: x36 + x46 = 60 X37 0.000 3.000
Amount Into Rockrite: x37 + x47 = 40 X45 0.000 3.000
X46 35.000 0.000
Non-negativity of Variables: xij > 0, for all i and j. X47 40.000 0.000

Dr. Ahmed Mohib 47 Dr. Ahmed Mohib 48

8
Example: Zeron Shelving Example: Zeron Shelving

„ Optimal Solution „ Optimal Solution (continued)

Constraint Slack/Surplus Dual Prices


ZROX
Zrox 50
50 1 0.000 0.000
5 75 1 2 0.000 2.000
Zeron
75 ARNOLD
Arnold
N 5 25 3 0.000 -5.000
8 8 4 0.000 -6.000
Hewes 60 5 0.000 -6.000
35
HEWES

7 3 4 6 0.000 -10.000
Super Zeron 7 0.000 -10.000
75 Shelf WASH 40
4 S
BURN
75 4
Rock-
Rite 40

Dr. Ahmed Mohib 49 Dr. Ahmed Mohib 50

Example: Zeron Shelving Example: Zeron Shelving

„ Optimal Solution (continued) „ Optimal Solution (continued)

OBJECTIVE COEFFICIENT RANGES RIGHT HAND SIDE RANGES


Variable Lower Limit Current Value Upper Limit Constraint Lower Limit Current Value Upper Limit
X13 3.000 5.000 7.000 1 75.000 75.000 No Limit
X14 6.000 8.000 No Limit
X23 3.000 7.000 No Limit 2 75.000 75.000 100.000
X24 No Limit 4.000 6.000 3 -75.000 0.000 0.000
X35 No Limit 1.000 4.000 4 -25.000 0.000 0.000
X36 3.000 5.000 7.000 5 0.000 50.000 50.000
X37 5.000 8.000 No Limit 6 35.000 60.000 60.000
X45 0.000 3.000 No Limit
X46 2.000 4.000 6.000 7 15.000 40.000 40.000
X47 No Limit 4.000 7.000

Dr. Ahmed Mohib 51 Dr. Ahmed Mohib 52

Assignment Problem
Assignment Problem
• An assignment problem seeks to minimize the • Network Representation
total cost assignment of m workers to m jobs,
given that the cost of worker i performing job j is c11
1 1
cij. c12
• It assumes all workers are assigned and each job c13
Agents Tasks
is performed. c21
c22
• An assignment problem is a special case of a 2 2
transportation problem in which all supplies and c23
all demands are equal to 1; hence assignment
problems may be solved as linear programs. c31
c32
3 c33 3

Dr. Ahmed Mohib 53 Dr. Ahmed Mohib 54

9
Assignment Problem
Assignment Problem
• LP Formulation
„ LP Formulation Special Cases
xij : Agent i assigned to task j
xij = 0 or 1 for all i and j
•Number of agents exceeds the number of tasks:
Σxij < 1 for each agent i
Min ΣΣcijxij j
ij
•Number of tasks exceeds the number of agents:
s.t. Σxij = 1 for each agent i
j Add enough dummy agents to equalize the
number of agents and the number of tasks.
Σxij = 1 for each task j The objective function coefficients for these
i new variable would be zero.
Note: A modification to the right-hand side of the
first constraint set can be made if a worker is
permitted to work more than 1 job.
Dr. Ahmed Mohib 55 Dr. Ahmed Mohib 56

Assignment Problem Example: Who Does What?

„ LP Formulation Special Cases (continued) An electrical contractor pays his subcontractors a


•The assignment alternatives are evaluated in terms fixed fee plus mileage for work performed. On a given
day the contractor is faced with three electrical jobs
of revenue or profit: associated with various projects. Given below are the
Solve as a maximization problem. distances between the subcontractors and the projects.

•An assignment is unacceptable: Projects


Subcontractor A B C
Remove the corresponding decision variable.
Westside 50 36 16
•An agent is permitted to work a tasks: Federated 28 30 18
Goliath 35 32 20
Σxij < a for each agent i Universal 25 25 14
j
How should the contractors be assigned to minimize
total mileage costs?

Dr. Ahmed Mohib 57 Dr. Ahmed Mohib 58

Example: Who Does What? Example: Who Does What?

„ Network Representation „ Linear Programming Formulation


50
West. A Min 50x11+36x12+16x13+28x21+30x22+18x23
36
+35x31+32x32+20x33+25x41+25x42+14x43
Subcontractors 16 Projects s.t. x11+x12+x13 < 1
28 x21+x22+x23 < 1
30 Agents
Fed. B x31+x32+x33 < 1
18
x41+x42+x43 < 1
35 32
x11+x21+x31+x41 = 1
Gol. C x12+x22+x32+x42 = 1 Tasks
20
x13+x23+x33+x43 = 1
25 25 xij = 0 or 1 for all i and j
Univ.
14

Dr. Ahmed Mohib 59 Dr. Ahmed Mohib 60

10
Hungarian Method Hungarian Method

„ The Hungarian method solves minimization „ Step 1: For each row, subtract the minimum number in
assignment problems with m workers and m jobs. that row from all numbers in that row.
„ Special considerations can include: „ Step 2: For each column, subtract the minimum number
• number of workers does not equal the number of in that column from all numbers in that column.
jobs -- add dummy workers or jobs with 0 „ Step 3: Draw the minimum number of lines to cover all
assignment costs as needed zeroes. If this number = m, STOP -- an assignment can be
• worker i cannot do job j -- assign cij = +M made.
• maximization objective -- create an opportunity loss continued
matrix subtracting all profits for each job from the
maximum profit for that job before beginning the
Hungarian method

Dr. Ahmed Mohib 61 Dr. Ahmed Mohib 62

Hungarian Method Hungarian Method

„ Step 4: Determine the minimum uncovered number (call „ Finding the Minimum Number of Lines and
it d). Determining the Optimal Solution
• Subtract d from uncovered numbers. • Step 1: Find a row or column with only one unlined
• Add d to numbers covered by two lines. zero and circle it. (If all rows/columns have two or
• Numbers covered by one line remain the same. more unlined zeroes choose an arbitrary zero.)
• Then, GO TO STEP 3. • Step 2: If the circle is in a row with one zero, draw a
line through its column. If the circle is in a column
with one zero, draw a line through its row. One
approach, when all rows and columns have two or
more zeroes, is to draw a line through one with the
most zeroes, breaking ties arbitrarily.
continued

Dr. Ahmed Mohib 63 Dr. Ahmed Mohib 64

Hungarian Method Example: Who’s Doing What?

„ Finding the Minimum Number of Lines and An electrical contractor pays his subcontractors a
Determining the Optimal Solution (continued) fixed fee plus mileage for work performed. On a given
day the contractor is faced with three electrical jobs
• Step 3: Repeat step 2 until all circles are lined. If this associated with various projects. Given below are the
minimum number of lines equals m, the circles distances between the subcontractors and the projects.
provide the optimal assignment.
Projects
Subcontractor A B C
Westside 50 36 16
Federated 28 30 18
Goliath 35 32 20
Universal 25 25 14
How should the subcontractors be assigned to
minimize total mileage costs?

Dr. Ahmed Mohib 65 Dr. Ahmed Mohib 66

11
Example: Who’s Doing What? Example: Who’s Doing What?

„ Initial Tableau Setup „ Step 1: Subtract minimum number in each row


Since the Hungarian algorithm requires that there from all numbers in that row. Since each row has a
be the same number of rows as columns, add a Dummy zero, we would simply generate the same matrix above.
column so that the first tableau is: „ Step 2: Subtract the minimum number in each column
from all numbers in the column. For A it is 25, for B it
A B C Dummy is 25, for C it is 14, for Dummy it is 0. This yields:
Westside 50 36 16 0
Federated 28 30 18 0 A B C Dummy
Goliath 35 32 20 0 Westside 25 11 2 0
Universal 25 25 14 0 Federated 3 5 4 0
Goliath 10 7 6 0
Universal 0 0 0 0

Dr. Ahmed Mohib 67 Dr. Ahmed Mohib 68

Example: Who’s Doing What? Example: Who’s Doing What?

„ Step 3: Draw the minimum number of lines to „ Step 5: Subtract 2 from uncovered numbers; add
cover all zeroes using the following rules. If a 2 to all numbers covered by two lines. This gives:
"remaining" row has only one zero, draw a line through
the column. If a remaining column has only one zero in
A B C Dummy
it, draw a line through the row.
Westside 23 9 0 0
A B C Dummy Federated 1 3 2 0
Westside 25 11 2 0 Goliath 8 5 4 0
Federated 3 5 4 0 Universal 0 0 0 2
Goliath 10 7 6 0
Universal 0 0 0 0

„ Step 4: The minimum uncovered number is 2 (circled).

Dr. Ahmed Mohib 69 Dr. Ahmed Mohib 70

Example: Who’s Doing What? Example: Who’s Doing What?

„ Step 3: Draw the minimum number of lines to „ Step 5: Subtract 1 from uncovered numbers. Add
cover all zeroes. 1 to numbers covered by two lines. This gives:

A B C Dummy A B C Dummy
Westside 23 9 0 0 Westside 23 9 0 1
Federated 1 3 2 0 Federated 0 2 1 0
Goliath 8 5 4 0 Goliath 7 4 3 0
Universal 0 0 0 2 Universal 0 0 0 3

„ Step 4: The minimum uncovered number is 1 (circled).

Dr. Ahmed Mohib 71 Dr. Ahmed Mohib 72

12
Example: Who’s Doing What?
Example: Who Does What?
„ Step 4: The minimum number of lines to cover all • The optimal assignment is:
0's is four. Thus, there is a minimum-cost assignment of
0's with this tableau. The optimal assignment is: Subcontractor Project Distance
Westside C 16
Subcontractor Project Distance
Federated A 28
Westside C 16
Goliath (unassigned)
Federated A 28
Universal B 25
Goliath (unassigned)
Total Distance = 69 miles
Universal B 25
Total Distance = 69 miles

Dr. Ahmed Mohib 73 Dr. Ahmed Mohib 74

Hungarian Method Hungarian Method

„ The Hungarian method solves minimization „ Step 1: For each row, subtract the minimum number in
assignment problems with m workers and m jobs. that row from all numbers in that row.
„ Special considerations can include: „ Step 2: For each column, subtract the minimum number
• number of workers does not equal the number of in that column from all numbers in that column.
jobs -- add dummy workers or jobs with 0 „ Step 3: Draw the minimum number of lines to cover all
assignment costs as needed zeroes. If this number = m, STOP -- an assignment can be
• worker i cannot do job j -- assign cij = +M made.
• maximization objective -- create an opportunity loss continued
matrix subtracting all profits for each job from the
maximum profit for that job before beginning the
Hungarian method

Dr. Ahmed Mohib 75 Dr. Ahmed Mohib 76

Hungarian Method Hungarian Method

„ Step 4: Determine the minimum uncovered number (call „ Finding the Minimum Number of Lines and
it d). Determining the Optimal Solution
• Subtract d from uncovered numbers. • Step 1: Find a row or column with only one unlined
• Add d to numbers covered by two lines. zero and circle it. (If all rows/columns have two or
• Numbers covered by one line remain the same. more unlined zeroes choose an arbitrary zero.)
• Then, GO TO STEP 3. • Step 2: If the circle is in a row with one zero, draw a
line through its column. If the circle is in a column
with one zero, draw a line through its row. One
approach, when all rows and columns have two or
more zeroes, is to draw a line through one with the
most zeroes, breaking ties arbitrarily.
continued

Dr. Ahmed Mohib 77 Dr. Ahmed Mohib 78

13
Hungarian Method • Faculty of Engineering
„ Finding the Minimum Number of Lines and
Determining the Optimal Solution (continued)
• Step 3: Repeat step 2 until all circles are lined. If this
minimum number of lines equals m, the circles
provide the optimal assignment.

Dr. Ahmed Mohib 79

14

You might also like