Menu Close

Transportation and assignment problems: UPSC Statistics Optional PYQ Solutions (1996–2026)

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

Cover of the UPSC Prelims Topic-wise PYQ book with detailed explanations

From the Optional Province team

Preparing for Prelims too?

Our UPSC Prelims Topic-wise PYQ Book covers every Prelims question with detailed explanations, so you can see exactly where UPSC asks from. Now available as a hard copy and an eBook.

Buy Hard Copy on AmazonBuy eBook (PDF)

Download a free sample

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.

2026 · Paper II · Q2c(ii) · 10 marks

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 = nn, 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.

↑ Back to the question list

What is a Transportation problem? Give a general mathematical model of a transportation problem.

2026 · Paper II · Q4b(i) · 5 marks

Solution

Transportation problem. It is a special linear programming problem in which a homogeneous product is to be shipped from mm sources (factories, warehouses) to nn destinations (markets, depots). Source ii has aia_i units available, destination jj requires bjb_j units, and the cost of shipping one unit from ii to jj is cijc_{ij}. 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 xijx_{ij} be the quantity shipped from source ii to destination jj. Minimise Z=∑i=1m∑j=1ncijxij\text{Minimise }Z=\sum_{i=1}^m\sum_{j=1}^nc_{ij}x_{ij} subject to ∑j=1nxij=ai(i=1,…,m)(supply constraints)\sum_{j=1}^nx_{ij}=a_i\quad(i=1,\dots,m)\qquad\text{(supply constraints)} ∑i=1mxij=bj(j=1,…,n)(demand constraints)\sum_{i=1}^mx_{ij}=b_j\quad(j=1,\dots,n)\qquad\text{(demand constraints)} xij≥0for all i,j.x_{ij}\ge0\quad\text{for all }i,j .

  • It is balanced when ∑iai=∑jbj\sum_ia_i=\sum_jb_j; 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 mnmn variables and m+nm+n constraints, of which only m+n−1m+n-1 are independent; a basic feasible solution has m+n−1m+n-1 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.

↑ Back to the question list

Use Vogel’s approximation method to solve the following transportation problem:

Plant Distribution Centre D1 Distribution Centre D2 Distribution Centre D3 Distribution Centre D4 Capacity
P1 2 3 11 7 6
P2 1 0 6 1 1
P3 5 8 15 9 10
Demand 7 5 3 2

Solution

The problem is balanced: total capacity 6+1+10=176+1+10=17 = total demand 7+5+3+2=177+5+3+2=17.

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 m+n−1=6m+n-1=6 occupied cells (non-degenerate). Cost =2+15+1+30+45+9=102=2+15+1+30+45+9=102.

Optimality test (MODI method).

Iteration 1. Total cost = 102. For the occupied cells, ui+vj=ciju_i+v_j=c_{ij} (uP1+vD1=2u_{P1}+v_{D1}=2; uP1+vD2=3u_{P1}+v_{D2}=3; uP2+vD4=1u_{P2}+v_{D4}=1; uP3+vD1=5u_{P3}+v_{D1}=5; uP3+vD3=15u_{P3}+v_{D3}=15; uP3+vD4=9u_{P3}+v_{D4}=9); taking u=0u=0 in the row with most allocations gives the uiu_i and vjv_j shown. For each empty cell, Δij=cij−(ui+vj)\Delta_{ij}=c_{ij}-(u_i+v_j).

D1 D2 D3 D4 Supply uiu_i
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
vjv_j 5 6 15 9

The most negative Δ\Delta 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)−. θ=\theta= smallest allocation in a “−” cell =1=1. Cost falls by θ|Δ|=1\theta\,|\Delta|=1.

Iteration 2. Total cost = 101. For the occupied cells, ui+vj=ciju_i+v_j=c_{ij} (uP1+vD1=2u_{P1}+v_{D1}=2; uP1+vD2=3u_{P1}+v_{D2}=3; uP2+vD3=6u_{P2}+v_{D3}=6; uP3+vD1=5u_{P3}+v_{D1}=5; uP3+vD3=15u_{P3}+v_{D3}=15; uP3+vD4=9u_{P3}+v_{D4}=9); taking u=0u=0 in the row with most allocations gives the uiu_i and vjv_j shown. For each empty cell, Δij=cij−(ui+vj)\Delta_{ij}=c_{ij}-(u_i+v_j).

D1 D2 D3 D4 Supply uiu_i
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
vjv_j 5 6 15 9

The most negative Δ\Delta 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)−. θ=\theta= smallest allocation in a “−” cell =1=1. Cost falls by θ|Δ|=1\theta\,|\Delta|=1.

Iteration 3. Total cost = 100. For the occupied cells, ui+vj=ciju_i+v_j=c_{ij} (uP1+vD2=3u_{P1}+v_{D2}=3; uP1+vD3=11u_{P1}+v_{D3}=11; uP2+vD3=6u_{P2}+v_{D3}=6; uP3+vD1=5u_{P3}+v_{D1}=5; uP3+vD3=15u_{P3}+v_{D3}=15; uP3+vD4=9u_{P3}+v_{D4}=9); taking u=0u=0 in the row with most allocations gives the uiu_i and vjv_j shown. For each empty cell, Δij=cij−(ui+vj)\Delta_{ij}=c_{ij}-(u_i+v_j).

D1 D2 D3 D4 Supply uiu_i
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
vjv_j 5 7 15 9

All Δij≥0\Delta_{ij}\ge0, so this solution is optimal.

Optimal schedule.

Route Units Cost
P1→D2P_1\to D_2 5 15
P1→D3P_1\to D_3 1 11
P2→D3P_2\to D_3 1 6
P3→D1P_3\to D_1 7 35
P3→D3P_3\to D_3 1 15
P3→D4P_3\to D_4 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.

2026 · Paper II · Q4b(ii) · 10 marks

↑ Back to the question list

A company has four plants P1, P2, P3 and P4 from which it supplies to three markets M1, M2 and M3. 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 P1 Plant P2 Plant P3 Plant P4 Required at market
M1 19 14 23 11 11
M2 15 16 12 21 13
M3 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:

M1M_1 M2M_2 M3M_3 Available
P1P_1 19 15 30 6
P2P_2 14 16 25 10
P3P_3 23 12 16 12
P4P_4 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

m+n−1=6m+n-1=6 occupied cells. Cost =6(15)+3(16)+7(25)+12(16)+11(11)+4(21)=710=6(15)+3(16)+7(25)+12(16)+11(11)+4(21)=710.

MODI test.

Iteration 1. Total cost = 710. For the occupied cells, ui+vj=ciju_i+v_j=c_{ij} (uP1+vM2=15u_{P1}+v_{M2}=15; uP2+vM2=16u_{P2}+v_{M2}=16; uP2+vM3=25u_{P2}+v_{M3}=25; uP3+vM3=16u_{P3}+v_{M3}=16; uP4+vM1=11u_{P4}+v_{M1}=11; uP4+vM2=21u_{P4}+v_{M2}=21); taking u=0u=0 in the row with most allocations gives the uiu_i and vjv_j shown. For each empty cell, Δij=cij−(ui+vj)\Delta_{ij}=c_{ij}-(u_i+v_j).

M1 M2 M3 Supply uiu_i
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
vjv_j 6 16 25

All Δij≥0\Delta_{ij}\ge0, so this solution is optimal.

Optimal plan. P1→M2P_1\to M_2: 6; P2→M2P_2\to M_2: 3; P2→M3P_2\to M_3: 7; P3→M3P_3\to M_3: 12; P4→M1P_4\to M_1: 11; P4→M2P_4\to M_2: 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.

2025 · Paper II · Q3b · 15 marks

↑ Back to the question list

.

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 A,B,C and D to the machines I,II,III and IV.

2023 · Paper II · Q3b(i) · 15 marks

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 = nn, 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
AA II 12
BB III 7
CC IV 11
DD I 8
Total 38

Answer. A→A\to II, B→B\to III, C→C\to IV, D→D\to 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.

↑ Back to the question list

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.

2023 · Paper II · Q4a · 15 marks

Solution

Supply =250+300+400=950=250+300+400=950 and requirement =200+225+275+250=950=200+225+275+250=950: 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 m+n−1=3+4−1=6m+n-1=3+4-1=6 occupied cells, so this is a non-degenerate basic feasible solution. Its cost: 200(11)+50(13)+175(18)+125(10)+275(13)+125(10)=12,075.200(11)+50(13)+175(18)+125(10)+275(13)+125(10)=12{,}075 .

(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, ui+vj=ciju_i+v_j=c_{ij} (uA+vD=11u_{A}+v_{D}=11; uA+vE=13u_{A}+v_{E}=13; uB+vE=18u_{B}+v_{E}=18; uB+vG=10u_{B}+v_{G}=10; uC+vF=13u_{C}+v_{F}=13; uC+vG=10u_{C}+v_{G}=10); taking u=0u=0 in the row with most allocations gives the uiu_i and vjv_j shown. For each empty cell, Δij=cij−(ui+vj)\Delta_{ij}=c_{ij}-(u_i+v_j).

D E F G Supply uiu_i
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
vjv_j 11 13 8 5

All Δij≥0\Delta_{ij}\ge0, so this solution is optimal. (Some Δij=0\Delta_{ij}=0: (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.

↑ Back to the question list

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.

2022 · Paper II · Q4b · 15 marks

Solution

Layover times. For each pair (Delhi–Jaipur flight ii, Jaipur–Delhi flight jj):

  • Crew based at Delhi: they fly ii to Jaipur and return on jj. Layover at Jaipur = departure of jj − arrival of ii; if this is less than 5 hours they must wait for the next day’s flight jj, so add 24 hours.
  • Crew based at Jaipur: they fly jj to Delhi and return on ii. Layover at Delhi = departure of ii − arrival of jj (+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) < n=4n=4, 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) < n=4n=4, 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 = nn, 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.

↑ Back to the question list

.

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.

2021 · Paper II · Q1b · 10 marks

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) < n=5n=5, 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 = nn, 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
AA V 200
BB III 130
CC II 110
DD I 50
EE IV 80
Total 570

Answer. AA–V, BB–III, CC–II, DD–I, EE–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.

↑ Back to the question list

.

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.

2021 · Paper II · Q3b · 15 marks

Solution

Balancing. Total supply =50+70+30+50=200=50+70+30+50=200, total demand =25+35+105+20=185=25+35+105+20=185. We add a dummy store with demand 200−185=15200-185=15 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

m+n−1=4+5−1=8m+n-1=4+5-1=8 occupied cells. Initial cost = 1,510.

MODI method.

Iteration 1. Total cost = 1510. For the occupied cells, ui+vj=ciju_i+v_j=c_{ij} (uA+vI=4u_{A}+v_{I}=4; uA+vII=6u_{A}+v_{II}=6; uA+vIII=8u_{A}+v_{III}=8; uB+vIII=10u_{B}+v_{III}=10; uB+vDummy=0u_{B}+v_{Dummy}=0; uC+vII=4u_{C}+v_{II}=4; uD+vIII=13u_{D}+v_{III}=13; uD+vIV=8u_{D}+v_{IV}=8); taking u=0u=0 in the row with most allocations gives the uiu_i and vjv_j shown. For each empty cell, Δij=cij−(ui+vj)\Delta_{ij}=c_{ij}-(u_i+v_j).

I II III IV Dummy Supply uiu_i
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
vjv_j 4 6 8 3 −2

The most negative Δ\Delta 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)−. θ=\theta= smallest allocation in a “−” cell =15=15. Cost falls by θ|Δ|=45\theta\,|\Delta|=45.

Iteration 2. Total cost = 1465. For the occupied cells, ui+vj=ciju_i+v_j=c_{ij} (uA+vI=4u_{A}+v_{I}=4; uA+vII=6u_{A}+v_{II}=6; uA+vIII=8u_{A}+v_{III}=8; uB+vIII=10u_{B}+v_{III}=10; uC+vII=4u_{C}+v_{II}=4; uD+vIII=13u_{D}+v_{III}=13; uD+vIV=8u_{D}+v_{IV}=8; uD+vDummy=0u_{D}+v_{Dummy}=0); taking u=0u=0 in the row with most allocations gives the uiu_i and vjv_j shown. For each empty cell, Δij=cij−(ui+vj)\Delta_{ij}=c_{ij}-(u_i+v_j).

I II III IV Dummy Supply uiu_i
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
vjv_j 4 6 8 3 −5

All Δij≥0\Delta_{ij}\ge0, so this solution is optimal. (Some Δij=0\Delta_{ij}=0: (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.

↑ Back to the question list

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
A 8 4 2 6 1
B 0 9 5 5 4
C 3 8 9 2 6
D 4 3 1 0 3
E 9 5 8 9 5

Determine the optimum assignment schedule.

2020 · Paper II · Q3a · 15 marks

Solution

Assignment problem. nn jobs are to be assigned to nn persons, one job to each person and one person to each job, so that the total cost (or time) is minimum. With xij=1x_{ij}=1 if person ii gets job jj and 0 otherwise: Minimise Z=∑i∑jcijxij,∑jxij=1(each i),∑ixij=1(each j),xij∈{0,1}.\text{Minimise }Z=\sum_i\sum_jc_{ij}x_{ij},\quad\sum_jx_{ij}=1\ (\text{each }i),\quad\sum_ix_{ij}=1\ (\text{each }j),\quad x_{ij}\in\{0,1\}. 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 = nn, 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
AA 5 1
BB 1 0
CC 4 2
DD 3 1
EE 2 5
Total 9

Optimum schedule: AA–5, BB–1, CC–4, DD–3, EE–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.

↑ Back to the question list

Solve the following Transportation Problem by MODI method:

Origin \ Destination D1 D2 D3 D4 Availability
O1 1 2 1 4 30
O2 3 3 2 1 50
O3 4 2 5 9 20
Demand 20 40 30 10

Solution

Availability 30+50+20=10030+50+20=100 = demand 20+40+30+10=10020+40+30+10=100: 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 =m+n−1=m+n-1. Cost =20(1)+10(1)+20(3)+20(2)+10(1)+20(2)=180=20(1)+10(1)+20(3)+20(2)+10(1)+20(2)=180.

MODI method.

Iteration 1. Total cost = 180. For the occupied cells, ui+vj=ciju_i+v_j=c_{ij} (uO1+vD1=1u_{O1}+v_{D1}=1; uO1+vD3=1u_{O1}+v_{D3}=1; uO2+vD2=3u_{O2}+v_{D2}=3; uO2+vD3=2u_{O2}+v_{D3}=2; uO2+vD4=1u_{O2}+v_{D4}=1; uO3+vD2=2u_{O3}+v_{D2}=2); taking u=0u=0 in the row with most allocations gives the uiu_i and vjv_j shown. For each empty cell, Δij=cij−(ui+vj)\Delta_{ij}=c_{ij}-(u_i+v_j).

D1 D2 D3 D4 Supply uiu_i
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
vjv_j 2 3 2 1

All Δij≥0\Delta_{ij}\ge0, so this solution is optimal. (Some Δij=0\Delta_{ij}=0: (O1, D2), so alternative optimal solutions exist.)

Optimal solution. O1→D1O_1\to D_1: 20, O1→D3O_1\to D_3: 10, O2→D2O_2\to D_2: 20, O2→D3O_2\to D_3: 20, O2→D4O_2\to D_4: 10, O3→D2O_3\to D_2: 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.

2020 · Paper II · Q3b · 15 marks

↑ Back to the question list

Obtain an optimum solution for the following transportation problem:

Factory \ Warehouse A B C Supply
X 20 40 40 152
Y 80 120 80 164
Z 40 80 120 154
Demand 144 204 82

Solution

Balancing. Supply =152+164+154=470=152+164+154=470; demand =144+204+82=430=144+204+82=430. 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 =m+n−1=m+n-1. Cost =152(40)+42(120)+82(80)+144(40)+10(80)=24,240=152(40)+42(120)+82(80)+144(40)+10(80)=24{,}240.

MODI test.

Iteration 1. Total cost = 24240. For the occupied cells, ui+vj=ciju_i+v_j=c_{ij} (uX+vB=40u_{X}+v_{B}=40; uY+vB=120u_{Y}+v_{B}=120; uY+vC=80u_{Y}+v_{C}=80; uY+vDummy=0u_{Y}+v_{Dummy}=0; uZ+vA=40u_{Z}+v_{A}=40; uZ+vB=80u_{Z}+v_{B}=80); taking u=0u=0 in the row with most allocations gives the uiu_i and vjv_j shown. For each empty cell, Δij=cij−(ui+vj)\Delta_{ij}=c_{ij}-(u_i+v_j).

A B C Dummy Supply uiu_i
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
vjv_j 80 120 80 0

All Δij≥0\Delta_{ij}\ge0, so this solution is optimal. (Some Δij=0\Delta_{ij}=0: (Y, A), so alternative optimal solutions exist.)

Optimum. X→BX\to B: 152; Y→BY\to B: 42; Y→CY\to C: 82; Z→AZ\to A: 144; Z→BZ\to B: 10; factory YY 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.

2019 · Paper II · Q4a · 15 marks

↑ Back to the question list

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.

2018 · Paper II · Q2c · 20 marks

Solution

Transportation problem. A product available at mm origins (amounts aia_i) must be sent to nn destinations (requirements bjb_j); the unit cost on route (i,j)(i,j) is cijc_{ij}. Find the shipments xijx_{ij} that meet all requirements at minimum total cost.

As a linear programming problem. Minimise Z=∑i=1m∑j=1ncijxij\text{Minimise }Z=\sum_{i=1}^m\sum_{j=1}^nc_{ij}x_{ij} subject to∑j=1nxij=ai(i=1,…,m),∑i=1mxij=bj(j=1,…,n),xij≥0.\text{subject to}\quad\sum_{j=1}^nx_{ij}=a_i\ (i=1,\dots,m),\qquad\sum_{i=1}^mx_{ij}=b_j\ (j=1,\dots,n),\qquad x_{ij}\ge0 . The objective and the constraints are linear in the mnmn variables xijx_{ij}, so this is an LPP with m+nm+n equality constraints whose coefficient matrix has only 0s and 1s (each xijx_{ij} appears in exactly one supply row and one demand row).

Necessary and sufficient condition for a feasible solution: ∑i=1mai=∑j=1nbj.\sum_{i=1}^ma_i=\sum_{j=1}^nb_j . Necessary: adding all supply equations gives ∑i∑jxij=∑iai\sum_i\sum_jx_{ij}=\sum_ia_i, and adding all demand equations gives the same double sum =∑jbj=\sum_jb_j. Sufficient: if the totals are equal to T>0T>0, then xij=aibj/T≥0x_{ij}=a_ib_j/T\ge0 satisfies ∑jxij=ai∑jbj/T=ai\sum_jx_{ij}=a_i\sum_jb_j/T=a_i and ∑ixij=bj\sum_ix_{ij}=b_j. 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 S1,…,S6S_1,\dots,S_6 and destinations as columns T1,…,T4T_1,\dots,T_4:

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 =3(5)+1(3)+2(6)+2(3)+4(10)+2(5)+1(7)+2(5)=103=3(5)+1(3)+2(6)+2(3)+4(10)+2(5)+1(7)+2(5)=103.

Degenerate or not? A basic feasible solution of this problem needs m+n−1=6+4−1=9m+n-1=6+4-1=9 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 ε\varepsilon 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, ui+vj=ciju_i+v_j=c_{ij} (uS1+vT2=5u_{S1}+v_{T2}=5; uS1+vT3=2u_{S1}+v_{T3}=2; uS2+vT1=3u_{S2}+v_{T1}=3; uS2+vT4=6u_{S2}+v_{T4}=6; uS3+vT3=3u_{S3}+v_{T3}=3; uS3+vT4=10u_{S3}+v_{T4}=10; uS4+vT4=5u_{S4}+v_{T4}=5; uS5+vT2=7u_{S5}+v_{T2}=7; uS6+vT1=5u_{S6}+v_{T1}=5); taking u=0u=0 in the row with most allocations gives the uiu_i and vjv_j shown. For each empty cell, Δij=cij−(ui+vj)\Delta_{ij}=c_{ij}-(u_i+v_j).

T1 T2 T3 T4 Supply uiu_i
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
vjv_j 6 5 2 9

The most negative Δ\Delta 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)−. θ=\theta= smallest allocation in a “−” cell =ε=ε. Cost falls by θ|Δ|=0\theta\,|\Delta|=0.

Iteration 2. Total cost = 103. For the occupied cells, ui+vj=ciju_i+v_j=c_{ij} (uS1+vT1=5u_{S1}+v_{T1}=5; uS1+vT2=5u_{S1}+v_{T2}=5; uS2+vT1=3u_{S2}+v_{T1}=3; uS2+vT4=6u_{S2}+v_{T4}=6; uS3+vT3=3u_{S3}+v_{T3}=3; uS3+vT4=10u_{S3}+v_{T4}=10; uS4+vT4=5u_{S4}+v_{T4}=5; uS5+vT2=7u_{S5}+v_{T2}=7; uS6+vT1=5u_{S6}+v_{T1}=5); taking u=0u=0 in the row with most allocations gives the uiu_i and vjv_j shown. For each empty cell, Δij=cij−(ui+vj)\Delta_{ij}=c_{ij}-(u_i+v_j).

T1 T2 T3 T4 Supply uiu_i
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
vjv_j 5 5 1 8

All Δij≥0\Delta_{ij}\ge0, so this solution is optimal. (Some Δij=0\Delta_{ij}=0: (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.

↑ Back to the question list

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 D1 D2 D3 D4 D5 D6 Availability
O1 2 1 3 3 2 5 50
O2 3 2 2 4 3 4 40
O3 3 5 4 2 4 1 60
O4 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 aia_i and requirements bjb_j has a feasible solution if and only if ∑iai=∑jbj\sum_ia_i=\sum_jb_j.

  • Necessity: summing the mm supply equations ∑jxij=ai\sum_jx_{ij}=a_i gives ∑i,jxij=∑iai\sum_{i,j}x_{ij}=\sum_ia_i; summing the nn demand equations ∑ixij=bj\sum_ix_{ij}=b_j gives ∑i,jxij=∑jbj\sum_{i,j}x_{ij}=\sum_jb_j. Hence the totals must be equal.
  • Sufficiency: if ∑ai=∑bj=T\sum a_i=\sum b_j=T, put xij=aibj/Tx_{ij}=a_ib_j/T. Then xij≥0x_{ij}\ge0, ∑jxij=ai\sum_jx_{ij}=a_i and ∑ixij=bj\sum_ix_{ij}=b_j: a feasible solution.

The problem. Availability 50+40+60+30=18050+40+60+30=180 = demand 30+50+20+40+30+10=18030+50+20+40+30+10=180: 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 m+n−1=9m+n-1=9 positive allocations (a row and a column were satisfied together), so the starting solution is degenerate; an ε\varepsilon cell is kept. Initial cost = 340.

MODI method.

Iteration 1. Total cost = 340. For the occupied cells, ui+vj=ciju_i+v_j=c_{ij} (uO1+vD2=1u_{O1}+v_{D2}=1; uO2+vD2=2u_{O2}+v_{D2}=2; uO2+vD3=2u_{O2}+v_{D3}=2; uO2+vD5=3u_{O2}+v_{D5}=3; uO3+vD1=3u_{O3}+v_{D1}=3; uO3+vD4=2u_{O3}+v_{D4}=2; uO3+vD5=4u_{O3}+v_{D5}=4; uO3+vD6=1u_{O3}+v_{D6}=1; uO4+vD4=1u_{O4}+v_{D4}=1); taking u=0u=0 in the row with most allocations gives the uiu_i and vjv_j shown. For each empty cell, Δij=cij−(ui+vj)\Delta_{ij}=c_{ij}-(u_i+v_j).

D1 D2 D3 D4 D5 D6 Supply uiu_i
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
vjv_j 3 3 3 2 4 1

The most negative Δ\Delta 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)−. θ=\theta= smallest allocation in a “−” cell =10=10. Cost falls by θ|Δ|=10\theta\,|\Delta|=10.

Iteration 2. Total cost = 330. For the occupied cells, ui+vj=ciju_i+v_j=c_{ij} (uO1+vD2=1u_{O1}+v_{D2}=1; uO2+vD2=2u_{O2}+v_{D2}=2; uO2+vD3=2u_{O2}+v_{D3}=2; uO2+vD5=3u_{O2}+v_{D5}=3; uO3+vD1=3u_{O3}+v_{D1}=3; uO3+vD4=2u_{O3}+v_{D4}=2; uO3+vD6=1u_{O3}+v_{D6}=1; uO4+vD4=1u_{O4}+v_{D4}=1; uO4+vD5=2u_{O4}+v_{D5}=2); taking u=0u=0 in the row with most allocations gives the uiu_i and vjv_j shown. For each empty cell, Δij=cij−(ui+vj)\Delta_{ij}=c_{ij}-(u_i+v_j).

D1 D2 D3 D4 D5 D6 Supply uiu_i
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
vjv_j 3 2 2 2 3 1

All Δij≥0\Delta_{ij}\ge0, so this solution is optimal. (Some Δij=0\Delta_{ij}=0: (O1, D1), (O1, D5), (O2, D1), so alternative optimal solutions exist.)

Optimal solution.

Route Units Cost
O1→D2O_1\to D_2 50 50
O2→D3O_2\to D_3 20 40
O2→D5O_2\to D_5 20 60
O3→D1O_3\to D_1 30 90
O3→D4O_3\to D_4 20 40
O3→D6O_3\to D_6 10 10
O4→D4O_4\to D_4 20 20
O4→D5O_4\to D_5 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.

2017 · Paper II · Q2a · 15 marks

↑ Back to the question list

State and prove a necessary and sufficient condition for the existence of a solution to a transportation problem.

2016 · Paper II · Q1a · 10 marks

Solution

Transportation problem. Minimise ∑i=1m∑j=1ncijxij\sum_{i=1}^m\sum_{j=1}^nc_{ij}x_{ij} subject to ∑j=1nxij=ai(i=1,…,m),∑i=1mxij=bj(j=1,…,n),xij≥0,\sum_{j=1}^nx_{ij}=a_i\ (i=1,\dots,m),\qquad\sum_{i=1}^mx_{ij}=b_j\ (j=1,\dots,n),\qquad x_{ij}\ge0, where ai>0a_i>0 are the availabilities and bj>0b_j>0 the requirements.

Theorem. The transportation problem has a feasible solution if and only if ∑i=1mai=∑j=1nbj.\sum_{i=1}^ma_i=\sum_{j=1}^nb_j .

Proof of necessity. Suppose {xij}\{x_{ij}\} is feasible. Summing the supply constraints over ii, ∑i=1m∑j=1nxij=∑i=1mai.\sum_{i=1}^m\sum_{j=1}^nx_{ij}=\sum_{i=1}^ma_i . Summing the demand constraints over jj, ∑j=1n∑i=1mxij=∑j=1nbj.\sum_{j=1}^n\sum_{i=1}^mx_{ij}=\sum_{j=1}^nb_j . The left-hand sides are the same double sum, so ∑iai=∑jbj\sum_ia_i=\sum_jb_j.

Proof of sufficiency. Suppose ∑iai=∑jbj=T\sum_ia_i=\sum_jb_j=T (T>0T>0). Define xij=aibjT(i=1,…,m;j=1,…,n).x_{ij}=\frac{a_ib_j}{T}\qquad(i=1,\dots,m;\ j=1,\dots,n).

  • xij≥0x_{ij}\ge0, since ai,bj,T>0a_i,b_j,T>0.
  • ∑j=1nxij=aiT∑j=1nbj=aiTT=ai\displaystyle\sum_{j=1}^nx_{ij}=\frac{a_i}{T}\sum_{j=1}^nb_j=\frac{a_iT}{T}=a_i.
  • ∑i=1mxij=bjT∑i=1mai=bj\displaystyle\sum_{i=1}^mx_{ij}=\frac{b_j}{T}\sum_{i=1}^ma_i=b_j.

So {xij}\{x_{ij}\} satisfies all the constraints: a feasible solution exists. ∎

Remarks.

  • Moreover 0≤xij≤min(ai,bj)0\le x_{ij}\le\min(a_i,b_j) for every feasible solution, so the feasible set is bounded, and the objective (with cij≥0c_{ij}\ge0) 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.

↑ Back to the question list

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.

2016 · Paper II · Q2c · 20 marks

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) < n=5n=5, 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) < n=5n=5, 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 = nn, 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
AA 1 25
BB 2 19
CC 3 26
DD 5 32
EE 4 23
Total 125

Answer. AA–1, BB–2, CC–3, DD–5, EE–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.

↑ Back to the question list

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 T1 T2 T3 T4 T5
E1 25 55 60 45 30
E2 45 65 55 35 40
E3 10 35 45 55 65
E4 40 30 70 40 60
E5 55 45 40 55 10

Solution

Assignment problem. Given nn employees and nn tasks and the cost (or time) cijc_{ij} of employee ii doing task jj, 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 xij∈{0,1}x_{ij}\in\{0,1\}, ∑jxij=1\sum_jx_{ij}=1, ∑ixij=1\sum_ix_{ij}=1.

Steps of the Hungarian method.

  1. Make the matrix square (add dummy rows/columns of zeros if needed). For maximisation, subtract every element from the largest.
  2. Row reduction: subtract the smallest element of each row from that row.
  3. Column reduction: subtract the smallest element of each column from that column.
  4. Cover the zeros with the minimum number of horizontal and vertical lines. If this number equals nn, go to step 6.
  5. Revise: find the smallest uncovered element θ\theta; subtract it from all uncovered elements and add it to the elements at the intersections of two lines; go to step 4.
  6. Assign: choose a row (or column) with a single zero, assign there and cross out the other zeros in its column (row); repeat until nn 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) < n=5n=5, 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) < n=5n=5, 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 = nn, 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
E1E_1 T5T_5 30
E2E_2 T4T_4 35
E3E_3 T1T_1 10
E4E_4 T2T_2 30
E5E_5 T3T_3 40
Total 145

Minimum total cost = 145. The final matrix has extra zeros, so there are alternative optimal assignments with the same cost:

  • E1E_1–T1T_1, E2E_2–T4T_4, E3E_3–T3T_3, E4E_4–T2T_2, E5E_5–T5T_5 (25 + 35 + 45 + 30 + 10 = 145);
  • E1E_1–T3T_3, E2E_2–T4T_4, E3E_3–T1T_1, E4E_4–T2T_2, E5E_5–T5T_5 (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.

2015 · Paper II · Q4b · 15 marks

↑ Back to the question list

A cement factory manager is considering the least way to transport cement from his three factories A, B and C to depots P, Q, R and S. The weekly production and demands along with transportation costs are given below. What should be the distribution programme?

Factory Depot P Depot Q Depot R Depot S Production
A 10 8 7 12 500
B 12 15 6 10 500
C 8 10 12 14 900
demand 700 550 450 300

Solution

Balancing. Production =500+500+900=1900=500+500+900=1900; demand =700+550+450+300=2000=700+550+450+300=2000. 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

m+n−1=4+4−1=7m+n-1=4+4-1=7 occupied cells. Initial cost = 15,400.

MODI method.

Iteration 1. Total cost = 15400. For the occupied cells, ui+vj=ciju_i+v_j=c_{ij} (uA+vQ=8u_{A}+v_{Q}=8; uB+vR=6u_{B}+v_{R}=6; uB+vS=10u_{B}+v_{S}=10; uC+vP=8u_{C}+v_{P}=8; uC+vQ=10u_{C}+v_{Q}=10; uC+vS=14u_{C}+v_{S}=14; uDummy+vS=0u_{Dummy}+v_{S}=0); taking u=0u=0 in the row with most allocations gives the uiu_i and vjv_j shown. For each empty cell, Δij=cij−(ui+vj)\Delta_{ij}=c_{ij}-(u_i+v_j).

P Q R S Supply uiu_i
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
vjv_j 8 10 10 14

The most negative Δ\Delta 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)−. θ=\theta= smallest allocation in a “−” cell =150=150. Cost falls by θ|Δ|=150\theta\,|\Delta|=150.

Iteration 2. Total cost = 15250. For the occupied cells, ui+vj=ciju_i+v_j=c_{ij} (uA+vQ=8u_{A}+v_{Q}=8; uA+vR=7u_{A}+v_{R}=7; uB+vR=6u_{B}+v_{R}=6; uB+vS=10u_{B}+v_{S}=10; uC+vP=8u_{C}+v_{P}=8; uC+vQ=10u_{C}+v_{Q}=10; uDummy+vS=0u_{Dummy}+v_{S}=0); taking u=0u=0 in the row with most allocations gives the uiu_i and vjv_j shown. For each empty cell, Δij=cij−(ui+vj)\Delta_{ij}=c_{ij}-(u_i+v_j).

P Q R S Supply uiu_i
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
vjv_j 6 8 7 11

All Δij≥0\Delta_{ij}\ge0, so this solution is optimal.

Distribution programme.

Route Units Cost
A→QA\to Q 350 2,800
A→RA\to R 150 1,050
B→RB\to R 300 1,800
B→SB\to S 200 2,000
C→PC\to P 700 5,600
C→QC\to Q 200 2,000
Minimum cost 15,250

Depot SS receives only 200 of its 300 units: the shortfall of 100 falls on SS (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.

2013 · Paper II · Q3c · 30 marks

↑ Back to the question list

Cover of the UPSC Mains Topic-wise and Year-wise PYQs book (2013–2026)

From the Optional Province team

Strengthen your GS papers

Our UPSC Mains Topic-wise & Year-wise PYQ Book (2013–2026) maps every GS question to the syllabus, so you know what UPSC asks and how often. Now available as a hard copy and an eBook.

Buy Hard Copy on AmazonBuy eBook (PDF)

Download a free sample

What is Assignment Problem? With usual notation give its mathematical formulation. Compare this with Mathematical form of Transportation Model.

2013 · Paper II · Q4b · 10 marks

Solution

Assignment problem. There are nn facilities (persons, machines) and nn jobs. Facility ii doing job jj costs cijc_{ij} (or takes time cijc_{ij}). 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 xij={1if facility i is assigned job j,0otherwise.x_{ij}=\begin{cases}1&\text{if facility }i\text{ is assigned job }j,\\0&\text{otherwise.}\end{cases} Minimise Z=∑i=1n∑j=1ncijxij\text{Minimise }Z=\sum_{i=1}^n\sum_{j=1}^nc_{ij}x_{ij} subject to ∑j=1nxij=1(i=1,…,n)(each facility gets one job)\sum_{j=1}^nx_{ij}=1\quad(i=1,\dots,n)\qquad\text{(each facility gets one job)} ∑i=1nxij=1(j=1,…,n)(each job goes to one facility)\sum_{i=1}^nx_{ij}=1\quad(j=1,\dots,n)\qquad\text{(each job goes to one facility)} xij=0 or 1.x_{ij}=0\text{ or }1 .

Transportation model (for comparison). Minimise ∑i=1m∑j=1ncijxijs.t.∑jxij=ai,∑ixij=bj,xij≥0.\text{Minimise }\sum_{i=1}^m\sum_{j=1}^nc_{ij}x_{ij}\quad\text{s.t.}\quad\sum_jx_{ij}=a_i,\quad\sum_ix_{ij}=b_j,\quad x_{ij}\ge0 .

Comparison.

Transportation problem Assignment problem
Size m×nm\times n (need not be square) n×nn\times n (square)
Supplies / demands any aia_i, bjb_j all equal to 1
Variables xij≥0x_{ij}\ge0, any amount xij∈{0,1}x_{ij}\in\{0,1\}
Balance condition ∑ai=∑bj\sum a_i=\sum b_j automatically n=nn=n
Basic cells m+n−1m+n-1 2n−12n-1, of which only nn 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 m=nm=n and all ai=bj=1a_i=b_j=1. Because the transportation constraint matrix is totally unimodular, the LP relaxation with xij≥0x_{ij}\ge0 has an integer (0–1) optimal solution, so the restriction xij∈{0,1}x_{ij}\in\{0,1\} can be replaced by xij≥0x_{ij}\ge0.

✓ 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.

↑ Back to the question list

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 A to II; 1 unit from A to III; 9 units from A to IV; 15 units from B to III; 1 unit from C to III; 7 units from C to I. (i) Check and verify if the clerk has the optimal schedule. (ii) Find the optimal schedule and the minimum total shipping cost.

2011 · Paper II · Q4a · 25 marks

Solution

Supply 22+15+8=4522+15+8=45 = requirement 7+12+17+9=457+12+17+9=45: 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 =12(2)+1(4)+9(3)+15(1)+1(7)+7(4)=105=12(2)+1(4)+9(3)+15(1)+1(7)+7(4)=105. It has 6 occupied cells =m+n−1=m+n-1, 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, ui+vj=ciju_i+v_j=c_{ij} (uA+vII=2u_{A}+v_{II}=2; uA+vIII=4u_{A}+v_{III}=4; uA+vIV=3u_{A}+v_{IV}=3; uB+vIII=1u_{B}+v_{III}=1; uC+vI=4u_{C}+v_{I}=4; uC+vIII=7u_{C}+v_{III}=7); taking u=0u=0 in the row with most allocations gives the uiu_i and vjv_j shown. For each empty cell, Δij=cij−(ui+vj)\Delta_{ij}=c_{ij}-(u_i+v_j).

I II III IV Supply uiu_i
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
vjv_j 1 2 4 3

The most negative Δ\Delta 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)−. θ=\theta= smallest allocation in a “−” cell =1=1. Cost falls by θ|Δ|=1\theta\,|\Delta|=1.

Iteration 2. Total cost = 104. For the occupied cells, ui+vj=ciju_i+v_j=c_{ij} (uA+vII=2u_{A}+v_{II}=2; uA+vIII=4u_{A}+v_{III}=4; uA+vIV=3u_{A}+v_{IV}=3; uB+vIII=1u_{B}+v_{III}=1; uC+vI=4u_{C}+v_{I}=4; uC+vIV=5u_{C}+v_{IV}=5); taking u=0u=0 in the row with most allocations gives the uiu_i and vjv_j shown. For each empty cell, Δij=cij−(ui+vj)\Delta_{ij}=c_{ij}-(u_i+v_j).

I II III IV Supply uiu_i
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
vjv_j 2 2 4 3

All Δij≥0\Delta_{ij}\ge0, so this solution is optimal.

In Iteration 1 the cell (C, IV) has Δ=−1<0\Delta=-1<0, 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).

↑ Back to the question list

Explain assignment problem and transportation problem. Give its mathematical formulation.

2010 · Paper II · Q2a · 10 marks

Solution

Transportation problem. A single commodity is available at mm sources in amounts a1,…,ama_1,\dots,a_m and is required at nn destinations in amounts b1,…,bnb_1,\dots,b_n. The cost of sending one unit from source ii to destination jj is cijc_{ij}. We must decide how many units xijx_{ij} to send on each route so as to satisfy all requirements within the availabilities at minimum total cost.

Formulation: Minimise Z=∑i=1m∑j=1ncijxij\text{Minimise }Z=\sum_{i=1}^m\sum_{j=1}^nc_{ij}x_{ij} subject to∑j=1nxij=ai(i=1,…,m),∑i=1mxij=bj(j=1,…,n),xij≥0,\text{subject to}\quad\sum_{j=1}^nx_{ij}=a_i\ (i=1,\dots,m),\qquad\sum_{i=1}^mx_{ij}=b_j\ (j=1,\dots,n),\qquad x_{ij}\ge0 , with ∑iai=∑jbj\sum_ia_i=\sum_jb_j (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 m+n−1m+n-1 occupied cells and improving it by the stepping-stone or MODI method.

Assignment problem. nn jobs are to be assigned to nn persons (machines), one to one, where cijc_{ij} is the cost (or time) when person ii does job jj. We must find the assignment with minimum total cost.

Formulation: with xij=1x_{ij}=1 if person ii does job jj and 0 otherwise, Minimise Z=∑i=1n∑j=1ncijxij\text{Minimise }Z=\sum_{i=1}^n\sum_{j=1}^nc_{ij}x_{ij} subject to∑j=1nxij=1(i=1,…,n),∑i=1nxij=1(j=1,…,n),xij∈{0,1}.\text{subject to}\quad\sum_{j=1}^nx_{ij}=1\ (i=1,\dots,n),\qquad\sum_{i=1}^nx_{ij}=1\ (j=1,\dots,n),\qquad x_{ij}\in\{0,1\}. It is a special case of the transportation problem (m=nm=n, all ai=bj=1a_i=b_j=1), 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 MM.

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.

↑ Back to the question list

A firm manufacturing a single product has three plants X, Y and Z. 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 A, 45 units to customer B, 20 units to customer C, 18 units to customer D and 30 units to customer E. 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 60+35+40=13560+35+40=135 = commitments 22+45+20+18+30=13522+45+20+18+30=135.

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 =m+n−1=3+5−1=m+n-1=3+5-1. Cost = 290.

MODI test.

Iteration 1. Total cost = 290. For the occupied cells, ui+vj=ciju_i+v_j=c_{ij} (uX+vB=1u_{X}+v_{B}=1; uX+vE=4u_{X}+v_{E}=4; uY+vA=2u_{Y}+v_{A}=2; uY+vD=2u_{Y}+v_{D}=2; uZ+vA=3u_{Z}+v_{A}=3; uZ+vC=2u_{Z}+v_{C}=2; uZ+vE=4u_{Z}+v_{E}=4); taking u=0u=0 in the row with most allocations gives the uiu_i and vjv_j shown. For each empty cell, Δij=cij−(ui+vj)\Delta_{ij}=c_{ij}-(u_i+v_j).

A B C D E Supply uiu_i
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
vjv_j 3 1 2 3 4

All Δij≥0\Delta_{ij}\ge0, so this solution is optimal. (Some Δij=0\Delta_{ij}=0: (Y, E), so alternative optimal solutions exist.)

Minimum transportation cost = 290, with the schedule: X→BX\to B: 45, X→EX\to E: 15, Y→AY\to A: 17, Y→DY\to D: 18, Z→AZ\to A: 5, Z→CZ\to C: 20, Z→EZ\to E: 15.

Check: 45(1)+15(4)+17(2)+18(2)+5(3)+20(2)+15(4)=45+60+34+36+15+40+60=29045(1)+15(4)+17(2)+18(2)+5(3)+20(2)+15(4)=45+60+34+36+15+40+60=290.

✓ 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).

2010 · Paper II · Q4a · 25 marks

↑ Back to the question list

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 Min ∑i,jcijxij,∑jxij=ai,∑ixij=bj,xij≥0.\text{Min }\sum_{i,j}c_{ij}x_{ij},\qquad\sum_jx_{ij}=a_i,\quad\sum_ix_{ij}=b_j,\quad x_{ij}\ge0 . Put m=nm=n and ai=bj=1a_i=b_j=1 for all i,ji,j. The constraints become ∑jxij=1,∑ixij=1,xij≥0.\sum_jx_{ij}=1,\qquad\sum_ix_{ij}=1,\qquad x_{ij}\ge0 . With xij≥0x_{ij}\ge0 these force 0≤xij≤10\le x_{ij}\le1, and the transportation problem has integer basic feasible solutions when all aia_i, bjb_j are integers (its constraint matrix is totally unimodular). So every basic solution has xij∈{0,1}x_{ij}\in\{0,1\}: exactly one 1 in each row and each column. This is precisely the assignment problem. Hence an assignment problem is a transportation problem with nn sources and nn destinations, each of supply/demand 1. (It is highly degenerate: a BFS has 2n−12n-1 basic cells but only nn positive ones, which is why the special Hungarian method is preferred.)

Steps of the Hungarian method.

  1. Check that the matrix is square (else add dummy rows/columns of zeros).
  2. Subtract the smallest element of each row from all elements of that row.
  3. Subtract the smallest element of each column from all elements of that column.
  4. Draw the minimum number of lines through rows and columns to cover all zeros. If it equals nn, an optimal assignment exists among the zeros: go to step 6.
  5. 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.
  6. 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) < n=6n=6, 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) < n=6n=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 = nn, 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).

2009 · Paper II · Q2a · 20 marks

↑ Back to the question list

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 nn jobs and nn machines; job ii on machine jj takes time tijt_{ij}. Each job must go to one machine and each machine take one job, so that the total time is minimum. With xij=1x_{ij}=1 if job ii goes to machine jj (0 otherwise): minimise ∑∑tijxij\sum\sum t_{ij}x_{ij} subject to ∑jxij=1\sum_jx_{ij}=1, ∑ixij=1\sum_ix_{ij}=1, xij∈{0,1}x_{ij}\in\{0,1\}. 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 = nn, 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.

2006 · Paper II · Q3a · 20 marks

↑ Back to the question list

Explain the assignment problem. Show that an assignment problem can be solved by the transportation technique.

2005 · Paper II · Q3b · 20 marks

Solution

Assignment problem. Assign nn jobs to nn facilities, one-to-one, at minimum total cost: Min Z=∑i=1n∑j=1ncijxij,∑j=1nxij=1(i),∑i=1nxij=1(j),xij∈{0,1}.\text{Min }Z=\sum_{i=1}^n\sum_{j=1}^nc_{ij}x_{ij},\quad\sum_{j=1}^nx_{ij}=1\ (i),\quad\sum_{i=1}^nx_{ij}=1\ (j),\quad x_{ij}\in\{0,1\}. Examples: jobs to machines, workers to tasks, salesmen to regions, crews to flights.

It can be solved by the transportation technique.

  1. It is a transportation problem. Regard the nn facilities as sources each with supply ai=1a_i=1, and the nn jobs as destinations each with demand bj=1b_j=1, with unit cost cijc_{ij}. The transportation constraints ∑jxij=ai\sum_jx_{ij}=a_i, ∑ixij=bj\sum_ix_{ij}=b_j are then exactly the assignment constraints. The problem is balanced (∑ai=∑bj=n\sum a_i=\sum b_j=n).
  2. 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 aia_i, bjb_j). Here each xijx_{ij} is an integer with 0≤xij≤min(ai,bj)=10\le x_{ij}\le\min(a_i,b_j)=1, so xij∈{0,1}x_{ij}\in\{0,1\}. Hence the optimal transportation solution is an optimal assignment.
  3. Degeneracy. A basic feasible solution must have m+n−1=2n−1m+n-1=2n-1 basic cells, but only nn of them can carry a 1. So every BFS is degenerate, with n−1n-1 cells at zero level. To use the MODI (u–v) method we put ε\varepsilon in n−1n-1 independent empty cells, compute uiu_i, vjv_j and Δij=cij−ui−vj\Delta_{ij}=c_{ij}-u_i-v_j, and improve as usual.

Illustration. For the costs (2341)\begin{pmatrix}2&3\\4&1\end{pmatrix} (supplies and demands 1): the NWC rule gives x11=1x_{11}=1, then a tie (a1a_1 and b1b_1 both exhausted), so x21=εx_{21}=\varepsilon, and x22=1x_{22}=1. With u1=0u_1=0: v1=2v_1=2, u2=2u_2=2, v2=−1v_2=-1; Δ12=3−(0−1)=4≥0\Delta_{12}=3-(0-1)=4\ge0. Optimal: 1→1, 2→2, cost 3.

Why the Hungarian method is preferred. Because of the heavy degeneracy, the transportation method needs many ε\varepsilon 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 ε.

↑ Back to the question list

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?

2003 · Paper II · Q3b · 20 marks

Solution

Transportation problem. A product is available at mm origins (aia_i units at origin ii) and required at nn destinations (bjb_j units at destination jj), with ∑ai=∑bj\sum a_i=\sum b_j. The unit cost from ii to jj is cijc_{ij}. Find shipments xij≥0x_{ij}\ge0 with row sums aia_i and column sums bjb_j that minimise ∑∑cijxij\sum\sum c_{ij}x_{ij}. The solution has two stages: an initial basic feasible solution with m+n−1m+n-1 occupied cells, and then improvement to optimality.

(i) North-west corner method.

  1. Start at the north-west (top-left) cell (1,1)(1,1). Allocate x11=min(a1,b1)x_{11}=\min(a_1,b_1).
  2. Reduce a1a_1 and b1b_1 by this amount. If the supply of row 1 is exhausted, move down to (2,1)(2,1); if the demand of column 1 is met, move right to (1,2)(1,2); if both, move diagonally to (2,2)(2,2) (and put a zero/ε allocation in an adjacent cell to keep m+n−1m+n-1 cells).
  3. 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.

  1. 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: min(ai,bj)\min(a_i,b_j).
  2. Cross out the row or column that is satisfied and adjust the other.
  3. 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 O1,O2,O3O_1,O_2,O_3 with 30, 50, 20; destinations with 20, 40, 30, 10; costs 121433214259\begin{smallmatrix}1&2&1&4\\3&3&2&1\\4&2&5&9\end{smallmatrix}):

  • NWC: x11=20,x12=10,x22=30,x23=20,x33=10,x34=10x_{11}=20,\ x_{12}=10,\ x_{22}=30,\ x_{23}=20,\ x_{33}=10,\ x_{34}=10; cost 310.
  • Least cost: x13=30,x24=10,x32=20,x21=20,x22=20x_{13}=30,\ x_{24}=10,\ x_{32}=20,\ x_{21}=20,\ x_{22}=20; cost 200.
  • The optimum (found below) is 180.

Subsequent steps (same after either method).

  1. Check that the solution has m+n−1m+n-1 occupied cells in independent positions; if fewer (degeneracy), add ε\varepsilon to suitable empty cells.
  2. Optimality test (MODI / u–v method): find ui,vju_i,v_j with ui+vj=ciju_i+v_j=c_{ij} for every occupied cell (setting one ui=0u_i=0); compute Δij=cij−(ui+vj)\Delta_{ij}=c_{ij}-(u_i+v_j) for every empty cell. (The stepping-stone method finds the same Δij\Delta_{ij} by tracing a closed path for each empty cell.)
  3. If all Δij≥0\Delta_{ij}\ge0, the solution is optimal (Δij=0\Delta_{ij}=0 shows an alternative optimum).
  4. Otherwise, the cell with the most negative Δij\Delta_{ij} enters. Draw the closed loop through it and occupied cells, with alternate ++ and −– signs starting with ++ at the entering cell. Let θ\theta be the smallest allocation in a −– cell; add θ\theta to the ++ cells and subtract it from the −– cells. The cost falls by θ|Δij|\theta|\Delta_{ij}|.
  5. 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.

↑ Back to the question list

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 15+25+10=5015+25+10=50 = demand 5+15+15+15=505+15+15+15=50: 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 m+n−1=6m+n-1=6, because row 1 and column 2 were exhausted together; the solution is degenerate, and a zero allocation (ε\varepsilon) is kept in cell (2, 2) to make 6 occupied cells.

(The MODI method improves this to the optimum 435: 1→21\to2: 5, 1→41\to4: 10, 2→22\to2: 10, 2→32\to3: 15, 3→13\to1: 5, 3→43\to4: 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.

2003 · Paper II · Q4c · 15 marks

↑ Back to the question list

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 D1 D2 D3 D4 Supply
O1 10 2 20 11 15
O2 12 7 9 20 25
O3 4 14 16 18 10
Demand 5 15 15 15 50

Solution

Transportation problem. Given mm origins with supplies aia_i, nn destinations with demands bjb_j (∑ai=∑bj\sum a_i=\sum b_j) and unit costs cijc_{ij}, find shipments xij≥0x_{ij}\ge0 with ∑jxij=ai\sum_jx_{ij}=a_i, ∑ixij=bj\sum_ix_{ij}=b_j that minimise ∑i∑jcijxij\sum_i\sum_jc_{ij}x_{ij}.

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 =15(2)+15(9)+10(20)+5(4)+5(18)=475=15(2)+15(9)+10(20)+5(4)+5(18)=475. Only 5 cells are positive, one fewer than m+n−1=6m+n-1=6, so the solution is degenerate; we keep an ε\varepsilon allocation in cell (O2,D2)(O_2,D_2) (it forms no loop with the others).

Optimal solution (MODI method).

Iteration 1. Total cost = 475. For the occupied cells, ui+vj=ciju_i+v_j=c_{ij} (uO1+vD2=2u_{O1}+v_{D2}=2; uO2+vD2=7u_{O2}+v_{D2}=7; uO2+vD3=9u_{O2}+v_{D3}=9; uO2+vD4=20u_{O2}+v_{D4}=20; uO3+vD1=4u_{O3}+v_{D1}=4; uO3+vD4=18u_{O3}+v_{D4}=18); taking u=0u=0 in the row with most allocations gives the uiu_i and vjv_j shown. For each empty cell, Δij=cij−(ui+vj)\Delta_{ij}=c_{ij}-(u_i+v_j).

D1 D2 D3 D4 Supply uiu_i
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
vjv_j 6 7 9 20

The most negative Δ\Delta 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)−. θ=\theta= smallest allocation in a “−” cell =10=10. Cost falls by θ|Δ|=40\theta\,|\Delta|=40.

Iteration 2. Total cost = 435. For the occupied cells, ui+vj=ciju_i+v_j=c_{ij} (uO1+vD2=2u_{O1}+v_{D2}=2; uO1+vD4=11u_{O1}+v_{D4}=11; uO2+vD2=7u_{O2}+v_{D2}=7; uO2+vD3=9u_{O2}+v_{D3}=9; uO3+vD1=4u_{O3}+v_{D1}=4; uO3+vD4=18u_{O3}+v_{D4}=18); taking u=0u=0 in the row with most allocations gives the uiu_i and vjv_j shown. For each empty cell, Δij=cij−(ui+vj)\Delta_{ij}=c_{ij}-(u_i+v_j).

D1 D2 D3 D4 Supply uiu_i
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
vjv_j −3 2 4 11

All Δij≥0\Delta_{ij}\ge0, so this solution is optimal.

Optimal schedule.

Route Units Cost
O1→D2O_1\to D_2 5 10
O1→D4O_1\to D_4 10 110
O2→D2O_2\to D_2 10 70
O2→D3O_2\to D_3 15 135
O3→D1O_3\to D_1 5 20
O3→D4O_3\to D_4 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.

2002 · Paper II · Q3b · 20 marks

↑ Back to the question list

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.

1999 · Paper II · Q6a · 25 marks

Solution

Differences between the transportation and the assignment problem.

Transportation problem Assignment problem
Ships a commodity from mm sources to nn destinations Assigns nn jobs to nn facilities, one-to-one
Supply aia_i and demand bjb_j can be any non-negative numbers Every “supply” and “demand” is exactly 1
Cost matrix may be rectangular (m×nm\times n) Cost matrix must be square (n×nn\times n); dummies are added otherwise
xijx_{ij} can take any non-negative value xijx_{ij} is 0 or 1
A BFS has m+n−1m+n-1 occupied cells A solution has exactly nn assignments; as a TP it is always degenerate
Feasibility needs ∑ai=∑bj\sum a_i=\sum b_j 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 xij=1x_{ij}=1 if facility ii is assigned to job jj and 0 otherwise. Then Minimise Z=∑i=1n∑j=1ncijxij\text{Minimise }Z=\sum_{i=1}^n\sum_{j=1}^nc_{ij}x_{ij} subject to ∑j=1nxij=1(i=1,…,n),∑i=1nxij=1(j=1,…,n),xij≥0.\sum_{j=1}^nx_{ij}=1\ (i=1,\dots,n),\qquad\sum_{i=1}^nx_{ij}=1\ (j=1,\dots,n),\qquad x_{ij}\ge0 .

  • The objective and the constraints are linear, so this is an LPP with n2n^2 variables and 2n2n equality constraints (of which 2n−12n-1 are independent).
  • The integrality condition xij∈{0,1}x_{ij}\in\{0,1\} 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 0≤xij≤10\le x_{ij}\le1, 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 ai=bj=1a_i=b_j=1, 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).

↑ Back to the question list

Define assignment problem and give its mathematical formulation. Also give an algorithm to solve an assignment problem.

1998 · Paper II · Q11b · 25 marks

Solution

Assignment problem. Given nn resources (men, machines) and nn activities (jobs), with cijc_{ij} the cost (or time) of resource ii doing activity jj, assign each resource to exactly one activity and each activity to exactly one resource so that the total cost is minimum.

Mathematical formulation. Minimise Z=∑i=1n∑j=1ncijxij\text{Minimise }Z=\sum_{i=1}^n\sum_{j=1}^nc_{ij}x_{ij} subject to∑j=1nxij=1(i=1,…,n),∑i=1nxij=1(j=1,…,n),xij=0 or 1,\text{subject to}\quad\sum_{j=1}^nx_{ij}=1\ (i=1,\dots,n),\qquad\sum_{i=1}^nx_{ij}=1\ (j=1,\dots,n),\qquad x_{ij}=0\text{ or }1, where xij=1x_{ij}=1 means resource ii is assigned to activity jj.

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 ≥0\ge0 and an assignment can be made entirely in zero cells, it has total reduced cost 0 and is therefore optimal.

Hungarian algorithm (Kuhn, 1955).

  1. 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 MM.
  2. Row reduction. Subtract the minimum element of each row from every element of that row.
  3. 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.
  4. 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).
  5. Optimality test. If the number of lines equals nn, an optimal assignment exists among the zeros: go to step 7.
  6. Revise. Let θ\theta be the smallest element not covered by any line. Subtract θ\theta from all uncovered elements, add θ\theta to elements at intersections of two lines, leave the other covered elements unchanged. Go to step 4.
  7. 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 nn assignments are made (if a cycle of zeros remains, choose any one zero arbitrarily — this gives alternative optima).
  8. The total cost is the sum of the original cijc_{ij} 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).

↑ Back to the question list

Explain any one method for solving a transportation problem. Would you recommend this method to solve an assignment problem?

1998 · Paper II · Q11c · 20 marks

Solution

One method: Vogel’s approximation method (VAM) with the MODI test.

Initial solution (VAM).

  1. Balance the problem (add a dummy source or destination with zero costs if ∑ai≠∑bj\sum a_i\ne\sum b_j).
  2. For every row and every column, compute the penalty = difference between its smallest and second-smallest cost.
  3. Select the row or column with the largest penalty (ties broken arbitrarily or by the smallest cost).
  4. In it, allocate as much as possible, min(ai,bj)\min(a_i,b_j), to the cell with the lowest cost.
  5. 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).

  1. With m+n−1m+n-1 occupied cells, find uiu_i, vjv_j from ui+vj=ciju_i+v_j=c_{ij} on occupied cells (put one ui=0u_i=0).
  2. Compute Δij=cij−ui−vj\Delta_{ij}=c_{ij}-u_i-v_j for empty cells. If all Δij≥0\Delta_{ij}\ge0, the solution is optimal.
  3. Otherwise enter the cell with the most negative Δij\Delta_{ij}, form the closed loop, shift θ\theta (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 2n−12n-1 occupied cells, but only nn of them can be 1; the other n−1n-1 are zeros. Every solution is therefore highly degenerate.
  • With VAM/MODI we would have to insert n−1n-1 ε\varepsilon-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.

↑ Back to the question list

Explain the transportation problem. Show that a finite minimum feasible solution always exists in this case.

1997 · Paper II · Q11a · 20 marks

Solution

Transportation problem. Minimise Z=∑i=1m∑j=1ncijxijZ=\sum_{i=1}^m\sum_{j=1}^nc_{ij}x_{ij} subject to ∑j=1nxij=ai(i=1,…,m),∑i=1mxij=bj(j=1,…,n),xij≥0,\sum_{j=1}^nx_{ij}=a_i\ (i=1,\dots,m),\qquad\sum_{i=1}^mx_{ij}=b_j\ (j=1,\dots,n),\qquad x_{ij}\ge0, with ai>0a_i>0, bj>0b_j>0 and ∑iai=∑jbj=T\sum_ia_i=\sum_jb_j=T (balanced). It describes the shipment of a commodity from mm sources to nn destinations at minimum total cost.

Theorem. A balanced transportation problem always has a finite minimum feasible solution.

Step 1: a feasible solution exists. Put xij=aibj/Tx_{ij}=a_ib_j/T. Then xij≥0x_{ij}\ge0, ∑jxij=aiT/T=ai\sum_jx_{ij}=a_iT/T=a_i and ∑ixij=bjT/T=bj\sum_ix_{ij}=b_jT/T=b_j. So the feasible set SS is non-empty.

Step 2: the feasible set is bounded. For any feasible solution, every xij≥0x_{ij}\ge0 and xij≤∑kxik=ai,xij≤∑kxkj=bj,x_{ij}\le\sum_kx_{ik}=a_i,\qquad x_{ij}\le\sum_kx_{kj}=b_j , so 0≤xij≤min(ai,bj)0\le x_{ij}\le\min(a_i,b_j). Thus SS 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. ZZ is a linear (hence continuous) function on the non-empty, closed and bounded set SS, so it attains a minimum value, which is finite: ∑i,jcijxij≥−∑i,j|cij|min(ai,bj)>−∞.\sum_{i,j}c_{ij}x_{ij}\ \ge\ -\sum_{i,j}|c_{ij}|\min(a_i,b_j)>-\infty . (If all cij≥0c_{ij}\ge0, simply Z≥0Z\ge0.) 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 m+n−1m+n-1 positive xijx_{ij}.

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.

↑ Back to the question list

Describe and justify the algorithm used to find the optimal solution for a transportation problem by the modified stepping stone method.

1997 · Paper II · Q11b · 20 marks

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 m+n−1m+n-1 occupied (basic) cells in independent positions (no closed loop among them).

Algorithm.

  1. Initial BFS by NWC, least cost or VAM. If there are fewer than m+n−1m+n-1 occupied cells, add ε\varepsilon to independent empty cells.
  2. Find uiu_i and vjv_j. For every occupied cell, ui+vj=ciju_i+v_j=c_{ij}. These are m+n−1m+n-1 equations in m+nm+n unknowns; put one of them (say the uiu_i of the row with most allocations) equal to 0 and solve the rest one by one.
  3. Opportunity costs. For every empty cell compute Δij=cij−(ui+vj).\Delta_{ij}=c_{ij}-(u_i+v_j).
  4. Optimality test. If all Δij≥0\Delta_{ij}\ge0, the current solution is optimal (a Δij=0\Delta_{ij}=0 shows an alternative optimum). Stop.
  5. Entering cell. Choose the empty cell with the most negative Δij\Delta_{ij}.
  6. 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 −–.
  7. Reallocate. Let θ\theta = the smallest allocation at a −– corner. Add θ\theta 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 ε\varepsilon). The cost falls by θ|Δij|\theta|\Delta_{ij}|. Go to step 2.

Justification.

  • uiu_i, vjv_j are dual variables. The dual of the transportation problem is: maximise ∑aiui+∑bjvj\sum a_iu_i+\sum b_jv_j subject to ui+vj≤ciju_i+v_j\le c_{ij}, ui,vju_i,v_j unrestricted (the primal constraints are equalities). For the current basis, complementary slackness requires ui+vj=ciju_i+v_j=c_{ij} on basic cells — exactly step 2. Since one of the m+nm+n equations of the primal is redundant, one dual variable may be fixed arbitrarily.
  • Δij\Delta_{ij} is the net change in cost per unit shipped through cell (i,j)(i,j). Sending one unit into (i,j)(i,j) requires ±1\pm1 changes at the corners of its loop (to keep row and column totals). The cost change is cij−cik+clk−…c_{ij}-c_{ik}+c_{lk}-\dots; substituting cpq=up+vqc_{pq}=u_p+v_q for every occupied corner, all uu’s and vv’s cancel except ui+vju_i+v_j, leaving cij−(ui+vj)=Δijc_{ij}-(u_i+v_j)=\Delta_{ij}. So Δij\Delta_{ij} equals the stepping-stone evaluation of that cell, found without tracing a loop for each cell.
  • Optimality. If all Δij≥0\Delta_{ij}\ge0, then ui+vj≤ciju_i+v_j\le c_{ij} for every cell: (u,v)(u,v) is dual feasible, and the primal and dual objectives are equal (∑cijxij=∑(ui+vj)xij=∑aiui+∑bjvj\sum c_{ij}x_{ij}=\sum(u_i+v_j)x_{ij}=\sum a_iu_i+\sum b_jv_j over basic cells). By the duality theorem the solution is optimal. If some Δij<0\Delta_{ij}<0, shipping through that cell reduces cost, so it is not optimal.
  • Feasibility and termination. θ\theta is the largest shift that keeps all allocations non-negative; the new solution again has m+n−1m+n-1 independent cells. The cost strictly decreases when θ>0\theta>0, so (apart from degenerate cycling, which is avoided by careful ε\varepsilon 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).

↑ Back to the question list

Define a transportation problem with m sources and n destinations. Show that in such a problem only (m+n−1) restrictions are linearly independent.

1996 · Paper II · Q11a · 20 marks

Solution

Transportation problem with mm sources and nn destinations. Minimise ∑i=1m∑j=1ncijxijsubject to∑j=1nxij=ai(i=1,…,m),∑i=1mxij=bj(j=1,…,n),xij≥0,\text{Minimise }\sum_{i=1}^m\sum_{j=1}^nc_{ij}x_{ij}\quad\text{subject to}\quad\sum_{j=1}^nx_{ij}=a_i\ (i=1,\dots,m),\quad\sum_{i=1}^mx_{ij}=b_j\ (j=1,\dots,n),\quad x_{ij}\ge0, with ∑ai=∑bj\sum a_i=\sum b_j. There are mnmn variables and m+nm+n equality constraints.

Theorem. Exactly m+n−1m+n-1 of the m+nm+n constraints are linearly independent.

Write the constraints as AX=dAX=d, where X=(x11,…,x1n,x21,…,xmn)TX=(x_{11},\dots,x_{1n},x_{21},\dots,x_{mn})^T, d=(a1,…,am,b1,…,bn)Td=(a_1,\dots,a_m,b_1,\dots,b_n)^T, and AA is (m+n)×mn(m+n)\times mn. The column of xijx_{ij} in AA is ei+em+je_i+e_{m+j} (a 1 in supply row ii and a 1 in demand row jj).

(a) At most m+n−1m+n-1 are independent. Let R1,…,RmR_1,\dots,R_m be the supply rows of AA and S1,…,SnS_1,\dots,S_n the demand rows. Each variable xijx_{ij} appears once in ∑iRi\sum_iR_i and once in ∑jSj\sum_jS_j, so ∑i=1mRi=∑j=1nSj(both are the all-ones row),\sum_{i=1}^mR_i=\sum_{j=1}^nS_j\quad(\text{both are the all-ones row}), and, by the balance condition, the right-hand sides also agree: ∑ai=∑bj\sum a_i=\sum b_j. Hence any one constraint is the sum of the supply constraints minus the other demand constraints: it is redundant. So the rank of AA (and of the augmented matrix) is at most m+n−1m+n-1.

(b) m+n−1m+n-1 are independent. Delete the last demand constraint (j=nj=n) and consider the (m+n−1)(m+n-1) columns of the variables x1n,x2n,…,xmnandx11,x12,…,x1,n−1.x_{1n},x_{2n},\dots,x_{mn}\quad\text{and}\quad x_{11},x_{12},\dots,x_{1,n-1}. Restricted to the remaining m+n−1m+n-1 rows (supply rows 1..m1..m, demand rows 1..n−11..n-1):

  • the column of xinx_{in} has a single 1, in supply row ii (its demand row nn was deleted);
  • the column of x1jx_{1j} (j≤n−1j\le n-1) has 1s in supply row 1 and demand row jj.

Order the rows as (demand 1,…,n−11,\dots,n-1; supply 1,…,m1,\dots,m) and the columns as (x11,…,x1,n−1x_{11},\dots,x_{1,n-1}; x1n,…,xmnx_{1n},\dots,x_{mn}). The resulting square matrix is (In−10*Im),\begin{pmatrix}I_{n-1}&0\\ \ast&I_m\end{pmatrix}, which is lower block-triangular with identity blocks, so its determinant is 1. Hence these m+n−1m+n-1 rows are linearly independent.

Conclusion. The rank of the coefficient matrix is exactly m+n−1m+n-1: only m+n−1m+n-1 of the m+nm+n constraints are independent. Consequently a basic feasible solution has m+n−1m+n-1 basic variables (occupied cells), and in the MODI method one of the m+nm+n dual variables ui,vju_i,v_j 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).

↑ Back to the question list

Prove that a transportation problem can never have unbounded solutions.

1996 · Paper II · Q11b · 20 marks

Solution

Theorem. A (balanced) transportation problem cannot have an unbounded solution.

Problem. Minimise Z=∑i,jcijxijZ=\sum_{i,j}c_{ij}x_{ij} subject to ∑jxij=ai\sum_jx_{ij}=a_i (i=1,…,mi=1,\dots,m), ∑ixij=bj\sum_ix_{ij}=b_j (j=1,…,nj=1,\dots,n), xij≥0x_{ij}\ge0, where ai,bj≥0a_i,b_j\ge0 and ∑ai=∑bj\sum a_i=\sum b_j.

Proof.

  1. Every variable is bounded. For any feasible solution, all xij≥0x_{ij}\ge0, so each one is at most the total of its row and of its column: 0≤xij≤∑k=1nxik=ai,0≤xij≤∑k=1mxkj=bj.0\le x_{ij}\le\sum_{k=1}^nx_{ik}=a_i,\qquad 0\le x_{ij}\le\sum_{k=1}^mx_{kj}=b_j . Hence 0≤xij≤min(ai,bj)for all i,j.0\le x_{ij}\le\min(a_i,b_j)\quad\text{for all }i,j .
  2. The objective is bounded. Therefore |Z|=|∑i,jcijxij|≤∑i,j|cij|min(ai,bj)=K<∞.|Z|=\Big|\sum_{i,j}c_{ij}x_{ij}\Big|\le\sum_{i,j}|c_{ij}|\min(a_i,b_j)=K<\infty . So ZZ can neither decrease to −∞-\infty nor increase to +∞+\infty over the feasible set.
  3. The feasible set is non-empty when ∑ai=∑bj\sum a_i=\sum b_j (e.g. xij=aibj/∑aix_{ij}=a_ib_j/\sum a_i), and it is closed and bounded, so the continuous function ZZ 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 D≥0D\ge0, D≠0D\ne0, with AD=0AD=0; but AD=0AD=0 means all row and column sums of DD are 0, which with D≥0D\ge0 forces D=0D=0.) ∎

Note also that with cij≥0c_{ij}\ge0 (costs), Z≥0Z\ge0, 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.

↑ Back to the question list

Outline the Hungarian method of solving an assignment problem.

1996 · Paper II · Q11c · 20 marks

Solution

Assignment problem. Assign nn jobs to nn facilities, one to one, minimising ∑cijxij\sum c_{ij}x_{ij} 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).

  1. 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 MM.
  2. Row reduction. Subtract the smallest element of each row from every element of that row.
  3. Column reduction. Subtract the smallest element of each column from every element of that column.
  4. 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.
  5. Test. If the number of lines =n=n, the assignments marked form an optimal solution: go to step 7.
  6. Revise the matrix. Find the smallest uncovered element θ\theta. Subtract θ\theta from all uncovered elements; add θ\theta to elements lying at the intersection of two lines; leave the others unchanged. Return to step 4.
  7. 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 nn independent zeros exists, there are alternative optima.

Illustration. Costs (9278643758187694)\begin{pmatrix}9&2&7&8\\6&4&3&7\\5&8&1&8\\7&6&9&4\end{pmatrix}: 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 2+6+1+4=132+6+1+4=13.

✓ 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).

↑ Back to the question list

More on Optimization Techniques

Questions: UPSC Civil Services (Main) Examination, Statistics Paper II, 1996–2026. Solutions: Optional Province. Found an error? Tell us.

Spotted an error? Tell us.

We classify every PYQ with care, but mistakes can slip in. If a question is in the wrong topic, has a typo, the wrong year, or is missing, let us know. We review every report and update the page.

Report an Error
Subscribe
Notify of
guest

0 Comments
Oldest
Newest Most Voted