90 likes | 307 Views
2. Simplex Method – standard form. Key concept : Change constraints from inequality to equality then find the solutions of the linear equations’ system. x 1 - 2x 2 ≤ 4. x 1 + x 2 3. 加上 slack variable ( 0) 使得等式成立. 加上 surplus variable ( 0) 使得等式成立. x 1 - 2x 2 + s 1 = 4.
E N D
2. Simplex Method – standard form Key concept:Change constraints from inequality to equality then find the solutions of the linear equations’ system. x1 - 2x2≤ 4 x1 + x2 3 加上slack variable ( 0) 使得等式成立 加上surplus variable ( 0) 使得等式成立 x1 - 2x2 +s1= 4 x1 + x2 –s2= 3 Maximize f= 4x1 + 3x2 Maximize f= 4x1 + 3x2 標準化 x1 + x2 + s1= 3 x1 + x2 ≤ 3 2x1 - x2 - s2= 3 2x1 - x2 3 x1 0, x2 0 x1, x2, s1, s2 0
2.1 The steps of Simplex Method a11x1 + a12x2 + … + a1nxn = b1 c1x1 + c2x2 + … + cnxn Simplex Tableau 目標函數的係數 • Transform into standard form. • Establish simplex tableau. • Choose the basic variables xB for initial feasible solution. (正常狀況下是slack var.s) • Calculate the costfjof each xj to produce objective benefit. • Calculate the pure objective benefit Cj – fj of each xj under the current xB. • Choose the max benefit producer xj*(the xj with max Cj – fj) as pivot variable. • Do the ratio test i= bi/aijof each xBi. Replace xB* (the xB having min i)with xj*. • Do pivoting (elementary row operations), such that aij* = 1 (aij*: the coefficient in xB*’s row and xj*’s column), and such that the other coefficients in xj*’s column are 0. ------ A new tableau is obtained. • Repeat from 4. until noCj – fj > 0. 技術矩陣 xB在目標函數上的係數 目標函數值
Max f = 12x1 + 8x2 + 0s1 + 0s2 + 0s3 Max f = 12x1 + 8x2 5x1 + 2x2 + s1 = 150 5x1 + 2x2 ≤ 150 2x1 + 3x2 +s2 = 100 2x1 + 3x2 ≤ 100 4x1 + 2x2 + s3 = 80 4x1 + 2x2 ≤ 80 x1, x2, s1, s2, s3 0 x1, x2 0 xN xB [N|B] = [b] 2.2 Simplex method’s example step 1 step 2 step 3 step 4 step 5 step 6 step 7 pivoting Row 3 用x1換s3 step 8 step 9 Initial Feasible Solution B-1NXN + XB = B-1[b] NXN + BXB = [b] pivot Variable x1 ratio test
Max f = 12x1 + 8x2 + 0s1 + 0s2 + 0s3 5x1 + 2x2 + s1 = 150 0 2 0 0 -3 2x1 + 3x2 +s2 = 100 4x1 + 2x2 + s3 = 80 x1, x2, s1, s2, s3 0 12 6 0 0 3 ∑icBibi=240 -5*Row3+Row1 -2*Row3+Row2 Row3/4 0 0 1 -0.5 2 0.5 1 0 0 0 0 1 -1.25 -0.5 0.25 50 60 20 - 30 40 cB3=12 xB3=x1 2.2 Simplex method’s example – cont’s Pivoting step 2 step 4 step 6 step 8 step 1 step 3 step 5 step 7 step 9 Loop 1 Loop 2 step 1 step 2 step 3 step 4 step 5 step 6 step 7 step 8 step 9 Cj 12 8 0 0 0 i cB xB x1 x2 s1 s2 s3 bi i 1 cB1=0 xB1=s1 5 2 1 0 0 150 2 cB2=0 xB2=s2 2 3 0 1 0 100 3 cB3=0 xB3=s1 4 2 0 0 1 80 fj 0 0 0 0 0 ∑icBibi=0 Cj-fj 12 8 0 0 0
2.2 Simplex method’s example – cont’s step 1 step 3 step 4 step 5 step 7 step 9 step 2 step 6 step 8 x1 = 5, x2 = 30, Max f =300 沒有大於0的值
2.3 Summary for simplex method Maximize f= C1x1 + C2x2 + … + Cnxn a11x1 + a12x2 + … + a1nxn = b1 a21x1 + a22x2 + … + a2nxn = b2 …… ai1x1 + ai2x2 + … + ainxn = bi ……am1x1 + am2x2 + … + amnxn = bm x1, x2, …, xn 0
Max f = 1.5xa + 1.2xg Max f = 1.5xa + 1.2xg 1.5xa + 2xg ≤ 1200 1.5xa + 2xg + s1 = 1200 3xa + 3xg ≤ 2100 3xa + 3xg + s2= 2100 6xa + 3xg ≤ 3600 6xa + 3xg + s3= 3600 xa, xg 0 xa, xg, s1, s2, s3 0 2.3.1 simplex method example again (example from Topic 1) 標準化 800 700 600 6
2.3.1 simplex method example again (cont’) – -1/4 300 -1/4 0 (-1.5)+ * 200 0 3/2 -1/2 300 (-3)+ ? 1200 1/6 1 1/2 600 6 ∑icBibi=900 0.75 1.5 0.25 1.5xg +s2-0.5s3= 300 s2= 300-1.5xg+0.5s3 s2 /1.5= 300/1.5-xg+(0.5/1.5)s3 xg= 200-2s2 /3 +s3/3 <<< i=2 xg= 1200-2xa+(1/3)s3<<< i=3 s2對目標函數值最沒貢獻,所以換成有貢獻的xg 0 0.45 -0.25 ∑icBibi=900 ∑icBibi=990
fj 與Cj-fj是什麼? 2x1 + 3x2 + s2 = 100 s2= 100 - 2x1 - 3x2 5x1 + 2x2 + s1 = 150 x1每增加1 每個s2就會減少2 s1= 150 - 5x1 - 2x2 x1每增加1 每個s1就會減少5 4x1 + 2x2 + s3 = 80 s3= 80 - 4x1 - 2x2 x1每增加1 每個s3就會減少4 fj 是xj生產basic var.s的單位成本 Cj-fj是xj當basic var.s後可創造的單位利益