Or Midterm Solutions2023
Or Midterm Solutions2023
Operations Research
Fall 2023
Solutions
General note: if a student does not write Answer (optimal plan and optimal value
of the objective function), full score is not provided. If this student provided full
solution but not the Answer, the score is full score minus 2 points.
At first we select x3, x4 as basic variables. We put non-basic variables to 0. The first basic plan is X 0
= (0,0,22,39). Now, we build the simplex table. [2 points]
B x1 x 2 x 3 x4
x3 22 3 2 1 0
x4 39 5 4 0 1
F(X) 0 -10 -7 0 0
This plan is not optimal as there are negative numbers in the last row
We select a new basic variable by choosing the column with the smallest number in the last
row. It corresponds to variable x1. [2 points]
We choose the basic variable to become non-basic calculating divisions and selecting the
minimum value:
min (22 : 3 , 39 : 5 ) = 22/3
We divide the first row by the selected number (3). We apply Gauss-Jordan elimination process to
eliminate x1 from other equations:
B x1 x2 x3 x4
22 : 3 3:3 2:3 1:3 0:3
39-(22*5):3 5-(3*5):3 4-(2*5):3 0-(1*5):3 1-(0*5):3
0-(22*-10):3 -10-(3*-10):3 -7-(2*-10):3 0-(1*-10):3 0-(0*-10):3
We get a new simplex table:
B x1 x2 x3 x4
x1 22/3 1 2/3 1/3 0
x4 7/3 0 2/3 -5/3 1
F(X) 220/3 0 -1/3 10/3 0
This plan is not optimal as there are negative numbers in the last row
We select a new basic variable by choosing the column with the smallest number in the last
row. It corresponds to variable x2. [2 points]
We choose the basic variable to become non-basic calculating divisions and selecting the
minimum value:
min (22/3 : 2/3 , 7/3 : 2/3 ) = 7/2 [2 points]
Hence, we replace x4 with x2.
B x1 x2 x3 x4 min
x1 22/3 1 2/3 1/3 0 11
x4 7/3 0 2/3 -5/3 1 7/2
F(X) 220/3 0 -1/3 10/3 0
Now, we recalculate simplex table. [4 points]
We divide the first row by the selected number (2/3). We apply Gauss-Jordan elimination process to
eliminate x2 from other equations:
B x1 x2 x3 x4
22
/3-(7/3*2/3):2/3 1-(0*2/3):2/3 2
/3-(2/3*2/3):2/3 1
/3-(-5/3*2/3):2/3 0-(1*2/3):2/3
7
/3 : 2/3 0 : 2/3 2
/3 : 2/3 -5
/3 : 2/3 1 : 2/3
220
/3-(7/3*-1/3):2/3 0-(0*-1/3):2/3 -1
/3-(2/3*-1/3):2/3 10
/3-(-5/3*-1/3):2/3 0-(1*-1/3):2/3
We get a new simplex table:
B x1 x2 x3 x4
x1 5 1 0 2 -1
x2 7/2 0 1 -5/2 3/2
F(X) 149/2 0 0 5/2 1/2
As we do not have negative numbers in the last row, this plan is optimal. The optimal plan is
x1 = 5, x2 = 7/2
The maximum value is F(X) = 10*5 + 7*7/2 = 149/2
Note: Below we show detailed reasoning to find the first basic plan. It was not
required by the task as during lessons we showed how to do this within a limited
space of just two tables. 7 points are granted for any proper first basic plan (not only
obtained using Vogel’s method). The criteria is that the sums in each column and each
row must match supply and demand. If the sum is not equal to the constraint, such
plan is considered wrong and grants 0 points.
1. We find the difference between the minimum and the second minimum numbers in each row and
column;
2. We find the largest value among them.
3. We select the minimum number in the chosen row/column and fill it with maximum possible
plan.
For row N=1 the first minimum is min11 = 4, the second minimum is min21 = 7. Their difference is
d = min21 - min11 = 3.
For row N=2 the first minimum is min12 = 3, the second minimum is min22 = 3. Their difference is
d = min22 - min12 = 0.
For row N=3 the first minimum is min13 = 3, the second minimum is min23 = 8. Their difference is
d = min23 - min13 = 5.
For row N=4 the first minimum is min14 = 6, the second minimum is min24 = 10. Their difference
is d = min24 - min14 = 4.
For column N=1 the first minimum is min11 = 3. the second minimum is min21 5. Their difference
is d = min21 - min11 = 2.
For column N=2 the first minimum is min12 = 3. the second minimum is min22 15. Their difference
is d = min22 - min12 = 12.
For column N=3 the first minimum is min13 = 7. the second minimum is min23 8. Their difference
is d = min23 - min13 = 1.
For column N=4 the first minimum is min14 = 9. the second minimum is min24 10. Their difference
is d = min24 - min14 = 1.
For column N=5 the first minimum is min15 = 3. the second minimum is min25 4. Their difference
is d = min25 - min15 = 1.
We find the largest difference in column (2). In this column the minimum value is in the cell of row
(2) and column (2).
B1 B2 B3 B4 B5 Differences
A1 10 18 7 16 4 25 3
A2 5 3 12 19 3 25 0
A3 3 17 8 9 13 25 5
A4 21 15 17 10 6 25 4
23 9 23 22 23
Differences 2 12 1 1 1
We select c22=3. For this element supply is 25, demand is 9. As the minimum of them is 9, we
subtract this value from both.
x22 = min(25,9) = 9.
10 x 7 16 4 25
5 3 12 19 3 25 - 9 = 16
3 x 8 9 13 25
21 x 17 10 6 25
23 9-9=0 23 22 23
For row N=1 the first minimum is min11 = 4, the second minimum is min21 = 7. Their difference is
d = min21 - min11 = 3.
For row N=2 the first minimum is min12 = 3, the second minimum is min22 = 5. Their difference is
d = min22 - min12 = 2.
For row N=3 the first minimum is min13 = 3, the second minimum is min23 = 8. Their difference is
d = min23 - min13 = 5.
For row N=4 the first minimum is min14 = 6, the second minimum is min24 = 10. Their difference
is d = min24 - min14 = 4.
For column N=1 the first minimum is min11 = 3. the second minimum is min21 5. Their difference
is d = min21 - min11 = 2.
For column N=3 the first minimum is min13 = 7. the second minimum is min23 8. Their difference
is d = min23 - min13 = 1.
For column N=4 the first minimum is min14 = 9. the second minimum is min24 10. Their difference
is d = min24 - min14 = 1.
For column N=5 the first minimum is min15 = 3. the second minimum is min25 4. Their difference
is d = min25 - min15 = 1.
We find the largest difference in row (3). In this row the minimum value is in the cell of row (3) and
column (1).
B1 B2 B3 B4 B5 Supply Differences
A1 10 18 7 16 4 25 3
A2 5 3 12 19 3 16 2
A3 3 17 8 9 13 25 5
A4 21 15 17 10 6 25 4
Demand 23 [-] 23 22 23
Differences 2 - 1 1 1
We select c31=3. For this element supply is 25, demand is 23. As the minimum of them is 23, we
subtract this value from both.
x31 = min(25,23) = 23.
x x 7 16 4 25
x 3 12 19 3 16
3 x 8 9 13 25 - 23 = 2
x x 17 10 6 25
23 - 23 = 0 [-] 23 22 23
For row N=1 the first minimum is min11 = 4, the second minimum is min21 = 7. Their difference is
d = min21 - min11 = 3.
For row N=2 the first minimum is min12 = 3, the second minimum is min22 = 12. Their difference
is d = min22 - min12 = 9.
For row N=3 the first minimum is min13 = 8, the second minimum is min23 = 9. Their difference is
d = min23 - min13 = 1.
For row N=4 the first minimum is min14 = 6, the second minimum is min24 = 10. Their difference
is d = min24 - min14 = 4.
For column N=3 the first minimum is min13 = 7. the second minimum is min23 8. Their difference
is d = min23 - min13 = 1.
For column N=4 the first minimum is min14 = 9. the second minimum is min24 10. Their difference
is d = min24 - min14 = 1.
For column N=5 the first minimum is min15 = 3. the second minimum is min25 4. Their difference
is d = min25 - min15 = 1.
We find the largest difference inстроке (2). In this row the minimum value is in the cell of row (2)
and column (5).
B1 B2 B3 B4 B5 Supply Differences
A1 10 18 7 16 4 25 3
A2 5 3 12 19 3 16 9
A3 3 17 8 9 13 2 1
A4 21 15 17 10 6 25 4
Demand [-] [-] 23 22 23
Differences - - 1 1 1
We select c25=3. For this element supply is 16, Demand 23. As the minimum of them is 16, we
subtract this value from both.
x25 = min(16,23) = 16.
x x 7 16 4 25
x 3 x x 3 16 - 16 = 0
3 x 8 9 13 2
x x 17 10 6 25
[-] [-] 23 22 23 - 16 = 7
For row N=1 the first minimum is min11 = 4, the second minimum is min21 = 7. Their difference is
d = min21 - min11 = 3.
For row N=3 the first minimum is min13 = 8, the second minimum is min23 = 9. Their difference is
d = min23 - min13 = 1.
For row N=4 the first minimum is min14 = 6, the second minimum is min24 = 10. Their difference
is d = min24 - min14 = 4.
For column N=3 the first minimum is min13 = 7. the second minimum is min23 8. Their difference
is d = min23 - min13 = 1.
For column N=4 the first minimum is min14 = 9. the second minimum is min24 10. Their difference
is d = min24 - min14 = 1.
For column N=5 the first minimum is min15 = 4. the second minimum is min25 6. Their difference
is d = min25 - min15 = 2.
We find the largest difference in row (4). In this row the minimum value is in the cell of row (4) and
column (5).
B1 B2 B3 B4 B5 Supply Differences
A1 10 18 7 16 4 25 3
A2 5 3 12 19 3 [-] -
A3 3 17 8 9 13 2 1
A4 21 15 17 10 6 25 4
Demand [-] [-] 23 22 7
Differences - - 1 1 2
We select c45=6. For this element supply is 25, Demand 7. As the minimum of them is 7, we
subtract this value from both.
x45 = min(25,7) = 7.
x x 7 16 x 25
x 3 x x 3 [-]
3 x 8 9 x 2
x x 17 10 6 25 - 7 = 18
[-] [-] 23 22 7 - 7 = 0
For row N=1 the first minimum is min11 = 7, the second minimum is min21 = 16. Their difference
is d = min21 - min11 = 9.
For row N=3 the first minimum is min13 = 8, the second minimum is min23 = 9. Their difference is
d = min23 - min13 = 1.
For row N=4 the first minimum is min14 = 10, the second minimum is min24 = 17. Their difference
is d = min24 - min14 = 7.
Находим Differences.
For column N=3 the first minimum is min13 = 7. the second minimum is min23 8. Their difference
is d = min23 - min13 = 1.
For column N=4 the first minimum is min14 = 9. the second minimum is min24 10. Their difference
is d = min24 - min14 = 1.
We find the largest difference in row (1). In this row the minimum value is in the cell of row (1) and
column(3).
B1 B2 B3 B4 B5 Supply Differences
A1 10 18 7 16 4 25 9
A2 5 3 12 19 3 [-] -
A3 3 17 8 9 13 2 1
A4 21 15 17 10 6 18 7
Demand [-] [-] 23 22 [-]
Differences - - 1 1 -
We select c13=7. For this element supply is 25, Demand 23. As the minimum of them is 23, we
subtract this value from both.
x13 = min(25,23) = 23.
x x 7 16 x 25 - 23 = 2
x 3 x x 3 [-]
3 x x 9 x 2
x x x 10 6 18
[-] [-] 23 - 23 = 0 22 [-]
For row N=1 the first minimum is min11 = 16, the second minimum is min21 = 16. Their difference
is d = min21 - min11 = 0.
For row N=3 the first minimum is min13 = 9, the second minimum is min23 = 9. Their difference is
d = min23 - min13 = 0.
For row N=4 the first minimum is min14 = 10, the second minimum is min24 = 10. Their difference
is d = min24 - min14 = 0.
For column N=4 the first minimum is min14 = 9. the second minimum is min24 10. Their difference
is d = min24 - min14 = 1.
We find the largest difference inстолбцу (4). In this column the minimum value is in the cell of row
(3) and column (4).
B1 B2 B3 B4 B5 Supply Differences
A1 10 18 7 16 4 2 0
A2 5 3 12 19 3 [-] -
A3 3 17 8 9 13 2 0
A4 21 15 17 10 6 18 0
Demand [-] [-] [-] 22 [-]
Differences - - - 1 -
We select c34=9. For this element supply is 2, Demand 22. As the minimum of them is 2, we
subtract this value from both.
x34 = min(2,22) = 2.
x x 7 16 x 2
x 3 x x 3 [-]
3 x x 9 x 2-2=0
x x x 10 6 18
[-] [-] [-] 22 - 2 = 20 [-]
For row N=1 the first minimum is min11 = 16, the second minimum is min21 = 16. Their difference
is d = min21 - min11 = 0.
For row N=4 the first minimum is min14 = 10, the second minimum is min24 = 10. Their difference
is d = min24 - min14 = 0.
For column N=4 the first minimum is min14 = 10. the second minimum is min24 16. Their
difference is d = min24 - min14 = 6.
We find the largest difference inстолбцу (4). In this column the minimum value is in the cell of row
(4) and column (4).
B1 B2 B3 B4 B5 Supply Differences
A1 10 18 7 16 4 2 0
A2 5 3 12 19 3 [-] -
A3 3 17 8 9 13 [-] -
A4 21 15 17 10 6 18 0
Demand [-] [-] [-] 20 [-]
Differences - - - 6 -
We select c44=10. For this element supply is 18, Demand 20. As the minimum of them is 18, we
subtract this value from both.
x44 = min(18,20) = 18.
x x 7 16 x 2
x 3 x x 3 [-]
3 x x 9 x [-]
x x x 10 6 18 - 18 = 0
[-] [-] [-] 20 - 18 = 2 [-]
For row N=1 the first minimum is min11 = 16, the second minimum is min21 = 16. Their difference
is d = min21 - min11 = 0.
For column N=4 the first minimum is min14 = 16. the second minimum is min24 16. Their
difference is d = min24 - min14 = 0.
We find the largest difference inстроке (1). In this row the minimum value is in the cell of row (1)
and column (4).
B1 B2 B3 B4 B5 Supply Differences
A1 10 18 7 16 4 2 0
A2 5 3 12 19 3 [-] -
A3 3 17 8 9 13 [-] -
A4 21 15 17 10 6 [-] -
Demand [-] [-] [-] 2 [-]
Differences - - - 0 -
We select c14=16. For this element supply is 2, Demand 2. As the minimum of them is 2, we
subtract this value from both.
x14 = min(2,2) = 2.
x x 7 16 x 2-2=0
x 3 x x 3 [-]
3 x x 9 x [-]
x x x 10 6 [-]
[-] [-] [-] 2 - 2 = 0 [-]
B1 B2 B3 B4 B5 Supply
A1 10 18 7[23] 16[2] 4 25
A2 5 3[9] 12 19 3[16] 25
A3 3[23] 17 8 9[2] 13 25
A4 21 15 17 10[18] 6[7] 25
Demand 23 9 23 22 23
We got the basic plan. It is non-degenerate as the number of occupied cells is m + n - 1 = 8. The
value of the objective function is F(x) = 7*23 + 16*2 + 3*9 + 3*16 + 3*23 + 9*2 + 10*18 + 6*7 =
577
Now, we calculate potentials ui, vj. We use ui + vj = cij for only occupied cells and put u1 = 0.
Note: finding potentials is very important. Even though we got some first basic plan,
we cannot claim that this plan is optimal without proper justification. Potentials
provide not only proof for optimal plan but also help to determine where the plan
should be changed to achieve optimality. If potentials were not found, the solution
will get only marks for finding first basic plan if it was found. No more grades are not
granted in case potentials are not calculated. Potentials are found using selected cells’
costs, not the amount of goods transported.
u1 + v3 = 7; 0 + v3 = 7; v3 = 7 [6 points for finding potentials]
u1 + v4 = 16; 0 + v4 = 16; v4 = 16
u3 + v4 = 9; 16 + u3 = 9; u3 = -7
u3 + v1 = 3; -7 + v1 = 3; v1 = 10
u4 + v4 = 10; 16 + u4 = 10; u4 = -6
u4 + v5 = 6; -6 + v5 = 6; v5 = 12
u2 + v5 = 3; 12 + u2 = 3; u2 = -9
u2 + v2 = 3; -9 + v2 = 3; v2 = 12
v1=10 v2=12 v3=7 v4=16 v5=12
u1=0 10 18 7[23] 16[2] 4
u2=-9 5 3[9] 12 19 3[16]
u3=-7 3[23] 17 8 9[2] 13
u4=-6 21 15 17 10[18] 6[7]
The plan is not optimal as there are unoccupied cells where ui + vj > cij:
(1;5): 0 + 12 > 4; ∆15 = 0 + 12 - 4 = 8 > 0
We select the cell with the largest offset (1;5): 4
Now, we build a closed cycle using this cell and some of occupied cells only. We label the selected
cell with «+», then we vary the labels «-», «+», «-» in the following cells along the cycle. [6 points]
1 2 3 4 5 Supply
1 10 18 7[23] 16[2][-] 4[+] 25
2 5 3[9] 12 19 3[16] 25
3 3[23] 17 8 9[2] 13 25
4 21 15 17 10[18][+] 6[7][-] 25
Demand 23 9 23 22 23