Dr. Grace F. Wang, Spring As shown in Ch2, the graphical solution procedure can be only used to solve linear programming problems involving two decision variables. However, most linear programming problems are too large to be solved graphically, and an algebraic solution procedure must be employed. The most widely used algebraic procedure for solving linear programming problems is called the simplex method. 線性規劃之簡捷法 The Simplex Method of Linear Programming:
Dr. Grace F. Wang, Spring The simplex method is an iterative procedure ( 重複步驟 ) for moving from one basic feasible solution(extreme point) to another until the optimal solution is reached. Let’s use the example of the High Tech Industries ( 海德公司 ) on p.225 或英文第9版之中譯本 ( 以下簡稱中譯本 ) p.186 to illustrate the simplex method as follows:
Dr. Grace F. Wang, Spring § § (pp ) 1. Formulate the LP model for the High Tech problem in general form: X 1 = number of units of the Deskpro X 2 = number of units of the Portable Max 50X X 2 s.t. 3X 1 + 5X Assembly time X 2 20 Portable display 8X 1 + 5X Warehouse capacity X 1, X 2 0
Dr. Grace F. Wang, Spring Reserve for figure 5.1
Dr. Grace F. Wang, Spring Rewrite the LP model in the standard form: Max 50X X 2 + 0S 1 + 0S 2 + 0S 3 s.t. 3X 1 + 5X 2 + 1S 1 + 0S 2 + 0S 3 = 150 0X 1 + 1X 2 + 0S 1 + 1S 2 + 0S 3 = 20 8X 1 + 5X 2 + 0S 1 + 0S 2 + 1S 3 = 300 X 1, X 2, S 1, S 2, S 3 0 Return to slide 9 註:在此 model 中,每條限制式皆含有 basic variable ,意指該變數在本列之係數為 +1 , 而在其他列皆為 0 。
Dr. Grace F. Wang, Spring Set up the tableau form( 表格式 ): When a LP problem has a Max Objective Function with only = 0, its standard form and tableau form are the same; otherwise, they are not the same and the tableau form is developed in section 5.6 on p.242( 原文第十版 ). The purpose of tableau form is to provide an initial basic feasible solution as a starting point for the simplex method.
Dr. Grace F. Wang, Spring 假設 1 個線性規劃問題含 n 個變數及 m 個方程式 ( 限制式 ) , 當 n > m 時,無法解, ( 必須 n ≤ m) , ∴先令多餘的變數為零。 若令 X 2 =0 and S 1 =0 ,則可得一個 basic solution as shown on pp : X 1 = 50 S 2 = 20 S 3 = However, this is not a basic feasible solution because S 3 is negative. In a LP model, all variables must be non- negative ( ≥ 0).
Dr. Grace F. Wang, Spring For this example, the tableau form is the same as standard form, which consists of 5 variables and 3 linear equations, where n>m. We can find an initial basic feasible solution by setting the decision variables=0 and solve for the slack variables as follows: Let X 1 = 0 X 2 = 0 (n – m = 5 – 3 = 2) nonbasic variables (m = 3) basic variables We obtain This is a basic feasible solution but not an optimal solution since the O.F. value = 50(0) + 40(0) = 0. S 1 = 150 S 2 = 20 S 3 = 300
Dr. Grace F. Wang, Spring
10 4.Setting up the initial simplex tableau ( 起始的簡捷表 ) : C j = O.F. Coefficient for variable j b i = RHS value for constraint i a ij = Coefficient associated with variable j in constraint i Basis C B Z j C j - Z j C row A matrix b column Go to slide 4 variable
Dr. Grace F. Wang, Spring The set of current basic variables. CBCB ZjZj C j - Z j Basis Where The corresponding O.F. coefficient for each variable in the basis. The decrease in the value of the O.F. that will result if one unit of the variable in jth column is brought into the basis. The net change in the value of the O.F. that will result if one unit of the variable in jth column is brought into the basis. It’s called “The net evaluation row ”( 淨評估列 ).
Dr. Grace F. Wang, Spring Unit columns or Unit vectors ( 單位向量 ) X1X1 X2X2 S1S1 S 2 S3S3 BasisCBCB bibi S S S ZjZj C j - Z j (O.F. Value)
Dr. Grace F. Wang, Spring
Dr. Grace F. Wang, Spring To identify the pivot column, pivot row, and thus the pivot element, we apply the following criteria : (p.234) (1) Criterion for entering a new variable into the basis: - Examine the net-evaluation row, choose the variable that will cause the largest (C j – Z j ) value( 最大淨評估值 ). - In the case of a tie, choose the variable corresponding to the leftmost of the columns. (2) Criterion for removing a variable from the current basis (Minimum Ratio Test -- 最小比率檢定 ): - Compute the b i /a ij ratio for each a ij > 0. Then, choose the variable to remove that corresponds to the minimum ratio. - In the case of a tie, choose the variable corresponding to the uppermost of the rows. 5. Improve the solution:
Dr. Grace F. Wang, Spring X 1 X 2 S 1 S 2 S 3 bibi Basis C B b i a ij S /3=50 S S /8=37.50 ZjZj C j - Z j Min ratio pivot column( 樞紐行 ) pivot row ( 樞紐列 ) Max net evaluation Pivot element( 樞紐項 )
Dr. Grace F. Wang, Spring Our goal is to convert the pivot column in the A matrix into a unit column by using “Elementary Row Operations”( 基本的列運算法 ) --p Compute the next simplex tableau: Old Value New Value Pivot Column a 11 a 21 a 31 (1) 樞紐列 (Pivot row) 之計算: New pivot row = old pivot row / pivot element (2) 非樞紐列之計算 ( 若此列與 樞紐行 相交的值不等於零 ): New row = old row – 此列與樞紐行相交的值 × (New pivot row) Unit vector
Dr. Grace F. Wang, Spring (1) 樞紐列 (Pivot row) 之計算: New pivot row = old pivot row / pivot element old pivot row : new pivot row : 1 5/ /8 300/8=75/2 (2) 非樞紐列之計算 ( 若此列與樞紐行相交的值不等於零 ): New row = old row – 此列與樞紐行相交的值 × (New pivot row) old 1 st row : new 1 st row : 0 25/ /8 75/2 * * 150 – 3 (75/2)=75/2
Dr. Grace F. Wang, Spring Through all of computations as shown on p.236, we obtain the second simplex tableau below: (a better solution) Became a unit column Q:What is our goal toward this pivot column?
Dr. Grace F. Wang, Spring Since X 2 has the highest positive value in the (C j - Z j ) row, we repeat the procedure as taken in steps 5 ~ 6 to obtain the third simplex tableau as follows: 7. Continue to find a better solution: Q : Can we improve the solution even more now?
Dr. Grace F. Wang, Spring Since there is no any positive value in the net- evaluation row now,this is the final tableau, which contains the optimal solution as follows: X 1 = 30 X 2 = 12 O.F. value = 1980 S 1 = 0 S 2 = 8 S 3 = 0 How do you interpret this solution? See Figure 5.3 for the computer output, a summary of the simplex method is provided on p.241( 原文第 十版 )
Dr. Grace F. Wang, Spring The Computer Solution for The Hightech Industries Problem
Dr. Grace F. Wang, Spring Tableau Form: The General Case 一般情況下之表格式 ( pp ) ≥ ( 1 ) A LP model with “ ≥ ” constraints ( 2 ) A LP model with “ = ” constraints ( 3 ) A LP model with negative RHS values What if one or more constraint(s) of a LP model is(are) not “≤” or RHS(s) is(are) negative ? For example: § 5.6
Dr. Grace F. Wang, Spring ( 1 ) A LP model with “ ” constraints Max 50X X 2 s.t. 3X 1 + 5X X X 1 + 5X X1, X2 0 1X 1 + 1X 2 25 General Form Since Suppose that the management of High Tech Industries wanted to ensure that the total production for both models would be at least 25 units. Thus, the new model will be as follows:
Dr. Grace F. Wang, Spring Max 50X X 2 + 0S 1 + 0S 2 + 0S 3 + 0S 4 s.t. 3X 1 + 5X 2 + 1S 1 = 150 1X 2 + 1S 2 = 20 8X 1 + 5X 2 + 1S 3 = 300 1X 1 + 1X 2 - 1S 4 = 25 Standard Form X 1, X 2, S 1, S 2, S 3, S 4 0
Dr. Grace F. Wang, Spring Max 50X X 2 + 0S 1 + 0S 2 + 0S 3 + 0S 4 - Ma 4 s.t. 3X 1 + 5X 2 + 1S 1 = 150 1X 2 + 1S 2 = 20 8X 1 + 5X 2 + 1S 3 = 300 1X 1 + 1X 2 - 1S 4 + 1a 4 = 25 Tableau Form 由於第四個方程式缺少基本變數,我們需要加入一個人工變數 (Artificial Variable) 。若無此項,無法踏出第一步以產生 起始的簡捷表。
Dr. Grace F. Wang, Spring P.244 ~ 246 The Initial Simplex Tableau : Basis C B S1S1 S2S2 S3S3 a4a M ZjZj Cj - ZjCj - Zj X1X1 X2X2 S1S1 S2S2 S3S3 S4S4 a4a /3 = M - /8 = /1 = 25 -M -M M -M -25M 50+M 40+M M 0 - bibi - - - bibi a ij Max Min ( 代表第一個基本解 ) Pivot Column Phase I ( 第一階段 ) : Pivot Row
Dr. Grace F. Wang, Spring P.244 ~ 246 Basis C B S1S1 S2S2 S3S3 X1X ZjZj Cj - ZjCj - Zj X1X1 X2X2 S1S1 S2S2 S3S3 S4S4 a4a /3 = M /8 = M-50 - bibi - - - bibi a ij Max Min Phase II ( 第二階段 ) – 在 Basis 中不含人工變數之後 Pivot Column Pivot Row
Dr. Grace F. Wang, Spring P.244 ~ 246 Basis C B S1S1 S2S2 S4S4 X1X ZjZj Cj - ZjCj - Zj X1X1 X2X2 S 1 S 2 S 3 S / / / 2 (75/2) / (25/8) = / 1 = / / / 2 - 1 5/ / / 2 (75/2) / (8/5) = / / / /8 0 - bibi - - - bibi a ij Max Min
Dr. Grace F. Wang, Spring P.244 ~ 246 Basis C B X2X2 S2S2 S4S4 X1X ZjZj Cj - ZjCj - Zj X1X1 X2X2 S 1 S 2 S 3 S / / /25 1 3/ /25 0 2/ /25 0 5/ /5 0 26/ / /5 0 - bi Q : Is this the final simplex tableau ?
Dr. Grace F. Wang, Spring ( 2 ) A LP model with “ = ” constraints without basic variables For example, 6X 1 + 4X 2 – 5X 3 = 30 We would simply add an artificial variable a 1 to create a basic feasible solution in the initial simplex tableau. 6X 1 + 4X 2 – 5X 3 + 1a 1 = 30 Then, the simplex method proceeds exactly as before.
Dr. Grace F. Wang, Spring ( 3 ) A LP model with negative RHS values If X 2 X 1 – 5, then -X 1 + X 2 – 5 Thus, multiply by –1 to obtain X 1 – X 2 5 Then, X 1 – X 2 – S 1 = 5 If X 1 is not a basic variable of this constraints, we need to add an artificial variable a 1 as follows: X 1 – X 2 – S 1 +a 1 = 5
Dr. Grace F. Wang, Spring Solving a Minimization Problem (pp )§ 5.7 Min 2X 1 + 3X 2 s.t. 1X 1 ≥ 125 Demand for product A 1X 1 + 1X 2 ≥ 350 Total production 2X 1 + 1X 2 ≤ 600 Processing time X 1, X 2 ≥ 0 Max - 2X 1 - 3X 2 s.t. 1X 1 ≥ 125 Demand for product A 1X 1 + 1X 2 ≥ 350 Total production 2X 1 + 1X 2 ≤ 600 Processing time X 1, X 2 ≥ 0 To solve this problem using the simplex method, we first multiply the objective function by -1 to convert the minimization problem into the following equivalent maximization problem:
Dr. Grace F. Wang, Spring The final simplex tableau is shown on p.250. Max - 2X 1 - 3X 2 + 0S 1 + 0S 2 + 0S 3 – Ma 1 – Ma 2 s.t. 1X 1 - 1S 1 +1a 1 = 125 1X 1 + 1X 2 - 1S a 2 = 350 2X 1 + 1X 2 + 1S 3 = 600 X 1, X 2, S 1, S 2, S 3, a 1, a 2 ≥ 0 The tableau form for this problem is as follows:
Dr. Grace F. Wang, Spring X1X1 X2X2 S1S1 S 2 S3S3 BasisCBCB bibi x x s ZjZj C j - Z j Note: The value of O. F must be multiplied by -1 to obtain the value of the objective function for the original minimization problem. Thus, the minimum total cost of the optimal solution is $800.
Dr. Grace F. Wang, Spring § 5.8 Special Cases Infeasibility Unboundedness Alternative Optimal Solution Degeneracy
Dr. Grace F. Wang, Spring Infeasibility Infeasibility is detected in the simplex method when an artificial variable remains positive in the final tableau. n LP Formulation MAX 2 x x 2 MAX 2 x x 2 s. t. 4 x x 2 < 12 s. t. 4 x x 2 < 12 2 x 1 + x 2 > 8 2 x 1 + x 2 > 8 x 1, x 2 > 0 x 1, x 2 > 0
Dr. Grace F. Wang, Spring Example: Infeasibility Final Tableau
Dr. Grace F. Wang, Spring Example: Infeasibility In the previous slide we see that the tableau is the final tableau because all c j - z j < 0. However, an artificial variable is still positive, so the problem is infeasible.
Dr. Grace F. Wang, Spring Unboundedness A linear program has an unbounded solution if all entries in an entering column are non-positive. n LP Formulation MAX 2 x x 2 MAX 2 x x 2 s. t. 4 x x 2 > 12 s. t. 4 x x 2 > 12 2 x 1 + x 2 > 8 2 x 1 + x 2 > 8 x 1, x 2 > 0 x 1, x 2 > 0
Dr. Grace F. Wang, Spring Example: Unboundedness
Dr. Grace F. Wang, Spring Example: Unboundedness In the previous slide we see that c 4 - z 4 = 4 (is positive), but its column is all non-positive. This indicates that the problem is unbounded.
Dr. Grace F. Wang, Spring Alternative Optimal Solution A linear program has alternate optimal solutions if the final tableau has a c j - z j value equal to 0 for a non-basic variable. Final Tableau Final Tableau x 1 x 2 x 3 s 1 s 2 s 3 s 4 x 1 x 2 x 3 s 1 s 2 s 3 s 4 Basis c B Basis c B s s x x x x s s z j c j – z j c j – z j
Dr. Grace F. Wang, Spring Example: Alternative Optimal Solution In the previous slide we see that the optimal solution is: x 1 = 4, x 2 = 6, x 3 = 0, and z = 32 Note that x 3 is non-basic and its c 3 - z 3 = 0. This 0 indicates that if x 3 were increased, the value of the objective function would not change. Another optimal solution can be found by choosing x 3 as the entering variable and performing one iteration of the simplex method. The new tableau on the next slide shows an alternative optimal solution is: x 1 = 7, x 2 = 0, x 3 = 3, and z = 32
Dr. Grace F. Wang, Spring Example: Alternative Optimal Solution New Tableau x 1 x 2 x 3 s 1 s 2 s 3 s 4 Basis c B s x x s z j c j - z j
Dr. Grace F. Wang, Spring Degeneracy( 退化解 ) 假設海德公司之線性規劃模式修改如下: Max50x 1 +40x 2 s.t.
Dr. Grace F. Wang, Spring The simplex tableau after one iteration is as follows:
Dr. Grace F. Wang, Spring ` Tie
Dr. Grace F. Wang, Spring
Dr. Grace F. Wang, Spring Degeneracy( 退化解 ) A degenerate solution to a linear program is one in which at least one of the basic variables equals 0. This can occur at formulation or if there is a tie for the minimizing value in the ratio test to determine the leaving variable. When degeneracy occurs, an optimal solution may have been attained even though some c j – z j > 0. Thus, the condition that c j – z j < 0 is sufficient for optimality, but not necessary.
Dr. Grace F. Wang, Spring End of Chapter 5