Dr. Maddah ENMG 500 Engineering Management I 11/03/09 Simplex method in matrix form (revised simplex method) A LP with n decision variables and m constraints can be written as max Z = cx s.t. Ax = b x≥0 where x1 x c = ( c1 , c2 , c3 ,K, cn ) , x = 2 , M xn a11 a A = 21 K am1 a12 a22 K am 2 K a1n b1 L a2 n b , b= 2 M K K K amn bm Alternatively, the LP can be written as max Z = c B x B + c N x N s.t. Bx B + Nx N = b (1) x≥0 where the subscripts “B” and “N” denote basic and nonbasic variables respectively. For example, max Z = 2 x1 + 3 x2 x1 + x2 ≤ 50 s.t. 2x1 + x2 ≤ 30 x1 , x2 ≥ 0 max Z = 2 x1 + 3 x2 s.t. = 50 x1 + x2 + S1 ⇔ 2x1 + x2 + S 2 = 30 x1 , x2 , S1 , S 2 ≥ 0 1 Then, at O(0,0), S x 50 x B = 1 , x N = 1 , c N = (2,3), c B = (0, 0), b = 30 S2 x2 1 0 1 1 B= = , N 0 1 2 1 Solving for xB in (1) gives Bx B = b − Nx N ⇒ x B = B −1 ( b − Nx N ) = B −1b − B −1Nx N The LP can then be rewritten as max Z = c B B −1b − (c B B −1N − c N )x N s.t. x B + B −1Nx N = B −1b x≥0 Recall that each iteration of the simplex method allows a nonbasic variable (the entering variable) to increase from zero. until one of the basic variables (the leaving variable) hits zero. Let Nj be the jth column of N, and Vi be the ith component of vector V. Then, an iteration of the simplex method, with xj being the basic variable and xi being basic variables, can be represented by the following equations: Z = c B B −1b − (cB B −1N j − c j ) x j ⇔ Z new = Z 0 − c0j x j xi = (B −1b)i − (B −1N j )i x j ⇔ xinew = bi0 − A ij0 x j where the superscripts “0” and “new” denote the current solution and the new solution generated by the next iteration. 2 For a max problem, we choose the entering variable, xk, s.t. zk − ck = min{z j − c j | j is nonbasic and z j − c j < 0}, (2) −1 where, z j ≡ c B B N j .1 The leaving variable is xr s.t. ( −1 (B −1b)r (B b )i = min −1 i is basic and B −1N j −1 B Nk B N k i r ) ( ) ( ) i > 0 . (3) The above provides the rational for the revised simplex method which proceeds as follows Step 0. Determine a starting basic feasible solution with basis Ω. Step 1. Evaluate B-1. Step 2. Compute (zj − cj) for all nonbasic variables. If (zj − cj) ≥0 for a maximization problem (≤ 0 for a minimization), then stop. −1 The optimal solution is x B * = B b, Z * = c B x B *. Else, determine the entering variable, xk, using (2), and go to Step 3. Step 3. Compute B-1Nk . If all elements of B-1Nk ≤ 0, then stop, the solution is unbounded. Else, compute B-1b and determine the leaving variable, xr, using (3). Step 4. determine the new basis, Ωnew = Ω ∪ {xk} − {xr}. Set Ω = Ωnew, and go to Step 1. 1 This rule for choosing the entering variable is just a rule of thumb. In some cases, there might be better ways to choose the entering variable. 3 • Example max Z = 2 x1 + 3x2 s.t. x1 + x2 ≤ 50 2x1 + x2 ≤ 30 x1 , x2 ≥ 0 max Z = 2 x1 + 3 x2 s.t. x1 + x2 + S1 = 50 ⇔ 2x1 + x2 + S 2 = 30 x1 , x2 , S1 , S2 ≥ 0 Iteration 1. o Step 0. Starting basic feasible solution at O(0,0), S x Ω = {S1 , S2 }, x B = 1 , x N = 1 , c N = (2,3), c B = (0, 0), S2 x2 1 0 1 1 50 B= , N = , b = 0 1 2 1 30 o Step 1. 1 0 B −1 = 0 1 o Step 2. 1 0 1 z x1 − cx1 = c B B −1N x1 − cx1 = (0, 0) − 2 = −2 0 1 2 1 0 1 z x2 − cx2 = c B B −1N x2 − cx2 = (0, 0) − 3 = −3 0 1 1 The entering variable is x2 . o Step 3. 1 0 1 1 (S1 ) B −1N x2 = = 0 1 1 1 (S2 ) 1 0 50 50 B −1b = = 0 1 30 30 Then, (B −1b) S1 (B −1 N x2 ) = S1 50 = 50 , 1 (B −1b) S2 (B −1 N x2 ) S2 = (S1 ) (S2 ) 30 = 30 . 1 The leaving variable is S2 . o Step 4. The new basis is Ω = {S1, S2}∪ {x2} −{S2} ={S1, x2}. 4 Iteration 2. o Step 1. S x Ω = {S1 , x2 }, x B = 1 , x N = 1 , c B = (0,3), c N = (2,0), x2 S2 1 1 1 0 B= N = , 0 1 2 1 1 1 1 1 −1 1 −1 2 −1 B= ⇒ B = = , 0 1 0 1 0 1 1 o Step 2. 1 −1 1 −1 z x1 − cx1 = c B B −1N x1 − cx1 = (0,3) − 2 = (0,3) −2 = 4 0 1 2 2 1 −1 0 −1 zS2 − cS2 = c B B −1N S2 − cS2 = (0,3) − 0 = (0,3) − 0 = 3 0 1 1 1 All zj − cj > 0, for all j nb. Stop. The optimal solution is reached. The optimal solution is S * 1 −1 50 20 x B * = 1 = B −1b = = x * 0 1 30 30 2 20 Z * = c B x B * = ( 0 3) = 90 30 Therefore, the optimal solution is x1* = 0, x2* = 30, and Z* = 90. Remark. The solution to the same problem in tabular form is presented on the next page. It is instructive to compare the two solution methods. 2 The inverse of a b 1 d −b −1 B= is B = . (This inverse exists only if ad − bc ≠ 0.) ad − bc −c a c d 5 Iteration 1. Entering variable Leaving (blocking) variable Basic x1 x2 S1 Z −2 −3 0 S1 1 1 1 S2 2 1 0 zj − c j S2 RHS Ratio 0 0 0 50 50/1=50 1 30 30/1=30 ( (B −1b)i B −1N k ) i B−1 Iteration 2. cBB−1b zj − c j Basic x1 Z 4 S1 −1 x2 2 x2 S 1 0 0 0 1 1 0 S2 RHS 3 90 −1 20 1 30 B−1b B−1 6