当前位置:网站首页>Simplex method (1)

Simplex method (1)

2022-06-26 02:08:00 Stephen Curry 30

Simplex method

Ideas : From a basic feasible solution ( The initial basic feasible solution ) set out , Each search is more than the previous one “ good ” The basic feasible solution of , Instead of the previous one “ good ” The basic feasible solution of is not calculated

To solve the following problems :

  1. How to get an initial basic feasible solution
  2. How to judge whether the current basic feasible solution has reached the optimal solution
  3. If the current solution is not the optimal solution , How to find a better basic feasible solution

example
m a x   z = 5 x 1 + 2 x 2 max \: z=5x_{1}+2x_{2} maxz=5x1+2x2
s . t .   30 x 1 + 20 x 2 ≤ 160 s.t. \: 30x_{1}+20x_{2}≤160 s.t.30x1+20x2160
5 x 1 + x 2 ≤ 15 \quad 5x_{1}+x_{2}≤15 5x1+x215
x 1 ≤ 4 \quad x_{1}≤4 x14
x 1 , x 2 ≥ 0 x_{1},x_{2}≥0 x1,x20

Standard form :( Join in 3 Relaxation variables )
m a x   z = 5 x 1 + 2 x 2 + 0 x 3 + 0 x 4 + x 5 max \: z=5x_{1}+2x_{2}+0x_{3}+0x_{4}+x_{5} maxz=5x1+2x2+0x3+0x4+x5
s . t .   30 x 1 + 20 x 2 + x 3 = 160 s.t. \: 30x_{1}+20x_{2}+x_{3}=160 s.t.30x1+20x2+x3=160
5 x 1 + x 2 + x 4 = 15 \quad 5x_{1}+x_{2}+x_{4}=15 5x1+x2+x4=15
x 1 + x 5 = 4 \quad x_{1}+x_{5}=4 x1+x5=4
x 1 , x 2 , x 3 , x 4 , x 5 ≥ 0 x_{1},x_{2},x_{3},x_{4},x_{5}≥0 x1,x2,x3,x4,x50
Get the corresponding coefficient matrix A
B = [ 30 20 1 0 0 5 1 0 1 0 1 0 0 0 1 ] B=\begin{bmatrix} 30 & 20 & 1 & 0 & 0\\ 5 & 1 & 0 & 1 & 0\\ 1 & 0 & 0 & 0 & 1 \end{bmatrix} B=30512010100010001

step

① Select the initial base matrix B(0) And base variables xB( In the constraint matrix Am×n Middle structure m Order unit matrix )

B ( 0 ) = [ 1 0 0 0 1 0 0 0 1 ] B^{(0)}=\begin{bmatrix} 1 & 0 & 0\\ 0 & 1 & 0\\ 0 & 0 & 1 \end{bmatrix} B(0)=100010001
x B = [ x 3 x 4 x 5 ] x_{B}=\begin{bmatrix}x_{3}\\x_{4}\\x_{5}\end{bmatrix} xB=x3x4x5
So the initial basic feasible solution is
[ x B x N ] = [ B − 1 b 0 ] \begin{bmatrix} x_{B}\\x_{N}\end{bmatrix}=\begin{bmatrix}B^{-1}b\\0\end{bmatrix} [xBxN]=[B1b0]
After calculation, the initial basic feasible solution is (0,0,160,15,4)T, The corresponding objective function value is max z=0

② Determine whether the current solution is the optimal solution

  1. Express the base variable as a non base variable - Canonical form
    x 3 = 160 − 30 x 1 − 20 x 2 x_{3}=160-30x_{1}-20x_{2} x3=16030x120x2
    x 4 = 15 − 5 x 1 − x 2 x_{4}=15-5x_{1}-x_{2} x4=155x1x2
    x 4 = 4 − x 1 x_{4}=4-x_{1} x4=4x1
  2. Express the objective function with non base variables - Canonical form
    z = 0 + 5 x 1 + 2 x 2 z=0+5x_{1}+2x_{2} z=0+5x1+2x2

because x1 and x2 The coefficient of is positive , and x1 and x2 The value of is zero , So we can see that the current solution is not the optimal solution
In the classical expression of the objective function, all the coefficients before the non base variable are called Inspection number
For the maximization problem , When all the inspection numbers ≤0 when , The current solution is the optimal solution
For minimization problem , When all the inspection numbers ≥0 when , The current solution is the optimal solution

③ Improvement of solution
because x1 The coefficient of 5 Than x2 Big , seek max Each additional unit contributes more , So let x1 The value of is changed from zero to positive ( From non base variables Select one of them to become a non base variable - Base variable
Select one of the original base variables to become the base variable - Off base variable


Select base variable
According to the objective function, it can make the result better (max) The greater the contribution of variables


Select the off base variable
In the expression of base variable with non base variable , When x1 Increase from zero until x3,x4,x5 Stop when the value of decreases to zero , At this point, the first base variable that becomes zero is the off base variable


So we exchange x4 Its value becomes 0 A new basic feasible solution is obtained
x ( 1 ) = ( 3 , 0 , 70 , 0 , 1 ) T x^{(1)}=(3,0,70,0,1)^{T} x(1)=(3,0,70,0,1)T
The corresponding base matrix is B ( 1 ) = ( p 3 , p 1 , p 5 ) B^{(1)}=(p_{3},p_{1},p_{5}) B(1)=(p3,p1,p5), The base variable is x3,x1,x5 The non base variable is x2,x4, The corresponding objective function value is z ( x ( 1 ) ) = 15 > z ( x ( 0 ) ) = 0 z(x^{(1)})=15>z(x^{(0)})=0 z(x(1))=15>z(x(0))=0
Return to the second step again to determine whether the current solution is the optimal solution , Repeat the process

Get in z ( x ( 2 ) ) = 20 z(x^{(2)})=20 z(x(2))=20 The objective function is found
z = 20 − 1 14 x 3 − 4 7 x 4 z=20-\frac{1}{14} x_{3}-\frac{4}{7}x_{4} z=20141x374x4 The Central African base variable consists of 0 increase , Can only make z Value decline

Thus, it is judged that the current solution is the optimal solution
x ( 2 ) = ( 2 , 5 , 0 , 0 , 2 ) T x^{(2)}=(2,5,0,0,2)^{T} x(2)=(2,5,0,0,2)T
The corresponding value is
z ∗ = z ( x ( 2 ) ) = 20 z^{*}=z(x^{(2)})=20 z=z(x(2))=20

The above is a detailed explanation of the actual operation process of the simplex method

原网站

版权声明
本文为[Stephen Curry 30]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/02/202202180553042267.html