Линейное программирование. Практикум. Учебное пособие для бакалавриата
.pdf
4. SIMPLEX METHOD
The simplex method was invented by George Dantzig in 1941. This method is used if the following conditions fulfilled.
1) A linear programming problem is written in the canonicals form.
2)The system of main constrains is solved by JordanGauss method so we know basic and free variables.
3)The free terms of main constrains are non-negative.
4)The objective function is expressed in terms of the free variables.
Thus, the linear programming problem has the following form.
f = −γr +1xr +1 −γr +2xr +2 − −γnxn +γ0 → max(min)
x1 +a1,r +1xr +1 +a1,r +2xr +2 +a1nxn = b1, |
|
|
|
|
x2 +a2,r +1xr +1 +a2,r +2xr +2 +a2nxn = b2, |
|
(4) |
||
................................................................. |
||||
|
|
|
|
|
|
|
|
|
|
xr +ar,r +1xr +1 +ar,r +2xr +2 +ar,nxn = br |
, |
|
|
|
x1 ≥ 0,x2 ≥ |
0, ,xn ≥ 0. |
|
|
|
|
|
|
|
|
where x1; ;xr |
are the basic variables, xr +1; ;xn |
are the |
||
free variables, bi ≥ 0 (i =1; ;r ). |
problem |
(4) |
has |
|
Remark. The linear programming |
||||
a feasible solution (we will call it the basic solution)
X1 = (b1,b2, ,br ,0, ,0)≥ 0 .
This solution is obtained from the constraints under the assumption that all free variables are equal to zero.
— 31 —
4. simplex method
The basic solution X1 is a corner point (a vertex) of the feasible region.
Example. Find the basic solution of the linear programming problem.
f =2x3 +x4 +3 → max
x1 +4x3 −2x4 = 4,x2 +5x3 +3x4 =5,
xi ≥ 0, i =1;2;3;4.
Solution.
If we substitute in the main constraints that
x3 = 0,x4 = 0.
We get
x1 = 4,x2 =5.
So
X1 = (4,5,0,0)≥ 0.
And
f (X1 )= f (4,5,0,0)= 3 .
Remark. From a geometric point of view the main idea of the simplex method is moving from one corner point (a basic solution) of the feasible region to another corner point to improve the value of the objective function until it will be reached the optimum.
— 32 —
4. simplex method
Fig. 6
Remark. The objective function can be reduced to the form
f +γr +1xr +1 +γr +2xr +2 + +γnxn = γ0
The data of the linear programming problem (1.5) can be written in the table (called the simplex table) as follows.
x1 |
|
b1 |
|
1 |
0 |
0 |
0 a1,r +1 |
a1j |
a1n |
|
|
|
|||||||||
x2 |
|
b2 |
|
0 |
1 |
0 |
0 |
a2,r +1 |
α2j |
α2n |
|
|
|
|
|
|
|||||
xk |
|
bk |
|
0 |
0 |
1 |
0 |
ak,r +1 |
akj |
akn |
|
|
|
|
|
|
|||||
xr |
|
br |
|
0 |
0 |
0 |
1 |
ar,r +1 |
arj |
arn |
f |
|
γ0 |
|
0 |
0 |
0 |
0 |
γr +1 |
γj |
γn |
— 33 —
4. simplex method
Definition. The coefficient γj in the row corresponding objective function (the index row) at the intersection with the column corresponding to the free variable xj is called the evaluation of the free variable xj .
Algorithm of the simplex method (maximum)
1)Choose j-th pivot column from the condition: the evaluation γj < 0 and at least one element aij > 0 ;
2)Choose k-th pivot row from the condition:
b |
|
|
|
|
b |
|
|
||
k |
= min |
i |
for |
aij > 0 ; |
akj |
|
|||
aij |
|
|||
|
|
|
|
|
3)Recalculate the elements of the simplex table by using the Jordan-Gauss algorithm.
4)Repeat step 1.
Remark. |
The pivot akj is positive. |
||
Remark. All elements of the simplex table are |
|||
recalculated by using «the rectangle rule»: |
|||
a) |
aim |
aij |
|
|
|
|
|
|
akm |
akj |
|
a |
′ = |
akjaim −aijakm |
; i ≠ k |
|||
|
|
|||||
im |
|
|
akj |
|
|
|
|
|
|
|
|
||
|
akm′ = |
akm |
≥ 0 . |
|||
|
a |
|||||
|
|
|
|
|
|
|
|
|
|
|
kj |
|
|
b) |
|
bi |
aij |
|||
|
|
|
|
|
||
|
|
bk |
akj |
|||
bi′ = akjbia−kjaijbk ; i ≠ k
— 34 —
4. simplex method
bk′ = bk ≥ 0 .
akj
After the recalculation or before it there are possible three variants.
1) All evaluations are nonnegative (γj ≥ 0) then the optimum is attained.
Indeed
f = γ0 |
−(γr +1xr +1 |
+γr +2xr +2 |
+ +γnxn )≤ γ0 |
|
|
||
|
|
≥0 |
|
Hence
Xmax = X1 = (b1,b2, ,br ,0,0, ,0)
and
fmax = f (Xmax )= γ0 .
2) There exists evaluation γj < 0 and all elements of j-th column αij ≤ 0 (i =1, ,r) then the objective function is not bounded f → +∞ .
Indeed, if all the free variables except xj are equal to zero we get
|
xi = bi −aijxj ≥ bi ≥ 0 . |
|
|
|
|
|
≤ 0 |
|
So, the vector |
|
|
X = (b1 −a1jxj,b2 −a2jxj, ,br |
−arjxj,0, 0,xj,0, ,0) |
|
is feasible and if xj |
→ +∞ , then |
|
|
f = γ0 −γjxj → +∞ |
|
|
|
|
|
<0 |
|
3) There exists evaluation γj |
< 0 and at least one element |
|
of the j-th column |
aij > 0 then the value of the objective |
|
function can be improved by the next iteration.
— 35 —
4. simplex method
Indeed,
bi′ = bi − |
aijbk |
|
= aij |
b |
− |
b |
|
≥ 0; i ≠ k |
|
|||
|
|
|
|
|
i |
k |
|
|
||||
a |
|
|
|
|
a |
|
||||||
|
|
|
a |
|
|
|
|
|||||
|
kj |
|
|
|
|
ij |
|
kj |
|
|
||
|
|
bk′ = |
bk |
|
≥ 0 . |
|
|
|
||||
|
|
a |
|
|
|
|
||||||
|
|
|
|
|
|
|
|
|
|
|
||
|
|
|
|
kj |
|
|
|
|
|
|||
Thus, the new basic solution |
X′≥ 0 |
|
||||||||||
′ |
|
|
|
|
|
bk |
γj |
|
|
|
|
|
f(X ) = γ0′ = γ0 |
− |
|
|
≥ γ0 = f(X) . |
(5) |
|||||||
a |
|
|||||||||||
|
|
|
|
|
|
|
kj |
|
|
|
|
|
Remark. It follows from (5) that if γj = 0 then f(X′) = f(X).
Thus, if we have found the optimal solution X1* and there is the evaluation γj = 0 then there exists the alternative optimal solution X2* , To find it we must make new iteration choosing the j-th column as the pivot column. In this case the linear programming problem has infinite solutions
X* = tX1* +(1−t)X2* ; t [0;1] .
Similarly, the algorithm of the simplex method for the minimum problem can be formulated.
Algorithm of the simplex method (minimum)
1)Choose j-th pivot column from the condition: the evaluation γj > 0 and at least one element aij > 0 ;
2)Choose k-th pivot row from the condition:
b |
|
|
|
|
b |
|
|
||
k |
= min |
i |
for |
aij > 0 ; |
akj |
|
|||
aij |
|
|||
|
|
|
|
|
3) Recalculate the elements of the simplex table by using the Jordan-Gauss algorithm.
— 36 —
4. simplex method
4) Repeat step 1.
Example. Find the solution of the liner programming problem by the simplex method.
f = 3x1 +3x2 +21 → max
−2x1 +x2 ≤1,x1 −x2 ≤ 3,x1 +x2 ≤7,
xi ≥ 0.
Solution
The problem is written in the standard form. To apply the simplex method, we have to transform it to a canonicals form. Using the slack variables x3,x4,x5 we get
f = 3x1 +3x2 +21 → max
−2x1 +x2 +x3 =1,x1 −x2 +x4 = 3,x1 +x2 +x5 =7,
xi ≥ 0.
Now let us form a simplex table.
basis |
bi |
x1 |
|
x2 |
x3 |
x4 |
x5 |
|
|
|||
x3 |
1 |
−2 |
|
1 |
|
1 |
0 |
0 |
|
1/1 =1 |
||
−1 |
||||||||||||
x4 |
3 |
1 |
|
0 |
1 |
0 |
|
|
||||
x5 |
7 |
1 |
1 |
0 |
0 |
1 |
|
7 /1 =7 |
||||
f |
21 |
−3 |
−3 |
0 |
0 |
0 |
|
|
||||
|
|
|
|
|
|
|
|
|
|
|
|
|
We have the basic solution that is the starting corner point of the feasible region
X1 = (0,0,1,7,3),
— 37 —
4. simplex method
And
f (X1 )=21 . We have the negative evaluation
γ2 = −3 < 0 .
So, the second row is a pivot column. In this column we must find the minimal ratio
b |
|
|
|
|
b |
|
|
||
k |
= min |
i |
for |
aij > 0 . |
akj |
|
|||
aij |
|
|||
|
|
|
|
|
We obtain
min 1,7 =1 .
1 1
Thus,
a12 =1
is a pivot.
Now we can recalculate the elements of the simplex table by using the Jordan-Gauss algorithm.
After recalculation we get the following simplex table.
basis |
bi |
x1 |
x2 |
x3 |
x4 |
x5 |
x2 |
1 |
−2 |
1 |
1 |
0 |
0 |
x4 |
4 |
−1 |
0 |
1 |
1 |
0 |
x5 |
6 |
3 |
0 |
−1 |
0 |
1 |
f |
24 |
−9 |
0 |
3 |
0 |
0 |
|
|
|
|
|
|
|
Note that in the new table the variable x2 has become a basic one and the variable x3 has become a free one
( x3 ↔ x2 ).
We have new the basic solution
X2 = (0,1,0,4,6).
— 38 —
4. simplex method
And
f (X2 )=24 > f (X1 )=21.
Note that the value of the objective function at the new corner point X2 is greater than the value at the starting point X2
In the new simplex table, we have only one negative evaluation
γ1 = −8 .
So, the first column is a pivot one. There is only one positive number in this column
a31 = 3 .
Thus, a31 is a pivot. In the new table the variable x1 will be a basic one and the variable x5 will be a free one ( x5 ↔ x1 ).
After recalculation by using the Jordan-Gauss algorithm we obtain the following simplex table.
basis |
bi |
x1 |
x2 |
x3 |
x4 x5 |
|
x2 |
5 |
0 |
1 |
1/ 3 0 |
2/ 3 |
|
x4 |
6 |
0 |
0 |
2/ 3 1 |
1/ 3 |
|
x1 |
2 |
1 |
0 |
−1/ 3 0 |
1/ 3 |
|
f |
42 |
0 |
0 |
0 |
0 |
3 |
|
|
|
|
|
|
|
In this table all evaluations are non-negative, so the maximum is attained.
X1max* = (2,5,0,6,0),
fmax = f (X1max* )= 42 .
But the evaluation
γ3 = 0 .
— 39 —
4. simplex method
So, we the alternative optimum. To find another optimal solution we need to select the third column as the pivot column. In this column we have the following minimal positive ratio,
|
|
|
|
5 |
|
|
6 |
|
|
6 |
|
|
|
|
min |
|
, |
|
|
|
= |
|
. |
|
|
|
|
|
|
|
|
|
|
|||||
|
|
|
1/ 3 |
|
2/ 3 |
2/ 3 |
|
|
||||
Thus, a23 =2/ 3 is a pivot (x4 ↔ x3 ) . |
|
|||||||||||
After recalculation we get the table. |
|
|
||||||||||
|
|
|
|
|
|
|
|
|
|
|||
|
basis |
bi |
|
x1 |
x2 |
x3 |
x4 |
|
x5 |
|||
|
x2 |
2 |
|
0 |
1 0 |
−1/2 1/2 |
||||||
|
x3 |
9 |
|
0 |
0 |
1 |
3/2 1/2 |
|||||
|
x1 |
5 |
|
1 |
0 |
|
0 |
1/2 |
1/2 |
|||
|
f |
42 |
|
0 |
0 |
|
0 |
0 |
|
3 |
||
|
|
|
|
|
|
|
|
|
|
|
|
|
It follows from this table that another optimal solution
is
X2max* = (5,2,9,0,0).
Now by using the convex combination we can find the set of all solutions of the problem (the general solution):
X = (1−t)X1max* +tX2max* =
= (1−t)(2, 5, 0, 6, 0)+t(5, 2, 9, 0, 0); t [0,1].
Or
X = (2 +3t, 5 −3t, 9t, 6 −6t, 0); t [0,1].
Taking into account, that the initial problem has two variables, we finally get
X = (2 +3t, 5 −3t); t [0,1].
fmax = 42 .
— 40 —
