当前位置:网站首页>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 :
- How to get an initial basic feasible solution
- How to judge whether the current basic feasible solution has reached the optimal solution
- 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+20x2≤160
5 x 1 + x 2 ≤ 15 \quad 5x_{1}+x_{2}≤15 5x1+x2≤15
x 1 ≤ 4 \quad x_{1}≤4 x1≤4
x 1 , x 2 ≥ 0 x_{1},x_{2}≥0 x1,x2≥0
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,x5≥0
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]=[B−1b0]
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
- 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=160−30x1−20x2
x 4 = 15 − 5 x 1 − x 2 x_{4}=15-5x_{1}-x_{2} x4=15−5x1−x2
x 4 = 4 − x 1 x_{4}=4-x_{1} x4=4−x1 - 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=20−141x3−74x4 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
边栏推荐
- 如何高效的完成每日的任务?
- 通俗易懂C語言關鍵字static
- Exploring temporary information for dynamic network embedding
- A solution to cross domain problems
- 其他代码,,vt,,,k
- 【js】免费api判断节假日、工作日和周六日
- recv & send
- Implementation of image binary morphological filtering based on FPGA -- Corrosion swelling
- Input 3 integers and output them from large to small
- Weishi camera display
猜你喜欢
随机推荐
Connectez Le projecteur
SDRAM controller -- implementation of arbitration module
Input 3 integers and output them from large to small
Chinese and English instructions of collagen enzyme Worthington
Gun make (3) Rules for makefile
General introduction to gun make (2)
Chrome浏览器开发者工具使用
[JS] free API to judge holidays, working days, Saturdays and Sundays
影响个人成长的三个因素
LeetCode 31 ~ 40
Spiral matrix
V4l2+qt video optimization strategy
树莓派 + AWS IoT Greengrass
树莓派 + AWS IoT 入门实验
How to efficiently complete daily tasks?
Jenkins localization and its invalid solution
Byte order problem
记录一个诡异的图片上传问题
将lua print输出到cocos2d控制台输出窗口中
leetcode 300. Longest Increasing Subsequence 最长递增子序列 (中等)







