All 36 questions UPSC has asked on transportation and assignment problems in the Statistics Optional (Paper II, Optimization Techniques) from 1996 to 2026, solved step by step – latest first.
Try them yourself first: the same questions, without solutions, are on our Optimization Techniques topic-wise PYQs page.
How we check these solutions
These are our own solutions, prepared with AI help. UPSC does not publish official answers. Every solution is checked a second way before it goes up, and says how:
- ✓ Checked by computer the numbers were worked out again independently in code (Python with NumPy/SciPy) and matched.
- ✓ Proof checked step by step for “prove that” and “examine whether” questions, every step was checked against the definitions and the standard theorems.
- ✓ Answer checked step by step for descriptive questions, every point was checked against the standard theory.
Spotted a mistake or a neater method? Tell us in the comments below or through Report an error.
Jump to a question (year · question number):
2026 · 2c(ii) 2026 · 4b(i) 2026 · 4b(ii) 2025 · 3b 2023 · 3b(i) 2023 · 4a 2022 · 4b 2021 · 1b 2021 · 3b 2020 · 3a 2020 · 3b 2019 · 4a 2018 · 2c 2017 · 2a 2016 · 1a 2016 · 2c 2015 · 4b 2013 · 3c 2013 · 4b 2011 · 4a 2010 · 2a 2010 · 4a 2009 · 2a 2006 · 3a 2005 · 3b 2003 · 3b 2003 · 4c 2002 · 3b 1999 · 6a 1998 · 11b 1998 · 11c 1997 · 11a 1997 · 11b 1996 · 11a 1996 · 11b 1996 · 11c
A company has 4 workers and 4 jobs. Each worker can perform any job, but the cost (in ₹) of assigning a worker to a job varies, as shown in the table given below:
| Worker \ Job | 1 | 2 | 3 | 4 |
| 1 | 9 | 2 | 7 | 8 |
| 2 | 6 | 4 | 3 | 7 |
| 3 | 5 | 8 | 1 | 8 |
| 4 | 7 | 6 | 9 | 4 |
Assign each worker to exactly one job such that the total cost of assignment is minimum.
Solution
We use the Hungarian method (the problem is balanced: 4 workers and 4 jobs; the objective is to minimise cost).
Step 1 (row reduction). Subtract the smallest element of each row (W1: 2, W2: 3, W3: 1, W4: 4) from every element of that row:
| J1 | J2 | J3 | J4 | |
|---|---|---|---|---|
| W1 | 7 | 0 | 5 | 6 |
| W2 | 3 | 1 | 0 | 4 |
| W3 | 4 | 7 | 0 | 7 |
| W4 | 3 | 2 | 5 | 0 |
Step 2 (column reduction). Subtract the smallest element of each column (J1: 3, J2: 0, J3: 0, J4: 0):
| J1 | J2 | J3 | J4 | |
|---|---|---|---|---|
| W1 | 4 | 0 | 5 | 6 |
| W2 | 0 | 1 | 0 | 4 |
| W3 | 1 | 7 | 0 | 7 |
| W4 | 0 | 2 | 5 | 0 |
Step 3 (test). The minimum number of lines covering all zeros is 4 = , so an optimal assignment can be made among the zeros.
Assignment. Choose one zero in each row and column (marked):
| J1 | J2 | J3 | J4 | |
|---|---|---|---|---|
| W1 | 4 | [0] | 5 | 6 |
| W2 | [0] | 1 | 0 | 4 |
| W3 | 1 | 7 | [0] | 7 |
| W4 | 0 | 2 | 5 | [0] |
| Worker | Job | Cost (₹) |
|---|---|---|
| 1 | 2 | 2 |
| 2 | 1 | 6 |
| 3 | 3 | 1 |
| 4 | 4 | 4 |
| Total | 13 |
Answer. Worker 1 → Job 2, Worker 2 → Job 1, Worker 3 → Job 3, Worker 4 → Job 4; minimum total cost ₹13.
✓ Checked by computer We checked in Python (scipy linear_sum_assignment and a search over all 24 assignments): the minimum cost is ₹13, and this assignment is the only optimal one.
What is a Transportation problem? Give a general mathematical model of a transportation problem.
Solution
Transportation problem. It is a special linear programming problem in which a homogeneous product is to be shipped from sources (factories, warehouses) to destinations (markets, depots). Source has units available, destination requires units, and the cost of shipping one unit from to is . The aim is to find how many units to send on each route so that all requirements are met, no availability is exceeded, and the total transportation cost is minimum.
General mathematical model. Let be the quantity shipped from source to destination . subject to
- It is balanced when ; this is the condition for a feasible solution. An unbalanced problem is balanced by adding a dummy source or destination with zero costs.
- There are variables and constraints, of which only are independent; a basic feasible solution has basic cells.
- The data are usually shown in a transportation table (cost matrix with a supply column and a demand row).
✓ Answer checked step by step Every point was checked against the standard definition and LP model of the transportation problem.
Use Vogel’s approximation method to solve the following transportation problem:
| Plant | Distribution Centre | Distribution Centre | Distribution Centre | Distribution Centre | Capacity |
| 2 | 3 | 11 | 7 | 6 | |
| 1 | 0 | 6 | 1 | 1 | |
| 5 | 8 | 15 | 9 | 10 | |
| Demand | 7 | 5 | 3 | 2 |
Solution
The problem is balanced: total capacity = total demand .
Vogel’s approximation method. At each step, the penalty of a row (column) is the difference between its two smallest remaining costs. Allocate as much as possible to the least-cost cell of the row or column with the largest penalty, and delete the row or column that is satisfied.
| Step | Row penalties | Column penalties | Largest penalty | Allocation |
|---|---|---|---|---|
| 1 | P1: 1, P2: 1, P3: 3 | D1: 1, D2: 3, D3: 5, D4: 6 | 6 (D4) | 1 to (P2, D4) at cost 1 |
| 2 | P1: 1, P3: 3 | D1: 3, D2: 5, D3: 4, D4: 2 | 5 (D2) | 5 to (P1, D2) at cost 3 |
| 3 | P1: 5, P3: 4 | D1: 3, D3: 4, D4: 2 | 5 (P1) | 1 to (P1, D1) at cost 2 |
| — | — | — | forced | 6 to (P3, D1) at cost 5 |
| — | — | — | forced | 3 to (P3, D3) at cost 15 |
| — | — | — | forced | 1 to (P3, D4) at cost 9 |
Initial basic feasible solution (VAM). Bold = units shipped, (cost):
| D1 | D2 | D3 | D4 | Supply | |
|---|---|---|---|---|---|
| P1 | 1 (2) | 5 (3) | (11) | (7) | 6 |
| P2 | (1) | (0) | (6) | 1 (1) | 1 |
| P3 | 6 (5) | (8) | 3 (15) | 1 (9) | 10 |
| Demand | 7 | 5 | 3 | 2 |
It has occupied cells (non-degenerate). Cost .
Optimality test (MODI method).
Iteration 1. Total cost = 102. For the occupied cells, (; ; ; ; ; ); taking in the row with most allocations gives the and shown. For each empty cell, .
| D1 | D2 | D3 | D4 | Supply | ||
|---|---|---|---|---|---|---|
| P1 | 1 (2) | 5 (3) | (11) Δ=−1 | (7) Δ=1 | 6 | −3 |
| P2 | (1) Δ=4 | (0) Δ=2 | (6) Δ=−1 | 1 (1) | 1 | −8 |
| P3 | 6 (5) | (8) Δ=2 | 3 (15) | 1 (9) | 10 | 0 |
| Demand | 7 | 5 | 3 | 2 | ||
| 5 | 6 | 15 | 9 |
The most negative is −1 at (P2, D3); it enters. Loop: (P2, D3) → (P2, D4) → (P3, D4) → (P3, D3) → (P2, D3), with signs (P2, D3)+, (P2, D4)−, (P3, D4)+, (P3, D3)−. smallest allocation in a “−” cell . Cost falls by .
Iteration 2. Total cost = 101. For the occupied cells, (; ; ; ; ; ); taking in the row with most allocations gives the and shown. For each empty cell, .
| D1 | D2 | D3 | D4 | Supply | ||
|---|---|---|---|---|---|---|
| P1 | 1 (2) | 5 (3) | (11) Δ=−1 | (7) Δ=1 | 6 | −3 |
| P2 | (1) Δ=5 | (0) Δ=3 | 1 (6) | (1) Δ=1 | 1 | −9 |
| P3 | 6 (5) | (8) Δ=2 | 2 (15) | 2 (9) | 10 | 0 |
| Demand | 7 | 5 | 3 | 2 | ||
| 5 | 6 | 15 | 9 |
The most negative is −1 at (P1, D3); it enters. Loop: (P1, D3) → (P1, D1) → (P3, D1) → (P3, D3) → (P1, D3), with signs (P1, D3)+, (P1, D1)−, (P3, D1)+, (P3, D3)−. smallest allocation in a “−” cell . Cost falls by .
Iteration 3. Total cost = 100. For the occupied cells, (; ; ; ; ; ); taking in the row with most allocations gives the and shown. For each empty cell, .
| D1 | D2 | D3 | D4 | Supply | ||
|---|---|---|---|---|---|---|
| P1 | (2) Δ=1 | 5 (3) | 1 (11) | (7) Δ=2 | 6 | −4 |
| P2 | (1) Δ=5 | (0) Δ=2 | 1 (6) | (1) Δ=1 | 1 | −9 |
| P3 | 7 (5) | (8) Δ=1 | 1 (15) | 2 (9) | 10 | 0 |
| Demand | 7 | 5 | 3 | 2 | ||
| 5 | 7 | 15 | 9 |
All , so this solution is optimal.
Optimal schedule.
| Route | Units | Cost |
|---|---|---|
| 5 | 15 | |
| 1 | 11 | |
| 1 | 6 | |
| 7 | 35 | |
| 1 | 15 | |
| 2 | 18 | |
| Minimum total cost | 100 |
(VAM gave 102, close to but not at the optimum; one more improvement by the MODI method gives the minimum, 100.)
✓ Checked by computer We checked in Python (scipy linprog on the LP form): the minimum cost is 100. The VAM start (cost 102) and the MODI tables below were computed with exact arithmetic.
A company has four plants , , and from which it supplies to three markets , and . Determine the optimal transportation plan from the following data giving the plant to market shifting costs, quantities available at each plant and quantities required at each market:
| Market ↓ | Plant | Plant | Plant | Plant | Required at market |
| 19 | 14 | 23 | 11 | 11 | |
| 15 | 16 | 12 | 21 | 13 | |
| 30 | 25 | 16 | 39 | 19 | |
| Available at plant | 6 | 10 | 12 | 15 | 43 |
Solution
Set-up. In the table the rows are markets and the columns plants. We rewrite it with the plants as sources:
| Available | ||||
|---|---|---|---|---|
| 19 | 15 | 30 | 6 | |
| 14 | 16 | 25 | 10 | |
| 23 | 12 | 16 | 12 | |
| 11 | 21 | 39 | 15 | |
| Required | 11 | 13 | 19 | 43 |
Total available = total required = 43, so the problem is balanced.
Initial solution by Vogel’s method.
| Step | Row penalties | Column penalties | Largest penalty | Allocation |
|---|---|---|---|---|
| 1 | P1: 4, P2: 2, P3: 4, P4: 10 | M1: 3, M2: 3, M3: 9 | 10 (P4) | 11 to (P4, M1) at cost 11 |
| 2 | P1: 15, P2: 9, P3: 4, P4: 18 | M2: 3, M3: 9 | 18 (P4) | 4 to (P4, M2) at cost 21 |
| 3 | P1: 15, P2: 9, P3: 4 | M2: 3, M3: 9 | 15 (P1) | 6 to (P1, M2) at cost 15 |
| 4 | P2: 9, P3: 4 | M2: 4, M3: 9 | 9 (M3) | 12 to (P3, M3) at cost 16 |
| — | — | — | forced | 3 to (P2, M2) at cost 16 |
| — | — | — | forced | 7 to (P2, M3) at cost 25 |
| M1 | M2 | M3 | Supply | |
|---|---|---|---|---|
| P1 | (19) | 6 (15) | (30) | 6 |
| P2 | (14) | 3 (16) | 7 (25) | 10 |
| P3 | (23) | (12) | 12 (16) | 12 |
| P4 | 11 (11) | 4 (21) | (39) | 15 |
| Demand | 11 | 13 | 19 |
occupied cells. Cost .
MODI test.
Iteration 1. Total cost = 710. For the occupied cells, (; ; ; ; ; ); taking in the row with most allocations gives the and shown. For each empty cell, .
| M1 | M2 | M3 | Supply | ||
|---|---|---|---|---|---|
| P1 | (19) Δ=14 | 6 (15) | (30) Δ=6 | 6 | −1 |
| P2 | (14) Δ=8 | 3 (16) | 7 (25) | 10 | 0 |
| P3 | (23) Δ=26 | (12) Δ=5 | 12 (16) | 12 | −9 |
| P4 | 11 (11) | 4 (21) | (39) Δ=9 | 15 | 5 |
| Demand | 11 | 13 | 19 | ||
| 6 | 16 | 25 |
All , so this solution is optimal.
Optimal plan. : 6; : 3; : 7; : 12; : 11; : 4. Minimum shifting cost = 710.
✓ Checked by computer We checked in Python (scipy linprog on the LP form): the minimum cost is 710; the VAM start and the MODI test below were computed with exact arithmetic.
.
| Jobs \ Machines | I | II | III | IV |
| A | 10 | 12 | 19 | 11 |
| B | 5 | 10 | 7 | 8 |
| C | 12 | 14 | 13 | 11 |
| D | 8 | 15 | 11 | 9 |
Solve the above assignment problem. Cell values represent cost of assigning job and to the machines and .
Solution
Hungarian method (minimisation, 4 × 4, balanced).
Step 1 (row reduction). Subtract the smallest element of each row (A: 10, B: 5, C: 11, D: 8) from every element of that row:
| I | II | III | IV | |
|---|---|---|---|---|
| A | 0 | 2 | 9 | 1 |
| B | 0 | 5 | 2 | 3 |
| C | 1 | 3 | 2 | 0 |
| D | 0 | 7 | 3 | 1 |
Step 2 (column reduction). Subtract the smallest element of each column (I: 0, II: 2, III: 2, IV: 0):
| I | II | III | IV | |
|---|---|---|---|---|
| A | 0 | 0 | 7 | 1 |
| B | 0 | 3 | 0 | 3 |
| C | 1 | 1 | 0 | 0 |
| D | 0 | 5 | 1 | 1 |
Step 3 (test). The minimum number of lines covering all zeros is 4 = , so an optimal assignment can be made among the zeros.
Assignment.
| I | II | III | IV | |
|---|---|---|---|---|
| A | 0 | [0] | 7 | 1 |
| B | 0 | 3 | [0] | 3 |
| C | 1 | 1 | 0 | [0] |
| D | [0] | 5 | 1 | 1 |
| Job | Machine | Cost |
|---|---|---|
| II | 12 | |
| III | 7 | |
| IV | 11 | |
| I | 8 | |
| Total | 38 |
Answer. II, III, IV, I, with minimum total cost 38.
✓ Checked by computer We checked in Python (scipy linear_sum_assignment and all 24 assignments): the minimum cost is 38 and the optimal assignment is unique.
A Company ships truckloads of grain from three silos to four mills. The supply (in truckloads) and the demand (also in truckloads) together with the unit transportation costs per truckload on the different routes are summarized in the following table:
| D | E | F | G | Available | |
| A | 11 | 13 | 17 | 14 | 250 |
| B | 16 | 18 | 14 | 10 | 300 |
| C | 21 | 24 | 13 | 10 | 400 |
| Requirement | 200 | 225 | 275 | 250 |
Purpose is to find the minimum-cost shipping schedule between the silos and the mills. Use any method. Obtain the starting basic feasible solution.
Solution
Supply and requirement : the problem is balanced.
Starting basic feasible solution by Vogel’s approximation method.
| Step | Row penalties | Column penalties | Largest penalty | Allocation |
|---|---|---|---|---|
| 1 | A: 2, B: 4, C: 3 | D: 5, E: 5, F: 1, G: 0 | 5 (D) | 200 to (A, D) at cost 11 |
| 2 | A: 1, B: 4, C: 3 | E: 5, F: 1, G: 0 | 5 (E) | 50 to (A, E) at cost 13 |
| 3 | B: 4, C: 3 | E: 6, F: 1, G: 0 | 6 (E) | 175 to (B, E) at cost 18 |
| 4 | B: 4, C: 3 | F: 1, G: 0 | 4 (B) | 125 to (B, G) at cost 10 |
| — | — | — | forced | 275 to (C, F) at cost 13 |
| — | — | — | forced | 125 to (C, G) at cost 10 |
| D | E | F | G | Supply | |
|---|---|---|---|---|---|
| A | 200 (11) | 50 (13) | (17) | (14) | 250 |
| B | (16) | 175 (18) | (14) | 125 (10) | 300 |
| C | (21) | (24) | 275 (13) | 125 (10) | 400 |
| Demand | 200 | 225 | 275 | 250 |
There are occupied cells, so this is a non-degenerate basic feasible solution. Its cost:
(For comparison, the north-west corner rule gives a starting cost of 12,200.)
Is it optimal? (MODI test)
Iteration 1. Total cost = 12075. For the occupied cells, (; ; ; ; ; ); taking in the row with most allocations gives the and shown. For each empty cell, .
| D | E | F | G | Supply | ||
|---|---|---|---|---|---|---|
| A | 200 (11) | 50 (13) | (17) Δ=9 | (14) Δ=9 | 250 | 0 |
| B | (16) Δ=0 | 175 (18) | (14) Δ=1 | 125 (10) | 300 | 5 |
| C | (21) Δ=5 | (24) Δ=6 | 275 (13) | 125 (10) | 400 | 5 |
| Demand | 200 | 225 | 275 | 250 | ||
| 11 | 13 | 8 | 5 |
All , so this solution is optimal. (Some : (B, D), so alternative optimal solutions exist.)
Minimum-cost shipping schedule. A → D: 200, A → E: 50, B → E: 175, B → G: 125, C → F: 275, C → G: 125 truckloads. Minimum cost = 12,075. Here the VAM starting solution is already optimal.
✓ Checked by computer We checked in Python (scipy linprog): the minimum cost is 12,075, equal to the VAM starting cost; the MODI test below confirms it.
An airline that operates seven days a week has the time-table shown below. Crew must have a minimum layover of 5 hours between flights. Obtain the pairing of flights that minimizes layover time away from home. For any given pairing, crew will be based at the city that results in the smaller layover:
| Delhi–Jaipur Flight No. | Departure | Arrival | Jaipur–Delhi Flight No. | Departure | Arrival |
| 1 | 7:00 AM | 8:00 AM | 101 | 8:00 AM | 9:15 AM |
| 2 | 8:00 AM | 9:00 AM | 102 | 8:30 AM | 9:45 AM |
| 3 | 1:30 PM | 2:30 PM | 103 | 12 Noon | 1:15 PM |
| 4 | 6:30 PM | 7:30 PM | 104 | 5:30 PM | 6:45 PM |
For each pair, also mention the city where the crew should be based.
Solution
Layover times. For each pair (Delhi–Jaipur flight , Jaipur–Delhi flight ):
- Crew based at Delhi: they fly to Jaipur and return on . Layover at Jaipur = departure of − arrival of ; if this is less than 5 hours they must wait for the next day’s flight , so add 24 hours.
- Crew based at Jaipur: they fly to Delhi and return on . Layover at Delhi = departure of − arrival of (+24 h if less than 5 h).
Crew based at Delhi (hours):
| 101 | 102 | 103 | 104 | |
|---|---|---|---|---|
| 1 | 24 | 24.5 | 28 | 9.5 |
| 2 | 23 | 23.5 | 27 | 8.5 |
| 3 | 17.5 | 18 | 21.5 | 27 |
| 4 | 12.5 | 13 | 16.5 | 22 |
Crew based at Jaipur (hours):
| 101 | 102 | 103 | 104 | |
|---|---|---|---|---|
| 1 | 21.75 | 21.25 | 17.75 | 12.25 |
| 2 | 22.75 | 22.25 | 18.75 | 13.25 |
| 3 | 28.25 | 27.75 | 24.25 | 18.75 |
| 4 | 9.25 | 8.75 | 5.25 | 23.75 |
For each pair we take the smaller layover; D or J shows where the crew should be based:
| 101 | 102 | 103 | 104 | |
|---|---|---|---|---|
| 1 | 21.75 (J) | 21.25 (J) | 17.75 (J) | 9.5 (D) |
| 2 | 22.75 (J) | 22.25 (J) | 18.75 (J) | 8.5 (D) |
| 3 | 17.5 (D) | 18 (D) | 21.5 (D) | 18.75 (J) |
| 4 | 9.25 (J) | 8.75 (J) | 5.25 (J) | 22 (D) |
Hungarian method on this matrix (minimise total layover):
Step 1 (row reduction). Subtract the smallest element of each row (1: 9.5, 2: 8.5, 3: 17.5, 4: 5.25) from every element of that row:
| 101 | 102 | 103 | 104 | |
|---|---|---|---|---|
| 1 | 12.25 | 11.75 | 8.25 | 0 |
| 2 | 14.25 | 13.75 | 10.25 | 0 |
| 3 | 0 | 0.5 | 4 | 1.25 |
| 4 | 4 | 3.5 | 0 | 16.75 |
Step 2 (column reduction). Subtract the smallest element of each column (101: 0, 102: 0.5, 103: 0, 104: 0):
| 101 | 102 | 103 | 104 | |
|---|---|---|---|---|
| 1 | 12.25 | 11.25 | 8.25 | 0 |
| 2 | 14.25 | 13.25 | 10.25 | 0 |
| 3 | 0 | 0 | 4 | 1.25 |
| 4 | 4 | 3 | 0 | 16.75 |
Step 3 (test). All zeros can be covered by only 3 lines (row 3, row 4, column 104) < , so we cannot yet assign.
Step 4 (revise). The smallest uncovered element is 8.25. Subtract it from every uncovered element and add it to the elements at the intersections of two lines:
| 101 | 102 | 103 | 104 | |
|---|---|---|---|---|
| 1 | 4 | 3 | 0 | 0 |
| 2 | 6 | 5 | 2 | 0 |
| 3 | 0 | 0 | 4 | 9.5 |
| 4 | 4 | 3 | 0 | 25 |
Step 5 (test). All zeros can be covered by only 3 lines (row 3, column 103, column 104) < , so we cannot yet assign.
Step 6 (revise). The smallest uncovered element is 3. Subtract it from every uncovered element and add it to the elements at the intersections of two lines:
| 101 | 102 | 103 | 104 | |
|---|---|---|---|---|
| 1 | 1 | 0 | 0 | 0 |
| 2 | 3 | 2 | 2 | 0 |
| 3 | 0 | 0 | 7 | 12.5 |
| 4 | 1 | 0 | 0 | 25 |
Step 7 (test). The minimum number of lines covering all zeros is 4 = , so an optimal assignment can be made among the zeros.
Assignment.
| 101 | 102 | 103 | 104 | |
|---|---|---|---|---|
| 1 | 1 | 0 | [0] | 0 |
| 2 | 3 | 2 | 2 | [0] |
| 3 | [0] | 0 | 7 | 12.5 |
| 4 | 1 | [0] | 0 | 25 |
| Pair | Layover (h) | Crew based at |
|---|---|---|
| Flights 1 and 103 | 17.75 | Jaipur |
| Flights 2 and 104 | 8.5 | Delhi |
| Flights 3 and 101 | 17.5 | Delhi |
| Flights 4 and 102 | 8.75 | Jaipur |
| Total | 52.5 |
Answer. Pair 1–103 (base Jaipur), 2–104 (base Delhi), 3–101 (base Delhi), 4–102 (base Jaipur); minimum total layover 52.5 hours.
An equally good alternative: 1–102 (Jaipur, 21.25 h), 2–104 (Delhi), 3–101 (Delhi), 4–103 (Jaipur, 5.25 h); total also 52.5 h.
✓ Checked by computer We computed every layover in Python (with the 5-hour minimum, adding 24 hours where needed), and checked the assignment over all 24 pairings: the minimum total layover is 52.5 hours, with two optimal pairings.
.
| Town \ Depot | I | II | III | IV | V |
| A | 160 | 130 | 175 | 190 | 200 |
| B | 135 | 120 | 130 | 160 | 175 |
| C | 140 | 110 | 145 | 170 | 185 |
| D | 50 | 50 | 80 | 80 | 110 |
| E | 55 | 35 | 80 | 80 | 105 |
Solve the above assignment problem.
Solution
The costs (distances) are to be minimised; the matrix is 5 × 5, so the problem is balanced. Hungarian method:
Step 1 (row reduction). Subtract the smallest element of each row (A: 130, B: 120, C: 110, D: 50, E: 35) from every element of that row:
| I | II | III | IV | V | |
|---|---|---|---|---|---|
| A | 30 | 0 | 45 | 60 | 70 |
| B | 15 | 0 | 10 | 40 | 55 |
| C | 30 | 0 | 35 | 60 | 75 |
| D | 0 | 0 | 30 | 30 | 60 |
| E | 20 | 0 | 45 | 45 | 70 |
Step 2 (column reduction). Subtract the smallest element of each column (I: 0, II: 0, III: 10, IV: 30, V: 55):
| I | II | III | IV | V | |
|---|---|---|---|---|---|
| A | 30 | 0 | 35 | 30 | 15 |
| B | 15 | 0 | 0 | 10 | 0 |
| C | 30 | 0 | 25 | 30 | 20 |
| D | 0 | 0 | 20 | 0 | 5 |
| E | 20 | 0 | 35 | 15 | 15 |
Step 3 (test). All zeros can be covered by only 3 lines (row B, row D, column II) < , so we cannot yet assign.
Step 4 (revise). The smallest uncovered element is 15. Subtract it from every uncovered element and add it to the elements at the intersections of two lines:
| I | II | III | IV | V | |
|---|---|---|---|---|---|
| A | 15 | 0 | 20 | 15 | 0 |
| B | 15 | 15 | 0 | 10 | 0 |
| C | 15 | 0 | 10 | 15 | 5 |
| D | 0 | 15 | 20 | 0 | 5 |
| E | 5 | 0 | 20 | 0 | 0 |
Step 5 (test). The minimum number of lines covering all zeros is 5 = , so an optimal assignment can be made among the zeros.
Assignment.
| I | II | III | IV | V | |
|---|---|---|---|---|---|
| A | 15 | 0 | 20 | 15 | [0] |
| B | 15 | 15 | [0] | 10 | 0 |
| C | 15 | [0] | 10 | 15 | 5 |
| D | [0] | 15 | 20 | 0 | 5 |
| E | 5 | 0 | 20 | [0] | 0 |
| Town | Depot | Cost |
|---|---|---|
| V | 200 | |
| III | 130 | |
| II | 110 | |
| I | 50 | |
| IV | 80 | |
| Total | 570 |
Answer. –V, –III, –II, –I, –IV; minimum total cost 570.
✓ Checked by computer We checked in Python (scipy linear_sum_assignment and all 120 assignments): the minimum total is 570 and the optimal assignment is unique.
.
| Factory \ Store | I | II | III | IV | Supply |
| A | 4 | 6 | 8 | 13 | 50 |
| B | 13 | 11 | 10 | 8 | 70 |
| C | 14 | 4 | 10 | 13 | 30 |
| D | 9 | 11 | 13 | 8 | 50 |
| Demand | 25 | 35 | 105 | 20 |
Use MODI method to solve the above transportation problem.
Solution
Balancing. Total supply , total demand . We add a dummy store with demand and zero costs (goods “sent” there stay unshipped at the factory).
Initial solution (Vogel’s method).
| Step | Row penalties | Column penalties | Largest penalty | Allocation |
|---|---|---|---|---|
| 1 | A: 4, B: 8, C: 4, D: 8 | I: 5, II: 2, III: 2, IV: 0, Dummy: 0 | 8 (B) | 15 to (B, Dummy) at cost 0 |
| 2 | A: 2, B: 2, C: 6, D: 1 | I: 5, II: 2, III: 2, IV: 0 | 6 (C) | 30 to (C, II) at cost 4 |
| 3 | A: 2, B: 2, D: 1 | I: 5, II: 5, III: 2, IV: 0 | 5 (I) | 25 to (A, I) at cost 4 |
| 4 | A: 2, B: 2, D: 3 | II: 5, III: 2, IV: 0 | 5 (II) | 5 to (A, II) at cost 6 |
| 5 | A: 5, B: 2, D: 5 | III: 2, IV: 0 | 5 (A) | 20 to (A, III) at cost 8 |
| 6 | B: 2, D: 5 | III: 3, IV: 0 | 5 (D) | 20 to (D, IV) at cost 8 |
| — | — | — | forced | 55 to (B, III) at cost 10 |
| — | — | — | forced | 30 to (D, III) at cost 13 |
| I | II | III | IV | Dummy | Supply | |
|---|---|---|---|---|---|---|
| A | 25 (4) | 5 (6) | 20 (8) | (13) | (0) | 50 |
| B | (13) | (11) | 55 (10) | (8) | 15 (0) | 70 |
| C | (14) | 30 (4) | (10) | (13) | (0) | 30 |
| D | (9) | (11) | 30 (13) | 20 (8) | (0) | 50 |
| Demand | 25 | 35 | 105 | 20 | 15 |
occupied cells. Initial cost = 1,510.
MODI method.
Iteration 1. Total cost = 1510. For the occupied cells, (; ; ; ; ; ; ; ); taking in the row with most allocations gives the and shown. For each empty cell, .
| I | II | III | IV | Dummy | Supply | ||
|---|---|---|---|---|---|---|---|
| A | 25 (4) | 5 (6) | 20 (8) | (13) Δ=10 | (0) Δ=2 | 50 | 0 |
| B | (13) Δ=7 | (11) Δ=3 | 55 (10) | (8) Δ=3 | 15 (0) | 70 | 2 |
| C | (14) Δ=12 | 30 (4) | (10) Δ=4 | (13) Δ=12 | (0) Δ=4 | 30 | −2 |
| D | (9) Δ=0 | (11) Δ=0 | 30 (13) | 20 (8) | (0) Δ=−3 | 50 | 5 |
| Demand | 25 | 35 | 105 | 20 | 15 | ||
| 4 | 6 | 8 | 3 | −2 |
The most negative is −3 at (D, Dummy); it enters. Loop: (D, Dummy) → (D, III) → (B, III) → (B, Dummy) → (D, Dummy), with signs (D, Dummy)+, (D, III)−, (B, III)+, (B, Dummy)−. smallest allocation in a “−” cell . Cost falls by .
Iteration 2. Total cost = 1465. For the occupied cells, (; ; ; ; ; ; ; ); taking in the row with most allocations gives the and shown. For each empty cell, .
| I | II | III | IV | Dummy | Supply | ||
|---|---|---|---|---|---|---|---|
| A | 25 (4) | 5 (6) | 20 (8) | (13) Δ=10 | (0) Δ=5 | 50 | 0 |
| B | (13) Δ=7 | (11) Δ=3 | 70 (10) | (8) Δ=3 | (0) Δ=3 | 70 | 2 |
| C | (14) Δ=12 | 30 (4) | (10) Δ=4 | (13) Δ=12 | (0) Δ=7 | 30 | −2 |
| D | (9) Δ=0 | (11) Δ=0 | 15 (13) | 20 (8) | 15 (0) | 50 | 5 |
| Demand | 25 | 35 | 105 | 20 | 15 | ||
| 4 | 6 | 8 | 3 | −5 |
All , so this solution is optimal. (Some : (D, I), (D, II), so alternative optimal solutions exist.)
Optimal schedule.
| Route | Units | Cost |
|---|---|---|
| A → I | 25 | 100 |
| A → II | 5 | 30 |
| A → III | 20 | 160 |
| B → III | 70 | 700 |
| C → II | 30 | 120 |
| D → III | 15 | 195 |
| D → IV | 20 | 160 |
| D → Dummy | 15 | 0 |
| Minimum cost | 1,465 |
Factory D keeps 15 units unshipped.
✓ Checked by computer We checked in Python (scipy linprog): the minimum cost is 1,465. The VAM start (1,510) and the MODI iterations below were computed with exact arithmetic.
Discuss Assignment Problem. Consider the problem of assigning five jobs to five persons. The assignment costs are given as follows:
| Person \ Job | 1 | 2 | 3 | 4 | 5 |
| 8 | 4 | 2 | 6 | 1 | |
| 0 | 9 | 5 | 5 | 4 | |
| 3 | 8 | 9 | 2 | 6 | |
| 4 | 3 | 1 | 0 | 3 | |
| 9 | 5 | 8 | 9 | 5 |
Determine the optimum assignment schedule.
Solution
Assignment problem. jobs are to be assigned to persons, one job to each person and one person to each job, so that the total cost (or time) is minimum. With if person gets job and 0 otherwise: It is a special transportation problem with all supplies and demands equal to 1, and is solved efficiently by the Hungarian method, which rests on the fact that adding or subtracting a constant to a whole row or column does not change the optimal assignment.
Solution (Hungarian method).
Step 1 (row reduction). Subtract the smallest element of each row (A: 1, B: 0, C: 2, D: 0, E: 5) from every element of that row:
| 1 | 2 | 3 | 4 | 5 | |
|---|---|---|---|---|---|
| A | 7 | 3 | 1 | 5 | 0 |
| B | 0 | 9 | 5 | 5 | 4 |
| C | 1 | 6 | 7 | 0 | 4 |
| D | 4 | 3 | 1 | 0 | 3 |
| E | 4 | 0 | 3 | 4 | 0 |
Step 2 (column reduction). Subtract the smallest element of each column (1: 0, 2: 0, 3: 1, 4: 0, 5: 0):
| 1 | 2 | 3 | 4 | 5 | |
|---|---|---|---|---|---|
| A | 7 | 3 | 0 | 5 | 0 |
| B | 0 | 9 | 4 | 5 | 4 |
| C | 1 | 6 | 6 | 0 | 4 |
| D | 4 | 3 | 0 | 0 | 3 |
| E | 4 | 0 | 2 | 4 | 0 |
Step 3 (test). The minimum number of lines covering all zeros is 5 = , so an optimal assignment can be made among the zeros.
Assignment.
| 1 | 2 | 3 | 4 | 5 | |
|---|---|---|---|---|---|
| A | 7 | 3 | 0 | 5 | [0] |
| B | [0] | 9 | 4 | 5 | 4 |
| C | 1 | 6 | 6 | [0] | 4 |
| D | 4 | 3 | [0] | 0 | 3 |
| E | 4 | [0] | 2 | 4 | 0 |
| Person | Job | Cost |
|---|---|---|
| 5 | 1 | |
| 1 | 0 | |
| 4 | 2 | |
| 3 | 1 | |
| 2 | 5 | |
| Total | 9 |
Optimum schedule: –5, –1, –4, –3, –2; minimum cost 9.
✓ Checked by computer We checked in Python (scipy linear_sum_assignment and all 120 assignments): the minimum cost is 9 and the optimal assignment is unique.
Solve the following Transportation Problem by MODI method:
| Origin \ Destination | Availability | ||||
| 1 | 2 | 1 | 4 | 30 | |
| 3 | 3 | 2 | 1 | 50 | |
| 4 | 2 | 5 | 9 | 20 | |
| Demand | 20 | 40 | 30 | 10 |
Solution
Availability = demand : balanced.
Initial basic feasible solution (Vogel’s method).
| Step | Row penalties | Column penalties | Largest penalty | Allocation |
|---|---|---|---|---|
| 1 | O1: 0, O2: 1, O3: 2 | D1: 2, D2: 0, D3: 1, D4: 3 | 3 (D4) | 10 to (O2, D4) at cost 1 |
| 2 | O1: 0, O2: 1, O3: 2 | D1: 2, D2: 0, D3: 1 | 2 (D1) | 20 to (O1, D1) at cost 1 |
| 3 | O1: 1, O2: 1, O3: 3 | D2: 0, D3: 1 | 3 (O3) | 20 to (O3, D2) at cost 2 |
| 4 | O1: 1, O2: 1 | D2: 1, D3: 1 | 1 (O1) | 10 to (O1, D3) at cost 1 |
| — | — | — | forced | 20 to (O2, D2) at cost 3 |
| — | — | — | forced | 20 to (O2, D3) at cost 2 |
| D1 | D2 | D3 | D4 | Supply | |
|---|---|---|---|---|---|
| O1 | 20 (1) | (2) | 10 (1) | (4) | 30 |
| O2 | (3) | 20 (3) | 20 (2) | 10 (1) | 50 |
| O3 | (4) | 20 (2) | (5) | (9) | 20 |
| Demand | 20 | 40 | 30 | 10 |
6 occupied cells . Cost .
MODI method.
Iteration 1. Total cost = 180. For the occupied cells, (; ; ; ; ; ); taking in the row with most allocations gives the and shown. For each empty cell, .
| D1 | D2 | D3 | D4 | Supply | ||
|---|---|---|---|---|---|---|
| O1 | 20 (1) | (2) Δ=0 | 10 (1) | (4) Δ=4 | 30 | −1 |
| O2 | (3) Δ=1 | 20 (3) | 20 (2) | 10 (1) | 50 | 0 |
| O3 | (4) Δ=3 | 20 (2) | (5) Δ=4 | (9) Δ=9 | 20 | −1 |
| Demand | 20 | 40 | 30 | 10 | ||
| 2 | 3 | 2 | 1 |
All , so this solution is optimal. (Some : (O1, D2), so alternative optimal solutions exist.)
Optimal solution. : 20, : 10, : 20, : 20, : 10, : 20. Minimum cost = 180.
✓ Checked by computer We checked in Python (scipy linprog): the minimum cost is 180; the VAM start already attains it, as the MODI test below shows.
Obtain an optimum solution for the following transportation problem:
| Factory \ Warehouse | Supply | |||
| 20 | 40 | 40 | 152 | |
| 80 | 120 | 80 | 164 | |
| 40 | 80 | 120 | 154 | |
| Demand | 144 | 204 | 82 |
Solution
Balancing. Supply ; demand . Add a dummy warehouse with demand 40 and zero costs.
Initial solution (Vogel’s method).
| Step | Row penalties | Column penalties | Largest penalty | Allocation |
|---|---|---|---|---|
| 1 | X: 20, Y: 80, Z: 40 | A: 20, B: 40, C: 40, Dummy: 0 | 80 (Y) | 40 to (Y, Dummy) at cost 0 |
| 2 | X: 20, Y: 0, Z: 40 | A: 20, B: 40, C: 40 | 40 (B) | 152 to (X, B) at cost 40 |
| 3 | Y: 0, Z: 40 | A: 40, B: 40, C: 40 | 40 (Z) | 144 to (Z, A) at cost 40 |
| 4 | Y: 40, Z: 40 | B: 40, C: 40 | 40 (Y) | 82 to (Y, C) at cost 80 |
| — | — | — | forced | 42 to (Y, B) at cost 120 |
| — | — | — | forced | 10 to (Z, B) at cost 80 |
| A | B | C | Dummy | Supply | |
|---|---|---|---|---|---|
| X | (20) | 152 (40) | (40) | (0) | 152 |
| Y | (80) | 42 (120) | 82 (80) | 40 (0) | 164 |
| Z | 144 (40) | 10 (80) | (120) | (0) | 154 |
| Demand | 144 | 204 | 82 | 40 |
6 occupied cells . Cost .
MODI test.
Iteration 1. Total cost = 24240. For the occupied cells, (; ; ; ; ; ); taking in the row with most allocations gives the and shown. For each empty cell, .
| A | B | C | Dummy | Supply | ||
|---|---|---|---|---|---|---|
| X | (20) Δ=20 | 152 (40) | (40) Δ=40 | (0) Δ=80 | 152 | −80 |
| Y | (80) Δ=0 | 42 (120) | 82 (80) | 40 (0) | 164 | 0 |
| Z | 144 (40) | 10 (80) | (120) Δ=80 | (0) Δ=40 | 154 | −40 |
| Demand | 144 | 204 | 82 | 40 | ||
| 80 | 120 | 80 | 0 |
All , so this solution is optimal. (Some : (Y, A), so alternative optimal solutions exist.)
Optimum. : 152; : 42; : 82; : 144; : 10; factory keeps 40 units unused (dummy). Minimum cost = 24,240.
✓ Checked by computer We checked in Python (scipy linprog with a dummy warehouse): the minimum cost is 24,240; the VAM start and the MODI test below were computed with exact arithmetic.
Discuss a transportation problem (TP) and show that it can be formulated as a linear programming problem. Obtain a necessary and sufficient condition under which a TP has always a feasible solution. Find the first feasible solution of the following TP using Vogel’s approximation method (VAM):
| Port \ Destination | Requirement | ||||||
| 5 | 3 | 7 | 3 | 8 | 5 | 3 | |
| 5 | 6 | 12 | 5 | 7 | 11 | 4 | |
| 2 | 8 | 3 | 4 | 8 | 2 | 2 | |
| 9 | 6 | 10 | 5 | 10 | 9 | 8 | |
| Availability | 3 | 3 | 6 | 2 | 1 | 2 |
Discuss whether the solution is degenerate or non-degenerate.
Solution
Transportation problem. A product available at origins (amounts ) must be sent to destinations (requirements ); the unit cost on route is . Find the shipments that meet all requirements at minimum total cost.
As a linear programming problem. The objective and the constraints are linear in the variables , so this is an LPP with equality constraints whose coefficient matrix has only 0s and 1s (each appears in exactly one supply row and one demand row).
Necessary and sufficient condition for a feasible solution: Necessary: adding all supply equations gives , and adding all demand equations gives the same double sum . Sufficient: if the totals are equal to , then satisfies and . So a feasible solution exists (and since the cost is bounded below by 0, an optimal one exists too).
The data. The ports (columns) are the origins, with availabilities 3, 3, 6, 2, 1, 2 (total 17); the destinations (rows) have requirements 3, 4, 2, 8 (total 17). The problem is balanced. Writing ports as rows and destinations as columns :
Vogel’s approximation method.
| Step | Row penalties | Column penalties | Largest penalty | Allocation |
|---|---|---|---|---|
| 1 | S1: 3, S2: 3, S3: 4, S4: 1, S5: 1, S6: 3 | T1: 0, T2: 0, T3: 0, T4: 1 | 4 (S3) | 2 to (S3, T3) at cost 3 |
| 2 | S1: 0, S2: 3, S3: 3, S4: 2, S5: 1, S6: 4 | T1: 0, T2: 0, T4: 1 | 4 (S6) | 2 to (S6, T1) at cost 5 |
| 3 | S1: 0, S2: 3, S3: 3, S4: 2, S5: 1 | T1: 0, T2: 0, T4: 1 | 3 (S2) | 1 to (S2, T1) at cost 3 |
| 4 | S1: 4, S2: 0, S3: 2, S4: 0, S5: 3 | T2: 0, T4: 1 | 4 (S1) | 3 to (S1, T2) at cost 5 |
| 5 | S2: 0, S3: 2, S4: 0, S5: 3 | T2: 1, T4: 1 | 3 (S5) | 1 to (S5, T2) at cost 7 |
| 6 | S2: 0, S3: 2, S4: 0 | T2: 1, T4: 1 | 2 (S3) | 4 to (S3, T4) at cost 10 |
| 7 | S2: 0, S4: 0 | T2: 1, T4: 1 | 1 (T4) | 2 to (S4, T4) at cost 5 |
| — | — | — | forced | 2 to (S2, T4) at cost 6 |
First feasible solution (VAM).
| T1 | T2 | T3 | T4 | Supply | |
|---|---|---|---|---|---|
| S1 | (5) | 3 (5) | ε (2) | (9) | 3 |
| S2 | 1 (3) | (6) | (8) | 2 (6) | 3 |
| S3 | (7) | (12) | 2 (3) | 4 (10) | 6 |
| S4 | (3) | (5) | (4) | 2 (5) | 2 |
| S5 | (8) | 1 (7) | (8) | (10) | 1 |
| S6 | 2 (5) | (11) | (2) | (9) | 2 |
| Demand | 3 | 4 | 2 | 8 |
Cost .
Degenerate or not? A basic feasible solution of this problem needs occupied cells. VAM gives only 8 positive allocations, so the solution is degenerate. (It happened because, in one step, a row and a column were satisfied at the same time.) To continue with the MODI method we place an infinitesimal in an independent empty cell (shown above as ε) so that there are 9 occupied cells.
Check of optimality (MODI).
Iteration 1. Total cost = 103. For the occupied cells, (; ; ; ; ; ; ; ; ); taking in the row with most allocations gives the and shown. For each empty cell, .
| T1 | T2 | T3 | T4 | Supply | ||
|---|---|---|---|---|---|---|
| S1 | (5) Δ=−1 | 3 (5) | ε (2) | (9) Δ=0 | 3 | 0 |
| S2 | 1 (3) | (6) Δ=4 | (8) Δ=9 | 2 (6) | 3 | −3 |
| S3 | (7) Δ=0 | (12) Δ=6 | 2 (3) | 4 (10) | 6 | 1 |
| S4 | (3) Δ=1 | (5) Δ=4 | (4) Δ=6 | 2 (5) | 2 | −4 |
| S5 | (8) Δ=0 | 1 (7) | (8) Δ=4 | (10) Δ=−1 | 1 | 2 |
| S6 | 2 (5) | (11) Δ=7 | (2) Δ=1 | (9) Δ=1 | 2 | −1 |
| Demand | 3 | 4 | 2 | 8 | ||
| 6 | 5 | 2 | 9 |
The most negative is −1 at (S1, T1); it enters. Loop: (S1, T1) → (S1, T3) → (S3, T3) → (S3, T4) → (S2, T4) → (S2, T1) → (S1, T1), with signs (S1, T1)+, (S1, T3)−, (S3, T3)+, (S3, T4)−, (S2, T4)+, (S2, T1)−. smallest allocation in a “−” cell . Cost falls by .
Iteration 2. Total cost = 103. For the occupied cells, (; ; ; ; ; ; ; ; ); taking in the row with most allocations gives the and shown. For each empty cell, .
| T1 | T2 | T3 | T4 | Supply | ||
|---|---|---|---|---|---|---|
| S1 | ε (5) | 3 (5) | (2) Δ=1 | (9) Δ=1 | 3 | 0 |
| S2 | 1 (3) | (6) Δ=3 | (8) Δ=9 | 2 (6) | 3 | −2 |
| S3 | (7) Δ=0 | (12) Δ=5 | 2 (3) | 4 (10) | 6 | 2 |
| S4 | (3) Δ=1 | (5) Δ=3 | (4) Δ=6 | 2 (5) | 2 | −3 |
| S5 | (8) Δ=1 | 1 (7) | (8) Δ=5 | (10) Δ=0 | 1 | 2 |
| S6 | 2 (5) | (11) Δ=6 | (2) Δ=1 | (9) Δ=1 | 2 | 0 |
| Demand | 3 | 4 | 2 | 8 | ||
| 5 | 5 | 1 | 8 |
All , so this solution is optimal. (Some : (S3, T1), (S5, T4), so alternative optimal solutions exist.)
So this first feasible solution is in fact optimal, with minimum cost 103.
✓ Checked by computer We checked in Python (scipy linprog): the minimum cost is 103, equal to the VAM starting cost; the VAM steps and the MODI test below were computed with exact arithmetic.
Find a necessary and sufficient condition for the existence of a feasible solution to a Transportation Problem (T.P.). Find the solution of the T.P. with following cost matrix:
| Origin \ Destination | Availability | ||||||
| 2 | 1 | 3 | 3 | 2 | 5 | 50 | |
| 3 | 2 | 2 | 4 | 3 | 4 | 40 | |
| 3 | 5 | 4 | 2 | 4 | 1 | 60 | |
| 4 | 2 | 2 | 1 | 2 | 2 | 30 | |
| Demand | 30 | 50 | 20 | 40 | 30 | 10 |
Solution
Condition for a feasible solution. A transportation problem with availabilities and requirements has a feasible solution if and only if .
- Necessity: summing the supply equations gives ; summing the demand equations gives . Hence the totals must be equal.
- Sufficiency: if , put . Then , and : a feasible solution.
The problem. Availability = demand : balanced.
Initial solution (Vogel’s method).
| Step | Row penalties | Column penalties | Largest penalty | Allocation |
|---|---|---|---|---|
| 1 | O1: 1, O2: 0, O3: 1, O4: 1 | D1: 1, D2: 1, D3: 0, D4: 1, D5: 0, D6: 1 | 1 (O1) | 50 to (O1, D2) at cost 1 |
| 2 | O2: 0, O3: 1, O4: 1 | D1: 0, D2: 0, D3: 0, D4: 1, D5: 1, D6: 1 | 1 (O4) | 30 to (O4, D4) at cost 1 |
| 3 | O2: 0, O3: 1 | D1: 0, D2: 3, D3: 2, D4: 2, D5: 1, D6: 3 | 3 (D6) | 10 to (O3, D6) at cost 1 |
| 4 | O2: 0, O3: 1 | D1: 0, D2: 3, D3: 2, D4: 2, D5: 1 | 3 (D2) | ε (a zero allocation) to (O2, D2): the row and column were satisfied together |
| 5 | O2: 1, O3: 1 | D1: 0, D3: 2, D4: 2, D5: 1 | 2 (D3) | 20 to (O2, D3) at cost 2 |
| 6 | O2: 0, O3: 1 | D1: 0, D4: 2, D5: 1 | 2 (D4) | 10 to (O3, D4) at cost 2 |
| 7 | O2: 0, O3: 1 | D1: 0, D5: 1 | 1 (O3) | 30 to (O3, D1) at cost 3 |
| — | — | — | forced | 20 to (O2, D5) at cost 3 |
| — | — | — | forced | 10 to (O3, D5) at cost 4 |
| D1 | D2 | D3 | D4 | D5 | D6 | Supply | |
|---|---|---|---|---|---|---|---|
| O1 | (2) | 50 (1) | (3) | (3) | (2) | (5) | 50 |
| O2 | (3) | ε (2) | 20 (2) | (4) | 20 (3) | (4) | 40 |
| O3 | 30 (3) | (5) | (4) | 10 (2) | 10 (4) | 10 (1) | 60 |
| O4 | (4) | (2) | (2) | 30 (1) | (2) | (2) | 30 |
| Demand | 30 | 50 | 20 | 40 | 30 | 10 |
VAM gives fewer than positive allocations (a row and a column were satisfied together), so the starting solution is degenerate; an cell is kept. Initial cost = 340.
MODI method.
Iteration 1. Total cost = 340. For the occupied cells, (; ; ; ; ; ; ; ; ); taking in the row with most allocations gives the and shown. For each empty cell, .
| D1 | D2 | D3 | D4 | D5 | D6 | Supply | ||
|---|---|---|---|---|---|---|---|---|
| O1 | (2) Δ=1 | 50 (1) | (3) Δ=2 | (3) Δ=3 | (2) Δ=0 | (5) Δ=6 | 50 | −2 |
| O2 | (3) Δ=1 | ε (2) | 20 (2) | (4) Δ=3 | 20 (3) | (4) Δ=4 | 40 | −1 |
| O3 | 30 (3) | (5) Δ=2 | (4) Δ=1 | 10 (2) | 10 (4) | 10 (1) | 60 | 0 |
| O4 | (4) Δ=2 | (2) Δ=0 | (2) Δ=0 | 30 (1) | (2) Δ=−1 | (2) Δ=2 | 30 | −1 |
| Demand | 30 | 50 | 20 | 40 | 30 | 10 | ||
| 3 | 3 | 3 | 2 | 4 | 1 |
The most negative is −1 at (O4, D5); it enters. Loop: (O4, D5) → (O4, D4) → (O3, D4) → (O3, D5) → (O4, D5), with signs (O4, D5)+, (O4, D4)−, (O3, D4)+, (O3, D5)−. smallest allocation in a “−” cell . Cost falls by .
Iteration 2. Total cost = 330. For the occupied cells, (; ; ; ; ; ; ; ; ); taking in the row with most allocations gives the and shown. For each empty cell, .
| D1 | D2 | D3 | D4 | D5 | D6 | Supply | ||
|---|---|---|---|---|---|---|---|---|
| O1 | (2) Δ=0 | 50 (1) | (3) Δ=2 | (3) Δ=2 | (2) Δ=0 | (5) Δ=5 | 50 | −1 |
| O2 | (3) Δ=0 | ε (2) | 20 (2) | (4) Δ=2 | 20 (3) | (4) Δ=3 | 40 | 0 |
| O3 | 30 (3) | (5) Δ=3 | (4) Δ=2 | 20 (2) | (4) Δ=1 | 10 (1) | 60 | 0 |
| O4 | (4) Δ=2 | (2) Δ=1 | (2) Δ=1 | 20 (1) | 10 (2) | (2) Δ=2 | 30 | −1 |
| Demand | 30 | 50 | 20 | 40 | 30 | 10 | ||
| 3 | 2 | 2 | 2 | 3 | 1 |
All , so this solution is optimal. (Some : (O1, D1), (O1, D5), (O2, D1), so alternative optimal solutions exist.)
Optimal solution.
| Route | Units | Cost |
|---|---|---|
| 50 | 50 | |
| 20 | 40 | |
| 20 | 60 | |
| 30 | 90 | |
| 20 | 40 | |
| 10 | 10 | |
| 20 | 20 | |
| 10 | 20 | |
| Minimum cost | 330 |
✓ Checked by computer We checked in Python (scipy linprog): the minimum cost is 330; the VAM start (340) and the MODI iterations below were computed with exact arithmetic.
State and prove a necessary and sufficient condition for the existence of a solution to a transportation problem.
Solution
Transportation problem. Minimise subject to where are the availabilities and the requirements.
Theorem. The transportation problem has a feasible solution if and only if
Proof of necessity. Suppose is feasible. Summing the supply constraints over , Summing the demand constraints over , The left-hand sides are the same double sum, so .
Proof of sufficiency. Suppose (). Define
- , since .
- .
- .
So satisfies all the constraints: a feasible solution exists. ∎
Remarks.
- Moreover for every feasible solution, so the feasible set is bounded, and the objective (with ) is bounded below; hence an optimal solution always exists for a balanced problem.
- If the totals differ, the problem is made balanced by adding a dummy source or destination with zero costs.
✓ Proof checked step by step Every step was checked: summing the supply and the demand equations gives necessity; the solution x_ij = a_i b_j / T proves sufficiency.
There are five jobs to be assigned one each to five machines and the associated cost matrix is as follows:
| Machine \ Job | 1 | 2 | 3 | 4 | 5 |
| A | 25 | 29 | 31 | 42 | 37 |
| B | 22 | 19 | 35 | 18 | 26 |
| C | 39 | 38 | 26 | 20 | 33 |
| D | 34 | 27 | 28 | 40 | 32 |
| E | 24 | 42 | 36 | 23 | 45 |
Solve the problem assuming that the objective is to minimize the total cost.
Solution
Hungarian method (5 machines, 5 jobs; minimise cost).
Step 1 (row reduction). Subtract the smallest element of each row (A: 25, B: 18, C: 20, D: 27, E: 23) from every element of that row:
| 1 | 2 | 3 | 4 | 5 | |
|---|---|---|---|---|---|
| A | 0 | 4 | 6 | 17 | 12 |
| B | 4 | 1 | 17 | 0 | 8 |
| C | 19 | 18 | 6 | 0 | 13 |
| D | 7 | 0 | 1 | 13 | 5 |
| E | 1 | 19 | 13 | 0 | 22 |
Step 2 (column reduction). Subtract the smallest element of each column (1: 0, 2: 0, 3: 1, 4: 0, 5: 5):
| 1 | 2 | 3 | 4 | 5 | |
|---|---|---|---|---|---|
| A | 0 | 4 | 5 | 17 | 7 |
| B | 4 | 1 | 16 | 0 | 3 |
| C | 19 | 18 | 5 | 0 | 8 |
| D | 7 | 0 | 0 | 13 | 0 |
| E | 1 | 19 | 12 | 0 | 17 |
Step 3 (test). All zeros can be covered by only 3 lines (row A, row D, column 4) < , so we cannot yet assign.
Step 4 (revise). The smallest uncovered element is 1. Subtract it from every uncovered element and add it to the elements at the intersections of two lines:
| 1 | 2 | 3 | 4 | 5 | |
|---|---|---|---|---|---|
| A | 0 | 4 | 5 | 18 | 7 |
| B | 3 | 0 | 15 | 0 | 2 |
| C | 18 | 17 | 4 | 0 | 7 |
| D | 7 | 0 | 0 | 14 | 0 |
| E | 0 | 18 | 11 | 0 | 16 |
Step 5 (test). All zeros can be covered by only 4 lines (row B, row D, column 1, column 4) < , so we cannot yet assign.
Step 6 (revise). The smallest uncovered element is 4. Subtract it from every uncovered element and add it to the elements at the intersections of two lines:
| 1 | 2 | 3 | 4 | 5 | |
|---|---|---|---|---|---|
| A | 0 | 0 | 1 | 18 | 3 |
| B | 7 | 0 | 15 | 4 | 2 |
| C | 18 | 13 | 0 | 0 | 3 |
| D | 11 | 0 | 0 | 18 | 0 |
| E | 0 | 14 | 7 | 0 | 12 |
Step 7 (test). The minimum number of lines covering all zeros is 5 = , so an optimal assignment can be made among the zeros.
Assignment.
| 1 | 2 | 3 | 4 | 5 | |
|---|---|---|---|---|---|
| A | [0] | 0 | 1 | 18 | 3 |
| B | 7 | [0] | 15 | 4 | 2 |
| C | 18 | 13 | [0] | 0 | 3 |
| D | 11 | 0 | 0 | 18 | [0] |
| E | 0 | 14 | 7 | [0] | 12 |
| Machine | Job | Cost |
|---|---|---|
| 1 | 25 | |
| 2 | 19 | |
| 3 | 26 | |
| 5 | 32 | |
| 4 | 23 | |
| Total | 125 |
Answer. –1, –2, –3, –5, –4; minimum total cost 125.
✓ Checked by computer We checked in Python (scipy linear_sum_assignment and all 120 assignments): the minimum cost is 125 and the optimal assignment is unique.
What do you understand by an assignment problem? Mentioning the different steps of solving an assignment problem, find the solution of the following assignment problem:
| Employees \ Tasks | |||||
| 25 | 55 | 60 | 45 | 30 | |
| 45 | 65 | 55 | 35 | 40 | |
| 10 | 35 | 45 | 55 | 65 | |
| 40 | 30 | 70 | 40 | 60 | |
| 55 | 45 | 40 | 55 | 10 |
Solution
Assignment problem. Given employees and tasks and the cost (or time) of employee doing task , assign each employee to exactly one task and each task to exactly one employee so that the total cost is minimum. It is an LPP (and a special transportation problem) with , , .
Steps of the Hungarian method.
- Make the matrix square (add dummy rows/columns of zeros if needed). For maximisation, subtract every element from the largest.
- Row reduction: subtract the smallest element of each row from that row.
- Column reduction: subtract the smallest element of each column from that column.
- Cover the zeros with the minimum number of horizontal and vertical lines. If this number equals , go to step 6.
- Revise: find the smallest uncovered element ; subtract it from all uncovered elements and add it to the elements at the intersections of two lines; go to step 4.
- Assign: choose a row (or column) with a single zero, assign there and cross out the other zeros in its column (row); repeat until assignments are made.
Solution.
Step 1 (row reduction). Subtract the smallest element of each row (E1: 25, E2: 35, E3: 10, E4: 30, E5: 10) from every element of that row:
| T1 | T2 | T3 | T4 | T5 | |
|---|---|---|---|---|---|
| E1 | 0 | 30 | 35 | 20 | 5 |
| E2 | 10 | 30 | 20 | 0 | 5 |
| E3 | 0 | 25 | 35 | 45 | 55 |
| E4 | 10 | 0 | 40 | 10 | 30 |
| E5 | 45 | 35 | 30 | 45 | 0 |
Step 2 (column reduction). Subtract the smallest element of each column (T1: 0, T2: 0, T3: 20, T4: 0, T5: 0):
| T1 | T2 | T3 | T4 | T5 | |
|---|---|---|---|---|---|
| E1 | 0 | 30 | 15 | 20 | 5 |
| E2 | 10 | 30 | 0 | 0 | 5 |
| E3 | 0 | 25 | 15 | 45 | 55 |
| E4 | 10 | 0 | 20 | 10 | 30 |
| E5 | 45 | 35 | 10 | 45 | 0 |
Step 3 (test). All zeros can be covered by only 4 lines (row E2, row E4, row E5, column T1) < , so we cannot yet assign.
Step 4 (revise). The smallest uncovered element is 5. Subtract it from every uncovered element and add it to the elements at the intersections of two lines:
| T1 | T2 | T3 | T4 | T5 | |
|---|---|---|---|---|---|
| E1 | 0 | 25 | 10 | 15 | 0 |
| E2 | 15 | 30 | 0 | 0 | 5 |
| E3 | 0 | 20 | 10 | 40 | 50 |
| E4 | 15 | 0 | 20 | 10 | 30 |
| E5 | 50 | 35 | 10 | 45 | 0 |
Step 5 (test). All zeros can be covered by only 4 lines (row E2, row E4, column T1, column T5) < , so we cannot yet assign.
Step 6 (revise). The smallest uncovered element is 10. Subtract it from every uncovered element and add it to the elements at the intersections of two lines:
| T1 | T2 | T3 | T4 | T5 | |
|---|---|---|---|---|---|
| E1 | 0 | 15 | 0 | 5 | 0 |
| E2 | 25 | 30 | 0 | 0 | 15 |
| E3 | 0 | 10 | 0 | 30 | 50 |
| E4 | 25 | 0 | 20 | 10 | 40 |
| E5 | 50 | 25 | 0 | 35 | 0 |
Step 7 (test). The minimum number of lines covering all zeros is 5 = , so an optimal assignment can be made among the zeros.
Assignment.
| T1 | T2 | T3 | T4 | T5 | |
|---|---|---|---|---|---|
| E1 | 0 | 15 | 0 | 5 | [0] |
| E2 | 25 | 30 | 0 | [0] | 15 |
| E3 | [0] | 10 | 0 | 30 | 50 |
| E4 | 25 | [0] | 20 | 10 | 40 |
| E5 | 50 | 25 | [0] | 35 | 0 |
| Employee | Task | Cost |
|---|---|---|
| 30 | ||
| 35 | ||
| 10 | ||
| 30 | ||
| 40 | ||
| Total | 145 |
Minimum total cost = 145. The final matrix has extra zeros, so there are alternative optimal assignments with the same cost:
- –, –, –, –, – (25 + 35 + 45 + 30 + 10 = 145);
- –, –, –, –, – (60 + 35 + 10 + 30 + 10 = 145).
✓ Checked by computer We checked in Python (scipy linear_sum_assignment and all 120 assignments): the minimum is 145, attained by three different assignments, all listed below.
A cement factory manager is considering the least way to transport cement from his three factories , and to depots , , and . The weekly production and demands along with transportation costs are given below. What should be the distribution programme?
| Factory | Depot | Depot | Depot | Depot | Production |
| 10 | 8 | 7 | 12 | 500 | |
| 12 | 15 | 6 | 10 | 500 | |
| 8 | 10 | 12 | 14 | 900 | |
| demand | 700 | 550 | 450 | 300 |
Solution
Balancing. Production ; demand . Add a dummy factory with production 100 and zero costs; whatever it “sends” is demand that will not be met.
Initial solution (Vogel’s method).
| Step | Row penalties | Column penalties | Largest penalty | Allocation |
|---|---|---|---|---|
| 1 | A: 1, B: 4, C: 2, Dummy: 0 | P: 8, Q: 8, R: 6, S: 10 | 10 (S) | 100 to (Dummy, S) at cost 0 |
| 2 | A: 1, B: 4, C: 2 | P: 2, Q: 2, R: 1, S: 2 | 4 (B) | 450 to (B, R) at cost 6 |
| 3 | A: 2, B: 2, C: 2 | P: 2, Q: 2, S: 2 | 2 (C) | 700 to (C, P) at cost 8 |
| 4 | A: 4, B: 5, C: 4 | Q: 2, S: 2 | 5 (B) | 50 to (B, S) at cost 10 |
| 5 | A: 4, C: 4 | Q: 2, S: 2 | 4 (A) | 500 to (A, Q) at cost 8 |
| — | — | — | forced | 50 to (C, Q) at cost 10 |
| — | — | — | forced | 150 to (C, S) at cost 14 |
| P | Q | R | S | Supply | |
|---|---|---|---|---|---|
| A | (10) | 500 (8) | (7) | (12) | 500 |
| B | (12) | (15) | 450 (6) | 50 (10) | 500 |
| C | 700 (8) | 50 (10) | (12) | 150 (14) | 900 |
| Dummy | (0) | (0) | (0) | 100 (0) | 100 |
| Demand | 700 | 550 | 450 | 300 |
occupied cells. Initial cost = 15,400.
MODI method.
Iteration 1. Total cost = 15400. For the occupied cells, (; ; ; ; ; ; ); taking in the row with most allocations gives the and shown. For each empty cell, .
| P | Q | R | S | Supply | ||
|---|---|---|---|---|---|---|
| A | (10) Δ=4 | 500 (8) | (7) Δ=−1 | (12) Δ=0 | 500 | −2 |
| B | (12) Δ=8 | (15) Δ=9 | 450 (6) | 50 (10) | 500 | −4 |
| C | 700 (8) | 50 (10) | (12) Δ=2 | 150 (14) | 900 | 0 |
| Dummy | (0) Δ=6 | (0) Δ=4 | (0) Δ=4 | 100 (0) | 100 | −14 |
| Demand | 700 | 550 | 450 | 300 | ||
| 8 | 10 | 10 | 14 |
The most negative is −1 at (A, R); it enters. Loop: (A, R) → (A, Q) → (C, Q) → (C, S) → (B, S) → (B, R) → (A, R), with signs (A, R)+, (A, Q)−, (C, Q)+, (C, S)−, (B, S)+, (B, R)−. smallest allocation in a “−” cell . Cost falls by .
Iteration 2. Total cost = 15250. For the occupied cells, (; ; ; ; ; ; ); taking in the row with most allocations gives the and shown. For each empty cell, .
| P | Q | R | S | Supply | ||
|---|---|---|---|---|---|---|
| A | (10) Δ=4 | 350 (8) | 150 (7) | (12) Δ=1 | 500 | 0 |
| B | (12) Δ=7 | (15) Δ=8 | 300 (6) | 200 (10) | 500 | −1 |
| C | 700 (8) | 200 (10) | (12) Δ=3 | (14) Δ=1 | 900 | 2 |
| Dummy | (0) Δ=5 | (0) Δ=3 | (0) Δ=4 | 100 (0) | 100 | −11 |
| Demand | 700 | 550 | 450 | 300 | ||
| 6 | 8 | 7 | 11 |
All , so this solution is optimal.
Distribution programme.
| Route | Units | Cost |
|---|---|---|
| 350 | 2,800 | |
| 150 | 1,050 | |
| 300 | 1,800 | |
| 200 | 2,000 | |
| 700 | 5,600 | |
| 200 | 2,000 | |
| Minimum cost | 15,250 |
Depot receives only 200 of its 300 units: the shortfall of 100 falls on (the dummy row).
✓ Checked by computer We checked in Python (scipy linprog with a dummy factory): the minimum cost is 15,250; the VAM start (15,400) and the MODI iterations below were computed with exact arithmetic.
What is Assignment Problem? With usual notation give its mathematical formulation. Compare this with Mathematical form of Transportation Model.
Solution
Assignment problem. There are facilities (persons, machines) and jobs. Facility doing job costs (or takes time ). Each facility must do exactly one job and each job must be done by exactly one facility. The problem is to find the assignment that minimises the total cost (or maximises the total profit).
Mathematical formulation. Let subject to
Transportation model (for comparison).
Comparison.
| Transportation problem | Assignment problem | |
|---|---|---|
| Size | (need not be square) | (square) |
| Supplies / demands | any , | all equal to 1 |
| Variables | , any amount | |
| Balance condition | automatically | |
| Basic cells | , of which only are positive (highly degenerate) | |
| Usual method | VAM/NWC start, then MODI (stepping stone) | Hungarian method |
So the assignment problem is the special case of the transportation problem with and all . Because the transportation constraint matrix is totally unimodular, the LP relaxation with has an integer (0–1) optimal solution, so the restriction can be replaced by .
✓ Answer checked step by step Every point was checked against the standard formulations of the assignment and transportation problems and the usual points of comparison.
The following table shows all the necessary information on the available supply to each warehouse, the requirements for each market and the unit transportation cost from each warehouse to each market:
| Warehouse \ Market | I | II | III | IV | Supply |
| A | 5 | 2 | 4 | 3 | 22 |
| B | 4 | 8 | 1 | 6 | 15 |
| C | 4 | 6 | 7 | 5 | 8 |
| Requirement | 7 | 12 | 17 | 9 |
The shipping clerk has worked out the following schedule from experience: 12 units from to II; 1 unit from to III; 9 units from to IV; 15 units from to III; 1 unit from to III; 7 units from to I. (i) Check and verify if the clerk has the optimal schedule. (ii) Find the optimal schedule and the minimum total shipping cost.
Solution
Supply = requirement : balanced.
(i) The clerk’s schedule.
| I | II | III | IV | Supply | |
|---|---|---|---|---|---|
| A | (5) | 12 (2) | 1 (4) | 9 (3) | 22 |
| B | (4) | (8) | 15 (1) | (6) | 15 |
| C | 7 (4) | (6) | 1 (7) | (5) | 8 |
| Demand | 7 | 12 | 17 | 9 |
Cost . It has 6 occupied cells , and they form no loop, so it is a basic feasible solution. We test it by the MODI method.
Iteration 1. Total cost = 105. For the occupied cells, (; ; ; ; ; ); taking in the row with most allocations gives the and shown. For each empty cell, .
| I | II | III | IV | Supply | ||
|---|---|---|---|---|---|---|
| A | (5) Δ=4 | 12 (2) | 1 (4) | 9 (3) | 22 | 0 |
| B | (4) Δ=6 | (8) Δ=9 | 15 (1) | (6) Δ=6 | 15 | −3 |
| C | 7 (4) | (6) Δ=1 | 1 (7) | (5) Δ=−1 | 8 | 3 |
| Demand | 7 | 12 | 17 | 9 | ||
| 1 | 2 | 4 | 3 |
The most negative is −1 at (C, IV); it enters. Loop: (C, IV) → (C, III) → (A, III) → (A, IV) → (C, IV), with signs (C, IV)+, (C, III)−, (A, III)+, (A, IV)−. smallest allocation in a “−” cell . Cost falls by .
Iteration 2. Total cost = 104. For the occupied cells, (; ; ; ; ; ); taking in the row with most allocations gives the and shown. For each empty cell, .
| I | II | III | IV | Supply | ||
|---|---|---|---|---|---|---|
| A | (5) Δ=3 | 12 (2) | 2 (4) | 8 (3) | 22 | 0 |
| B | (4) Δ=5 | (8) Δ=9 | 15 (1) | (6) Δ=6 | 15 | −3 |
| C | 7 (4) | (6) Δ=2 | (7) Δ=1 | 1 (5) | 8 | 2 |
| Demand | 7 | 12 | 17 | 9 | ||
| 2 | 2 | 4 | 3 |
All , so this solution is optimal.
In Iteration 1 the cell (C, IV) has , so the clerk’s schedule is not optimal: moving 1 unit around the loop saves ₹1.
(ii) Optimal schedule. After one improvement:
| Route | Units | Cost |
|---|---|---|
| A → II | 12 | 24 |
| A → III | 2 | 8 |
| A → IV | 8 | 24 |
| B → III | 15 | 15 |
| C → I | 7 | 28 |
| C → IV | 1 | 5 |
| Minimum total cost | 104 |
✓ Checked by computer We checked in Python (scipy linprog): the minimum cost is 104; the clerk’s schedule costs 105. The MODI test below (exact arithmetic) shows Δ = −1 at (C, IV).
Explain assignment problem and transportation problem. Give its mathematical formulation.
Solution
Transportation problem. A single commodity is available at sources in amounts and is required at destinations in amounts . The cost of sending one unit from source to destination is . We must decide how many units to send on each route so as to satisfy all requirements within the availabilities at minimum total cost.
Formulation: with (balanced; otherwise a dummy source or destination is added). It is solved by finding an initial basic feasible solution (north-west corner, least cost or Vogel’s method) with occupied cells and improving it by the stepping-stone or MODI method.
Assignment problem. jobs are to be assigned to persons (machines), one to one, where is the cost (or time) when person does job . We must find the assignment with minimum total cost.
Formulation: with if person does job and 0 otherwise, It is a special case of the transportation problem (, all ), and is solved by the Hungarian method. Maximisation problems are converted by subtracting all elements from the largest; unbalanced problems are made square with dummy rows or columns of zeros; impossible assignments get a very large cost .
Examples: transportation — shipping cement from factories to depots; assignment — allotting jobs to machines, salesmen to territories, crews to flights.
✓ Answer checked step by step Every point was checked against the standard definitions and LP formulations of the transportation and assignment problems.
A firm manufacturing a single product has three plants , and . The three plants have produced 60, 35 and 40 units respectively during this month. The firm had made commitment to sell 22 units to customer , 45 units to customer , 20 units to customer , 18 units to customer and 30 units to customer . Determine the minimum possible transportation cost of shifting the manufactured products to the five customers. The net per unit cost of transporting from the three plants to five customers is given below:
| Plant \ Customer | A | B | C | D | E |
| X | 4 | 1 | 3 | 4 | 4 |
| Y | 2 | 3 | 2 | 2 | 3 |
| Z | 3 | 5 | 2 | 4 | 4 |
Solution
Balance. Production = commitments .
Initial solution (Vogel’s method).
| Step | Row penalties | Column penalties | Largest penalty | Allocation |
|---|---|---|---|---|
| 1 | X: 2, Y: 0, Z: 1 | A: 1, B: 2, C: 0, D: 2, E: 1 | 2 (X) | 45 to (X, B) at cost 1 |
| 2 | X: 1, Y: 0, Z: 1 | A: 1, C: 0, D: 2, E: 1 | 2 (D) | 18 to (Y, D) at cost 2 |
| 3 | X: 1, Y: 0, Z: 1 | A: 1, C: 0, E: 1 | 1 (Z) | 20 to (Z, C) at cost 2 |
| 4 | X: 0, Y: 1, Z: 1 | A: 1, E: 1 | 1 (Y) | 17 to (Y, A) at cost 2 |
| 5 | X: 0, Z: 1 | A: 1, E: 0 | 1 (Z) | 5 to (Z, A) at cost 3 |
| — | — | — | forced | 15 to (X, E) at cost 4 |
| — | — | — | forced | 15 to (Z, E) at cost 4 |
| A | B | C | D | E | Supply | |
|---|---|---|---|---|---|---|
| X | (4) | 45 (1) | (3) | (4) | 15 (4) | 60 |
| Y | 17 (2) | (3) | (2) | 18 (2) | (3) | 35 |
| Z | 5 (3) | (5) | 20 (2) | (4) | 15 (4) | 40 |
| Demand | 22 | 45 | 20 | 18 | 30 |
7 occupied cells . Cost = 290.
MODI test.
Iteration 1. Total cost = 290. For the occupied cells, (; ; ; ; ; ; ); taking in the row with most allocations gives the and shown. For each empty cell, .
| A | B | C | D | E | Supply | ||
|---|---|---|---|---|---|---|---|
| X | (4) Δ=1 | 45 (1) | (3) Δ=1 | (4) Δ=1 | 15 (4) | 60 | 0 |
| Y | 17 (2) | (3) Δ=3 | (2) Δ=1 | 18 (2) | (3) Δ=0 | 35 | −1 |
| Z | 5 (3) | (5) Δ=4 | 20 (2) | (4) Δ=1 | 15 (4) | 40 | 0 |
| Demand | 22 | 45 | 20 | 18 | 30 | ||
| 3 | 1 | 2 | 3 | 4 |
All , so this solution is optimal. (Some : (Y, E), so alternative optimal solutions exist.)
Minimum transportation cost = 290, with the schedule: : 45, : 15, : 17, : 18, : 5, : 20, : 15.
Check: .
✓ Checked by computer We checked in Python (scipy linprog): the minimum cost is 290, equal to the VAM starting cost; the MODI test below confirms it (exact arithmetic).
Show that an assignment problem (A.P.) is the special case of a transportation problem. Describing the steps of the method you use to solve an A.P., find the solution of the following A.P.:
| Job \ Lathe machines | 1 | 2 | 3 | 4 | 5 | 6 |
| A | 6·0 | 7·0 | 6·0 | 9·0 | 10·0 | 12·0 |
| B | 8·0 | 9·0 | 5·0 | 7·0 | 9·5 | 6·0 |
| C | 1·0 | 1·5 | 1·0 | 1·5 | 1·0 | 1·0 |
| D | 4·5 | 4·5 | 4·0 | 6·0 | 5·0 | 3·0 |
| E | 3·0 | 4·0 | 2·0 | 2·5 | 2·0 | 3·0 |
| F | 3·5 | 3·0 | 1·0 | 4·0 | 2·5 | 2·5 |
Solution
Assignment problem as a special transportation problem. The transportation problem is Put and for all . The constraints become With these force , and the transportation problem has integer basic feasible solutions when all , are integers (its constraint matrix is totally unimodular). So every basic solution has : exactly one 1 in each row and each column. This is precisely the assignment problem. Hence an assignment problem is a transportation problem with sources and destinations, each of supply/demand 1. (It is highly degenerate: a BFS has basic cells but only positive ones, which is why the special Hungarian method is preferred.)
Steps of the Hungarian method.
- Check that the matrix is square (else add dummy rows/columns of zeros).
- Subtract the smallest element of each row from all elements of that row.
- Subtract the smallest element of each column from all elements of that column.
- Draw the minimum number of lines through rows and columns to cover all zeros. If it equals , an optimal assignment exists among the zeros: go to step 6.
- Otherwise take the smallest uncovered element; subtract it from every uncovered element, add it at every intersection of two lines, leave the rest unchanged; go to step 4.
- Make the assignment: pick a row (column) with exactly one zero, assign it, cross out the other zeros of its column (row), and repeat.
Solution.
Step 1 (row reduction). Subtract the smallest element of each row (A: 6, B: 5, C: 1, D: 3, E: 2, F: 1) from every element of that row:
| 1 | 2 | 3 | 4 | 5 | 6 | |
|---|---|---|---|---|---|---|
| A | 0 | 1 | 0 | 3 | 4 | 6 |
| B | 3 | 4 | 0 | 2 | 4.5 | 1 |
| C | 0 | 0.5 | 0 | 0.5 | 0 | 0 |
| D | 1.5 | 1.5 | 1 | 3 | 2 | 0 |
| E | 1 | 2 | 0 | 0.5 | 0 | 1 |
| F | 2.5 | 2 | 0 | 3 | 1.5 | 1.5 |
Step 2 (column reduction). Subtract the smallest element of each column (1: 0, 2: 0.5, 3: 0, 4: 0.5, 5: 0, 6: 0):
| 1 | 2 | 3 | 4 | 5 | 6 | |
|---|---|---|---|---|---|---|
| A | 0 | 0.5 | 0 | 2.5 | 4 | 6 |
| B | 3 | 3.5 | 0 | 1.5 | 4.5 | 1 |
| C | 0 | 0 | 0 | 0 | 0 | 0 |
| D | 1.5 | 1 | 1 | 2.5 | 2 | 0 |
| E | 1 | 1.5 | 0 | 0 | 0 | 1 |
| F | 2.5 | 1.5 | 0 | 2.5 | 1.5 | 1.5 |
Step 3 (test). All zeros can be covered by only 5 lines (row A, row C, row D, row E, column 3) < , so we cannot yet assign.
Step 4 (revise). The smallest uncovered element is 1. Subtract it from every uncovered element and add it to the elements at the intersections of two lines:
| 1 | 2 | 3 | 4 | 5 | 6 | |
|---|---|---|---|---|---|---|
| A | 0 | 0.5 | 1 | 2.5 | 4 | 6 |
| B | 2 | 2.5 | 0 | 0.5 | 3.5 | 0 |
| C | 0 | 0 | 1 | 0 | 0 | 0 |
| D | 1.5 | 1 | 2 | 2.5 | 2 | 0 |
| E | 1 | 1.5 | 1 | 0 | 0 | 1 |
| F | 1.5 | 0.5 | 0 | 1.5 | 0.5 | 0.5 |
Step 5 (test). All zeros can be covered by only 5 lines (row A, row C, row E, column 3, column 6) < , so we cannot yet assign.
Step 6 (revise). The smallest uncovered element is 0.5. Subtract it from every uncovered element and add it to the elements at the intersections of two lines:
| 1 | 2 | 3 | 4 | 5 | 6 | |
|---|---|---|---|---|---|---|
| A | 0 | 0.5 | 1.5 | 2.5 | 4 | 6.5 |
| B | 1.5 | 2 | 0 | 0 | 3 | 0 |
| C | 0 | 0 | 1.5 | 0 | 0 | 0.5 |
| D | 1 | 0.5 | 2 | 2 | 1.5 | 0 |
| E | 1 | 1.5 | 1.5 | 0 | 0 | 1.5 |
| F | 1 | 0 | 0 | 1 | 0 | 0.5 |
Step 7 (test). The minimum number of lines covering all zeros is 6 = , so an optimal assignment can be made among the zeros.
Assignment.
| 1 | 2 | 3 | 4 | 5 | 6 | |
|---|---|---|---|---|---|---|
| A | [0] | 0.5 | 1.5 | 2.5 | 4 | 6.5 |
| B | 1.5 | 2 | [0] | 0 | 3 | 0 |
| C | 0 | 0 | 1.5 | [0] | 0 | 0.5 |
| D | 1 | 0.5 | 2 | 2 | 1.5 | [0] |
| E | 1 | 1.5 | 1.5 | 0 | [0] | 1.5 |
| F | 1 | [0] | 0 | 1 | 0 | 0.5 |
| Job | Lathe | Cost |
|---|---|---|
| A | 1 | 6.0 |
| B | 3 | 5.0 |
| C | 4 | 1.5 |
| D | 6 | 3.0 |
| E | 5 | 2.0 |
| F | 2 | 3.0 |
| Total | 20.5 |
Minimum total = 20.5. The extra zeros give alternative optima with the same total, e.g. A–1, B–3, C–2, D–6, E–4, F–5; A–1, B–3, C–5, D–6, E–4, F–2; A–1, B–4, C–2, D–6, E–5, F–3.
✓ Checked by computer We checked in Python (scipy linear_sum_assignment and all 720 assignments): the minimum total is 20.5, with four optimal assignments (listed below).
Explain what you understand by an assignment problem. Solve the following assignment problem for minimizing total time.
| Job | Machine A | Machine B | Machine C | Machine D |
| I | 10 | 14 | 7 | 11 |
| II | 12 | 16 | 10 | 9 |
| III | 14 | 9 | 6 | 10 |
| IV | 11 | 6 | 7 | 5 |
Solution
Assignment problem. We have jobs and machines; job on machine takes time . Each job must go to one machine and each machine take one job, so that the total time is minimum. With if job goes to machine (0 otherwise): minimise subject to , , . It is solved by the Hungarian method.
Solution.
Step 1 (row reduction). Subtract the smallest element of each row (I: 7, II: 9, III: 6, IV: 5) from every element of that row:
| A | B | C | D | |
|---|---|---|---|---|
| I | 3 | 7 | 0 | 4 |
| II | 3 | 7 | 1 | 0 |
| III | 8 | 3 | 0 | 4 |
| IV | 6 | 1 | 2 | 0 |
Step 2 (column reduction). Subtract the smallest element of each column (A: 3, B: 1, C: 0, D: 0):
| A | B | C | D | |
|---|---|---|---|---|
| I | 0 | 6 | 0 | 4 |
| II | 0 | 6 | 1 | 0 |
| III | 5 | 2 | 0 | 4 |
| IV | 3 | 0 | 2 | 0 |
Step 3 (test). The minimum number of lines covering all zeros is 4 = , so an optimal assignment can be made among the zeros.
Assignment.
| A | B | C | D | |
|---|---|---|---|---|
| I | [0] | 6 | 0 | 4 |
| II | 0 | 6 | 1 | [0] |
| III | 5 | 2 | [0] | 4 |
| IV | 3 | [0] | 2 | 0 |
| Job | Machine | Time |
|---|---|---|
| I | A | 10 |
| II | D | 9 |
| III | C | 6 |
| IV | B | 6 |
| Total | 31 |
Minimum total time = 31 (I–A, II–D, III–C, IV–B).
✓ Checked by computer We checked in Python (scipy linear_sum_assignment and all 24 assignments): the minimum total time is 31 and the optimal assignment is unique.
Explain the assignment problem. Show that an assignment problem can be solved by the transportation technique.
Solution
Assignment problem. Assign jobs to facilities, one-to-one, at minimum total cost: Examples: jobs to machines, workers to tasks, salesmen to regions, crews to flights.
It can be solved by the transportation technique.
- It is a transportation problem. Regard the facilities as sources each with supply , and the jobs as destinations each with demand , with unit cost . The transportation constraints , are then exactly the assignment constraints. The problem is balanced ().
- The 0–1 condition takes care of itself. In a transportation problem with integer supplies and demands every basic feasible solution is integer (the constraint matrix is totally unimodular; equivalently, the allocations in NWC/VAM/MODI are always formed by additions and subtractions of the , ). Here each is an integer with , so . Hence the optimal transportation solution is an optimal assignment.
- Degeneracy. A basic feasible solution must have basic cells, but only of them can carry a 1. So every BFS is degenerate, with cells at zero level. To use the MODI (u–v) method we put in independent empty cells, compute , and , and improve as usual.
Illustration. For the costs (supplies and demands 1): the NWC rule gives , then a tie ( and both exhausted), so , and . With : , , ; . Optimal: 1→1, 2→2, cost 3.
Why the Hungarian method is preferred. Because of the heavy degeneracy, the transportation method needs many allocations and may make pivots that do not change the cost. The Hungarian method uses the special structure directly (reducing rows and columns and covering zeros) and is much faster.
✓ Proof checked step by step Every step was checked: the assignment constraints are the transportation constraints with all supplies and demands equal to 1; total unimodularity gives 0–1 basic solutions; and the degeneracy (2n − 1 basic cells, n positive) is handled with ε.
Describe the transportation problem. Explain what is meant by (i) the north-west corner method, and (ii) the least cost method of initializing the solution. What are the subsequent steps in each of these methods?
Solution
Transportation problem. A product is available at origins ( units at origin ) and required at destinations ( units at destination ), with . The unit cost from to is . Find shipments with row sums and column sums that minimise . The solution has two stages: an initial basic feasible solution with occupied cells, and then improvement to optimality.
(i) North-west corner method.
- Start at the north-west (top-left) cell . Allocate .
- Reduce and by this amount. If the supply of row 1 is exhausted, move down to ; if the demand of column 1 is met, move right to ; if both, move diagonally to (and put a zero/ε allocation in an adjacent cell to keep cells).
- Repeat from the new cell until all supplies and demands are exhausted. It is quick and simple but ignores costs, so the solution is usually far from optimal.
(ii) Least cost (matrix minimum) method.
- Find the cell with the smallest unit cost in the whole table (ties broken arbitrarily, or by the larger possible allocation). Allocate as much as possible: .
- Cross out the row or column that is satisfied and adjust the other.
- Repeat with the remaining cells until all supplies and demands are allocated. It takes costs into account and usually gives a much better start than the NWC rule.
Illustration (origins with 30, 50, 20; destinations with 20, 40, 30, 10; costs ):
- NWC: ; cost 310.
- Least cost: ; cost 200.
- The optimum (found below) is 180.
Subsequent steps (same after either method).
- Check that the solution has occupied cells in independent positions; if fewer (degeneracy), add to suitable empty cells.
- Optimality test (MODI / u–v method): find with for every occupied cell (setting one ); compute for every empty cell. (The stepping-stone method finds the same by tracing a closed path for each empty cell.)
- If all , the solution is optimal ( shows an alternative optimum).
- Otherwise, the cell with the most negative enters. Draw the closed loop through it and occupied cells, with alternate and signs starting with at the entering cell. Let be the smallest allocation in a cell; add to the cells and subtract it from the cells. The cost falls by .
- Repeat steps 2–4 until optimal.
✓ Checked by computer Every step was checked; the illustration (data of the 2020 MODI question) was recomputed: north-west corner cost 310, least cost 200, optimum 180.
Apply Vogel approximation method for solving the transportation problem with 3 sources and 4 destinations with the following table of unit transportation costs:
| Source \ Destination | 1 | 2 | 3 | 4 | Supply |
| 1 | 10 | 2 | 20 | 11 | 15 |
| 2 | 12 | 7 | 9 | 20 | 25 |
| 3 | 4 | 14 | 16 | 18 | 10 |
| Demand | 5 | 15 | 15 | 15 |
Solution
Supply = demand : balanced.
Vogel’s approximation method. Penalty = difference between the two lowest costs in each row and column.
| Step | Row penalties | Column penalties | Largest penalty | Allocation |
|---|---|---|---|---|
| 1 | S1: 8, S2: 2, S3: 10 | 1: 6, 2: 5, 3: 7, 4: 7 | 10 (S3) | 5 to (S3, 1) at cost 4 |
| 2 | S1: 9, S2: 2, S3: 2 | 2: 5, 3: 7, 4: 7 | 9 (S1) | 15 to (S1, 2) at cost 2 |
| 3 | S2: 2, S3: 2 | 2: 7, 3: 7, 4: 2 | 7 (2) | ε (a zero allocation) to (S2, 2): the row and column were satisfied together |
| 4 | S2: 11, S3: 2 | 3: 7, 4: 2 | 11 (S2) | 15 to (S2, 3) at cost 9 |
| — | — | — | forced | 10 to (S2, 4) at cost 20 |
| — | — | — | forced | 5 to (S3, 4) at cost 18 |
Initial basic feasible solution (VAM).
| 1 | 2 | 3 | 4 | Supply | |
|---|---|---|---|---|---|
| S1 | (10) | 15 (2) | (20) | (11) | 15 |
| S2 | (12) | ε (7) | 15 (9) | 10 (20) | 25 |
| S3 | 5 (4) | (14) | (16) | 5 (18) | 10 |
| Demand | 5 | 15 | 15 | 15 |
| Route | Units | Cost |
|---|---|---|
| 1 → 2 | 15 | 30 |
| 2 → 3 | 15 | 135 |
| 2 → 4 | 10 | 200 |
| 3 → 1 | 5 | 20 |
| 3 → 4 | 5 | 90 |
| Total | 475 |
There are only 5 positive allocations, one fewer than , because row 1 and column 2 were exhausted together; the solution is degenerate, and a zero allocation () is kept in cell (2, 2) to make 6 occupied cells.
(The MODI method improves this to the optimum 435: : 5, : 10, : 10, : 15, : 5, : 5 — see the 2002 question, which uses the same data.)
✓ Checked by computer We checked in Python: the VAM steps (penalties, allocations, cost 475) were recomputed with exact arithmetic, and the true optimum (scipy linprog) is 435.
Define a transportation problem. Determine the initial basic feasible solution of the following transportation problem by Vogel’s approximation method. Also, obtain the optimal solution by MODI method:
| Origin \ Destination | Supply | ||||
| 10 | 2 | 20 | 11 | 15 | |
| 12 | 7 | 9 | 20 | 25 | |
| 4 | 14 | 16 | 18 | 10 | |
| Demand | 5 | 15 | 15 | 15 | 50 |
Solution
Transportation problem. Given origins with supplies , destinations with demands () and unit costs , find shipments with , that minimise .
Initial basic feasible solution (Vogel’s method).
| Step | Row penalties | Column penalties | Largest penalty | Allocation |
|---|---|---|---|---|
| 1 | O1: 8, O2: 2, O3: 10 | D1: 6, D2: 5, D3: 7, D4: 7 | 10 (O3) | 5 to (O3, D1) at cost 4 |
| 2 | O1: 9, O2: 2, O3: 2 | D2: 5, D3: 7, D4: 7 | 9 (O1) | 15 to (O1, D2) at cost 2 |
| 3 | O2: 2, O3: 2 | D2: 7, D3: 7, D4: 2 | 7 (D2) | ε (a zero allocation) to (O2, D2): the row and column were satisfied together |
| 4 | O2: 11, O3: 2 | D3: 7, D4: 2 | 11 (O2) | 15 to (O2, D3) at cost 9 |
| — | — | — | forced | 10 to (O2, D4) at cost 20 |
| — | — | — | forced | 5 to (O3, D4) at cost 18 |
| D1 | D2 | D3 | D4 | Supply | |
|---|---|---|---|---|---|
| O1 | (10) | 15 (2) | (20) | (11) | 15 |
| O2 | (12) | ε (7) | 15 (9) | 10 (20) | 25 |
| O3 | 5 (4) | (14) | (16) | 5 (18) | 10 |
| Demand | 5 | 15 | 15 | 15 |
Initial cost . Only 5 cells are positive, one fewer than , so the solution is degenerate; we keep an allocation in cell (it forms no loop with the others).
Optimal solution (MODI method).
Iteration 1. Total cost = 475. For the occupied cells, (; ; ; ; ; ); taking in the row with most allocations gives the and shown. For each empty cell, .
| D1 | D2 | D3 | D4 | Supply | ||
|---|---|---|---|---|---|---|
| O1 | (10) Δ=9 | 15 (2) | (20) Δ=16 | (11) Δ=−4 | 15 | −5 |
| O2 | (12) Δ=6 | ε (7) | 15 (9) | 10 (20) | 25 | 0 |
| O3 | 5 (4) | (14) Δ=9 | (16) Δ=9 | 5 (18) | 10 | −2 |
| Demand | 5 | 15 | 15 | 15 | ||
| 6 | 7 | 9 | 20 |
The most negative is −4 at (O1, D4); it enters. Loop: (O1, D4) → (O1, D2) → (O2, D2) → (O2, D4) → (O1, D4), with signs (O1, D4)+, (O1, D2)−, (O2, D2)+, (O2, D4)−. smallest allocation in a “−” cell . Cost falls by .
Iteration 2. Total cost = 435. For the occupied cells, (; ; ; ; ; ); taking in the row with most allocations gives the and shown. For each empty cell, .
| D1 | D2 | D3 | D4 | Supply | ||
|---|---|---|---|---|---|---|
| O1 | (10) Δ=13 | 5 (2) | (20) Δ=16 | 10 (11) | 15 | 0 |
| O2 | (12) Δ=10 | 10 (7) | 15 (9) | (20) Δ=4 | 25 | 5 |
| O3 | 5 (4) | (14) Δ=5 | (16) Δ=5 | 5 (18) | 10 | 7 |
| Demand | 5 | 15 | 15 | 15 | ||
| −3 | 2 | 4 | 11 |
All , so this solution is optimal.
Optimal schedule.
| Route | Units | Cost |
|---|---|---|
| 5 | 10 | |
| 10 | 110 | |
| 10 | 70 | |
| 15 | 135 | |
| 5 | 20 | |
| 5 | 90 | |
| Minimum cost | 435 |
✓ Checked by computer We checked in Python (scipy linprog): the minimum cost is 435. The VAM start (475, degenerate) and the MODI iterations below were computed with exact arithmetic.
Explain the differences between a transportation problem and an assignment problem. Show how the latter can be regarded as a special case of a linear programming problem.
Solution
Differences between the transportation and the assignment problem.
| Transportation problem | Assignment problem |
|---|---|
| Ships a commodity from sources to destinations | Assigns jobs to facilities, one-to-one |
| Supply and demand can be any non-negative numbers | Every “supply” and “demand” is exactly 1 |
| Cost matrix may be rectangular () | Cost matrix must be square (); dummies are added otherwise |
| can take any non-negative value | is 0 or 1 |
| A BFS has occupied cells | A solution has exactly assignments; as a TP it is always degenerate |
| Feasibility needs | Always balanced once square |
| Solved by NWC/LCM/VAM + MODI or stepping stone | Solved by the Hungarian method |
| Objective: minimum transport cost | Objective: minimum total cost/time (or maximum profit) |
The assignment problem as a linear programming problem. Let if facility is assigned to job and 0 otherwise. Then subject to
- The objective and the constraints are linear, so this is an LPP with variables and equality constraints (of which are independent).
- The integrality condition may be dropped: the constraint matrix (each column has exactly two 1s, one in a row-constraint and one in a column-constraint) is totally unimodular, so every basic feasible solution of this LP is integer, and with the constraints , i.e. 0 or 1. Hence the LP optimum (e.g. by the simplex method) is an optimal assignment.
- In this sense it is also a special transportation problem with all , which is itself a special LPP.
✓ Answer checked step by step Every point was checked: the differences between the two problems and the LP formulation of the assignment problem (with 0–1 variables relaxed to x ≥ 0 by total unimodularity).
Define assignment problem and give its mathematical formulation. Also give an algorithm to solve an assignment problem.
Solution
Assignment problem. Given resources (men, machines) and activities (jobs), with the cost (or time) of resource doing activity , assign each resource to exactly one activity and each activity to exactly one resource so that the total cost is minimum.
Mathematical formulation. where means resource is assigned to activity .
Basis of the algorithm. If a constant is added to (or subtracted from) every element of a row or column of the cost matrix, the optimal assignment does not change, because every assignment uses exactly one element of each row and column, so its total changes by the same constant. If after such reductions all elements are and an assignment can be made entirely in zero cells, it has total reduced cost 0 and is therefore optimal.
Hungarian algorithm (Kuhn, 1955).
- Prepare. Make the matrix square (add dummy rows or columns of zeros). For a maximisation problem, subtract each element from the largest element. Give prohibited assignments a very large cost .
- Row reduction. Subtract the minimum element of each row from every element of that row.
- Column reduction. Subtract the minimum element of each column from every element of that column. Every row and column now has at least one zero.
- Cover the zeros. Draw the minimum number of horizontal and vertical lines covering all zeros (e.g. by: assign a single zero in each row/column and cross out the others in its column/row; tick unassigned rows, then columns having zeros in ticked rows, then rows having assignments in ticked columns; draw lines through unticked rows and ticked columns).
- Optimality test. If the number of lines equals , an optimal assignment exists among the zeros: go to step 7.
- Revise. Let be the smallest element not covered by any line. Subtract from all uncovered elements, add to elements at intersections of two lines, leave the other covered elements unchanged. Go to step 4.
- Assign. Examine rows one by one; in a row with exactly one zero, make the assignment and cross out the other zeros in that column. Do the same for columns. Repeat until assignments are made (if a cycle of zeros remains, choose any one zero arbitrarily — this gives alternative optima).
- The total cost is the sum of the original of the assigned cells.
The method ends in a finite number of steps, since each revision increases the number of zeros that can be covered (or the total of the subtracted constants) and the reduced matrix never becomes negative.
✓ Answer checked step by step Every step was checked against the standard 0–1 formulation and the Hungarian algorithm (row and column reduction, minimum line cover, revision by the least uncovered element, assignment among zeros).
Explain any one method for solving a transportation problem. Would you recommend this method to solve an assignment problem?
Solution
One method: Vogel’s approximation method (VAM) with the MODI test.
Initial solution (VAM).
- Balance the problem (add a dummy source or destination with zero costs if ).
- For every row and every column, compute the penalty = difference between its smallest and second-smallest cost.
- Select the row or column with the largest penalty (ties broken arbitrarily or by the smallest cost).
- In it, allocate as much as possible, , to the cell with the lowest cost.
- Cross out the satisfied row or column, revise the remaining supply/demand, recompute penalties, and repeat until everything is allocated. The penalty is the extra cost per unit we would pay if we did not use the cheapest route in that line; VAM avoids the largest such losses first and usually gives a solution at or close to the optimum.
Optimality (MODI method).
- With occupied cells, find , from on occupied cells (put one ).
- Compute for empty cells. If all , the solution is optimal.
- Otherwise enter the cell with the most negative , form the closed loop, shift (the least allocation at a “−” corner) around it, and go back to step 6.
Would we recommend it for an assignment problem? No.
- An assignment problem is a transportation problem with all supplies and demands equal to 1. A basic feasible solution must have occupied cells, but only of them can be 1; the other are zeros. Every solution is therefore highly degenerate.
- With VAM/MODI we would have to insert -allocations, and many iterations would be degenerate pivots that do not reduce the cost, so the work is large.
- The Hungarian method uses the special structure (only one assignment per row and column) and needs only simple reductions of the cost matrix; it is much faster and is the method to use.
- The transportation method still gives a correct answer — it is not wrong, only inefficient.
✓ Answer checked step by step Every step of Vogel’s method and the MODI test was checked; and the reason it is not recommended for assignment problems (2n − 1 basic cells with only n positive, so heavy degeneracy) was verified.
Explain the transportation problem. Show that a finite minimum feasible solution always exists in this case.
Solution
Transportation problem. Minimise subject to with , and (balanced). It describes the shipment of a commodity from sources to destinations at minimum total cost.
Theorem. A balanced transportation problem always has a finite minimum feasible solution.
Step 1: a feasible solution exists. Put . Then , and . So the feasible set is non-empty.
Step 2: the feasible set is bounded. For any feasible solution, every and so . Thus lies in a bounded box. It is also closed (defined by equalities and weak inequalities) and convex.
Step 3: the minimum is finite and attained. is a linear (hence continuous) function on the non-empty, closed and bounded set , so it attains a minimum value, which is finite: (If all , simply .) Moreover, a linear function on a bounded convex polyhedron attains its minimum at an extreme point, i.e. at a basic feasible solution, which has at most positive .
So the problem can never be unbounded, and a finite minimum feasible solution always exists. ∎
✓ Proof checked step by step Every step was checked: x_ij = a_i b_j / T is feasible, the feasible set is closed and bounded (0 ≤ x_ij ≤ min(a_i, b_j)), so a continuous linear cost attains a finite minimum, at a basic feasible solution.
Describe and justify the algorithm used to find the optimal solution for a transportation problem by the modified stepping stone method.
Solution
Modified stepping-stone (MODI, u–v) method. It finds the optimal solution of a balanced transportation problem, starting from a basic feasible solution with occupied (basic) cells in independent positions (no closed loop among them).
Algorithm.
- Initial BFS by NWC, least cost or VAM. If there are fewer than occupied cells, add to independent empty cells.
- Find and . For every occupied cell, . These are equations in unknowns; put one of them (say the of the row with most allocations) equal to 0 and solve the rest one by one.
- Opportunity costs. For every empty cell compute
- Optimality test. If all , the current solution is optimal (a shows an alternative optimum). Stop.
- Entering cell. Choose the empty cell with the most negative .
- Loop. Starting at that cell, trace a closed path moving alternately along its row and its column, turning only at occupied cells. Mark its corners alternately (starting with the entering cell) and .
- Reallocate. Let = the smallest allocation at a corner. Add at every corner and subtract it at every corner. The cell that becomes 0 leaves the basis (only one, if there are ties; the others keep ). The cost falls by . Go to step 2.
Justification.
- , are dual variables. The dual of the transportation problem is: maximise subject to , unrestricted (the primal constraints are equalities). For the current basis, complementary slackness requires on basic cells — exactly step 2. Since one of the equations of the primal is redundant, one dual variable may be fixed arbitrarily.
- is the net change in cost per unit shipped through cell . Sending one unit into requires changes at the corners of its loop (to keep row and column totals). The cost change is ; substituting for every occupied corner, all ’s and ’s cancel except , leaving . So equals the stepping-stone evaluation of that cell, found without tracing a loop for each cell.
- Optimality. If all , then for every cell: is dual feasible, and the primal and dual objectives are equal ( over basic cells). By the duality theorem the solution is optimal. If some , shipping through that cell reduces cost, so it is not optimal.
- Feasibility and termination. is the largest shift that keeps all allocations non-negative; the new solution again has independent cells. The cost strictly decreases when , so (apart from degenerate cycling, which is avoided by careful placement) no basis repeats and the method ends in finitely many steps.
✓ Proof checked step by step Every step was checked: u_i + v_j = c_ij on m + n − 1 basic cells defines the dual prices, Δ_ij = c_ij − u_i − v_j is the cost change per unit around the cell’s loop, and the stopping rule is LP duality (complementary slackness).
Define a transportation problem with m sources and n destinations. Show that in such a problem only restrictions are linearly independent.
Solution
Transportation problem with sources and destinations. with . There are variables and equality constraints.
Theorem. Exactly of the constraints are linearly independent.
Write the constraints as , where , , and is . The column of in is (a 1 in supply row and a 1 in demand row ).
(a) At most are independent. Let be the supply rows of and the demand rows. Each variable appears once in and once in , so and, by the balance condition, the right-hand sides also agree: . Hence any one constraint is the sum of the supply constraints minus the other demand constraints: it is redundant. So the rank of (and of the augmented matrix) is at most .
(b) are independent. Delete the last demand constraint () and consider the columns of the variables Restricted to the remaining rows (supply rows , demand rows ):
- the column of has a single 1, in supply row (its demand row was deleted);
- the column of () has 1s in supply row 1 and demand row .
Order the rows as (demand ; supply ) and the columns as (; ). The resulting square matrix is which is lower block-triangular with identity blocks, so its determinant is 1. Hence these rows are linearly independent.
Conclusion. The rank of the coefficient matrix is exactly : only of the constraints are independent. Consequently a basic feasible solution has basic variables (occupied cells), and in the MODI method one of the dual variables can be set arbitrarily. ∎
✓ Proof checked step by step Every step was checked: the sum of the m supply rows equals the sum of the n demand rows (so the rank is at most m + n − 1), and deleting one constraint leaves m + n − 1 rows that are independent (shown via a triangular basis).
Prove that a transportation problem can never have unbounded solutions.
Solution
Theorem. A (balanced) transportation problem cannot have an unbounded solution.
Problem. Minimise subject to (), (), , where and .
Proof.
- Every variable is bounded. For any feasible solution, all , so each one is at most the total of its row and of its column: Hence
- The objective is bounded. Therefore So can neither decrease to nor increase to over the feasible set.
- The feasible set is non-empty when (e.g. ), and it is closed and bounded, so the continuous function attains its minimum (and maximum) on it.
Hence the optimal value is always finite: a transportation problem never has an unbounded solution. (In simplex terms: an unbounded solution would need a direction , , with ; but means all row and column sums of are 0, which with forces .) ∎
Note also that with (costs), , so the minimum is non-negative.
✓ Proof checked step by step Every step was checked: each variable is bounded by 0 ≤ x_ij ≤ min(a_i, b_j), so the feasible set is bounded and the linear cost has a finite minimum.
Outline the Hungarian method of solving an assignment problem.
Solution
Assignment problem. Assign jobs to facilities, one to one, minimising subject to one assignment in each row and each column.
Principle. Adding or subtracting a constant to all elements of a row (or column) changes the cost of every assignment by the same amount, so the optimal assignment is unchanged. If, after such operations, the matrix is non-negative and an assignment can be made entirely in zero cells, that assignment has zero reduced cost and is optimal (König–Egerváry theorem: the maximum number of independent zeros equals the minimum number of lines covering all zeros).
Outline of the Hungarian method (Kuhn, 1955).
- Prepare the matrix. It must be square: add dummy rows or columns of zeros if necessary. For maximisation, replace each element by (largest element − element). Forbidden assignments get a very large cost .
- Row reduction. Subtract the smallest element of each row from every element of that row.
- Column reduction. Subtract the smallest element of each column from every element of that column.
- Cover all zeros with the minimum number of lines.
- Mark an assignment at a single zero in a row and cross out the other zeros in its column; do the same for columns; repeat.
- Tick rows without an assignment; tick columns having zeros in ticked rows; tick rows having assignments in ticked columns; repeat.
- Draw lines through all unticked rows and all ticked columns.
- Test. If the number of lines , the assignments marked form an optimal solution: go to step 7.
- Revise the matrix. Find the smallest uncovered element . Subtract from all uncovered elements; add to elements lying at the intersection of two lines; leave the others unchanged. Return to step 4.
- Read the solution. The optimal assignment uses the marked zeros; its cost is the sum of the corresponding original costs. If more than one set of independent zeros exists, there are alternative optima.
Illustration. Costs : row reduction (subtract 2, 3, 1, 4) and column reduction (subtract 3 from column 1) already give zeros that need 4 lines to cover, i.e. four independent zeros, and the optimal assignment is 1–2, 2–1, 3–3, 4–4, with cost .
✓ Answer checked step by step Every step was checked against Kuhn’s Hungarian method, including the reason row and column reductions do not change the optimal assignment; the illustration was recomputed (minimum 13).
More on Optimization Techniques
- All Statistics PYQ solutions, topic by topic
- Optimization Techniques topic-wise PYQs (questions only, for practice)
- Statistics PYQ analysis: which units carry the marks year by year
- Year-wise question papers
- Statistics booklist
Questions: UPSC Civil Services (Main) Examination, Statistics Paper II, 1996–2026. Solutions: Optional Province. Found an error? Tell us.

