The Simplex Method for Linear Programming Problems
Total Page:16
File Type:pdf, Size:1020Kb
Appendix A THE SIMPLEX METHOD FOR LINEAR PROGRAMMING PROBLEMS A.l Introduction This introduction to the simplex method is along the lines given by Chvatel (1983). Here consider the maximization problem: maximize Z = c-^x such that Ax < b, A an m x n matrix (A.l) 3:^2 > 0, i = 1,2, ...,n. Note that Ax < b is equivalent to ^1^=1 ^ji^i ^ ^j? j = 1, 2,..., m. Introduce slack variables Xn-^i,Xn-^2^ "",Xn-j-m > 0 to transform the in- 234 APPENDIX A. equality constraints to equality constraints: aiiXi + . + ainXn + Xn+l = ^1 a2lXi + . + a2nXn + Xn-\-2 = h (A.2) or [A;I]x = b where x = [a;i,a;2, ...,Xn+m]^,b = [^i, 62, ...,öm]^, and xi, 0:2,..., Xn > 0 are the original decision variables and Xn-\-i^Xn-\-2^ "">^n-\-m ^ 0 the slack variables. Now assume that bi > 0 for all i, To start the process an initial feasible solution is then given by: Xn+l = bi Xn+2 = b2 with xi = X2 = " ' = Xn = 0. In this case we have a feasible origin. We now write system (A.2) in the so called standard tableau format: Xn-^l = 61 - anXi - ... - ainXn > 0 (A.3) Z = CiXi + C2X2 + . + Cn^n The left side contains the basic variables^ in general 7^ 0, and the right side the nonbasic variables^ all = 0. The last line Z denotes the objective function (in terms of nonbasic variables). SIMPLEX METHOD FOR LP PROBLEMS 235 In a more general form the tableau can be written as XB2 = b2- a2lXNl - ... - a2nXNn > 0 (A.4) XBm = bm- amlXNl "... - amn^Nn > 0 Z = CNlXNl + CN2XN2 + • . + CjsfnXNn The > at the right serves to remind us that Xßj > 0 is a necessary condition, even when the values of Xjvi change from their zero values. Xß = vector of basic variables and x^v = vector of nonbasic variables represent a basic feasible solution. A.2 Pivoting for increase in objective function Clearly if any c^vp > 0, then Z increases if we increase x^p^ with the other xjsfi = 0,2 /p. Assume further that cjsfp > 0 and cjsfp > cjsn^i = 1, 2,..., n, then we decide to increase xjsfp. But xjsfp can not be increased indefinitely because of the constraint x^ > 0 in tableau (A.4). Every entry i in the tableau, with aip > 0, yields a constraint on XNp of the form: 0 < xj^p <—^ = di, i = l,2, ...,m. (A.5) Assume now that i = k yields the strictest constraint, then let Xßk = 0 and xjsfp — d^. Now XBk{= 0) is the outgoing variable (out of the base), and xjsfp = dk{^ 0) the incoming variable. The k-th. entry in tableau (A.4) changes to XNp = dk- 22'^kiXNi - äkkXBk (A.6) iy^k with äki = Clki/(^kpi Ö^kk = ^/(^kp' Replace XNp by (A.6) in each of the remaining m — 1 entries in tableau (A.4) as well as in the objective function Z. With (A.6) as the first entry this gives the new tableau in terms of the new basic variables: XBi, XB2,. • •, XNp,..., XBm (left side) 7^ 0 236 APPENDIX A. and nonbasic variables: ^ivi, ^iV2,. •., XBk,. •., XNn (right side) = 0. As xjsfp has increased with dj^, the objective function has also increased by cj^pdk' The objective function (last) entry is thus of the form Z = CNpdk + CNlXjSfl + CN2XN2 H ^" CNm^Nm where the Xjvi now denotes the new nonbasic variables and cj^i the new associated coefficients. This completes the first pivoting iteration. Repeat the procedure above until a tableau is obtain such that Z = Z* + CNIXNI H h CNmXNm with CNi < 0, i = 1, 2, ..., m. The optimal value of the objective function is then Z — Z"" (no further increase is possible). A. 3 Example maximize Z = 5xi -{- 4x2 + ^^s such that 2x1 + 3x2 + X3 < 5 4x1 H-^2 4-2x3 < 11 3x1 -f 4x2 4- 2x3 < 8 3^1,2:2,3:3 > 0. This problem has a> feasible origin. Introduce slack variables X4,X5 and XQ and then the first tableau is given by: I: X4 = 5 -- 2x1 - 3X2 - X3 >o XI < 5/2(5) X5 — 11 -- 4xi - X2 - 2X3 >o xi < 11/4 xe — 8 -- 3x1 - 4X2 - 2X3 >o xi < 8/3 Z = 5x1 T~ 4X2 ~T~ 3X3 Here 5 > 0 and 5 > 4 > 3. Choose thus xi as incoming variable. To find the outgoing variable, calculate the constraints on xi for all the entries SIMPLEX METHOD FOR LP PROBLEMS 237 (see right side). The strictest {s) constraint is given by the first entry, and thus the outgoing variable is 0:4. The first entry in the next tableau is 1, Xi = \-\X2- ^X3 )x^. Replace this expression for xi in all other entries to find the next tableau: 5 3 1 1 dj\ — 2 52 9*^3 94 >0 X5 = II - A{\ - 1x2 - \X2, - \X4) — X2 — 2X3 ^ 0 4x4) — x4x2 — 2x3 > 0 XQ = 8-3(f - |X2- ^X3- 5(1 "pr 2^3 ^X4) 4- 4X2 + 3X3 After simplification we obtain the second tableau in standard format: II: 5 Xl — 2 - 1X2 - ^xs - 2X4 >o X3 < 5 ^5 = 1 + 5X2 + 2X4 >o no bound 1 X6 = + |X2 - hs H- 2X4 >o X3 < 1(5) 25 - - 2X4 z = 5 2^2 + 2^3 This completes the first iteration. For the next step it is clear that X3 is the incoming variable and consequently the outgoing variable is XQ. The first entry for the next tableau is thus X3 = 1 + X2 + 3x4 ~ 2x6 (3-rd entry in previous tableau). Replace this expression for X3 in all the remaining entries of tableau II. After simplification we obtain the third tableau: III: ^3 = 1 + X2 -f- 3x4 — 2x6 ^ 0 Xl = 2 — 2X2 — 2X4 + ^6^0 X5 z= 1 + 5X2 + 2X4 > 0 Z - 13 3X2 X4 X6 In the last entry all the coefficients of the nonbasic variables are negative. Consequently it is not possible to obtain a further increase in Z by increasing one of the nonbasic variables. The optimal value of Z is thus Z* = 13 with x\ = 2 ; X2 = 0 ; X3 = 1. 238 APPENDIX A. Assignment A.l Solve by using the simplex method: maximize z = 3xi + 2x2 + 4x3 such that 2x1 4- 3x3 < 5 2x1 + X2 + 3x3 < 7 3:i,X2,X3 > 0. A-4 The auxiliary problem for problem with in- feasible origin In the previous example it is possible to find the solution using the simplex method only because hi > 0 for all i and an initial solution x^ = 0 , i = 1, 2, ...n with Xn-{-j = ^j, j — 1, 2,..., m was thus feasible, that is, the origin is a feasible initial solution. If the LP problem does not have a feasible origin we first solve the so called auxiliary problem: Phase 1: maximize W = —XQ such that X^^,=i cijiXi — XQ < hj, j = 1, 2,..., m (A-.7) Xi >0^ 2 = 0,1,2, ...n where XQ is called the new artificial variable. By setting Xi = 0 for i = 1, 2, ...n and choosing XQ large enough, we can always find a feasible solution. The original problem clearly has a feasible solution if and only if the auxiliary problem has a feasible solution with XQ = 0 or, in other words, the original problem has a feasible solution if and only if the optimal value of the auxiliary problem is zero. The original problem is now solved using the simplex method, as described in the previous sections. This solution is called Phase 2. SIMPLEX METHOD FOR LP PROBLEMS 239 A.5 Example of auxiliary problem solution Consider the LP: maximize Z •= xi — X2 + x^, such that 2x1 - X2 + 0:3 < 4 2xi — 3x2 -f 3:3 < -5 -xi -\- X2- 2x3 < -1 Xi,X2,X2, > 0. Clearly this problem does not have a feasible origin. We first perform Phase 1: Consider the auxiliary problem: maximize W = —XQ such that 2x1 - X2-{- 2x3 - a^o < 4 2xi — 3x2 4- X3 — xo < —5 -xi + X2 - 2x3 - ^0 < -1 Xo,Xi,X2,X3 > 0. Introduce the slack variables X4, X5 and xe, which gives the tableau (not yet in standard form): X4 = 4 - 2x1 + X2 - 2X3 + Xo > 0 Xo > -4 X5 = -5 - 2x1 + 3X2 - X3 + xo > 0 Xo > 5(5) XQ = -1 + __Xl_ - ^2 -f- 2X3 + _Xo_ > 0 Xo > 1 w = - xo This is not in standard form as XQ on the right is not zero. With xi = 0:2 = X3 = 0 then X4, X5, X6 > 0 if Xo > max{—4; 5; 1}. Choose Xo = 5, as prescribed by the second (strictest) entry. This gives X5 = 0, X4 = 9 and XQ = 4. Thus xo is a basic variable (f^ 0) and X5 a nonbasic variable. The first standard tableau can now be write as I: 240 APPENDIX A. Xo — 5 + 2x1 - 3X2 + ^z + ^5 > 0 X2<| 0:4 — 9 - 2x2 - ^3 + 2:5 > 0 X2< 1 x^ — 4 + 3x1 - 4x2 + 3X3 + ^5 > 0 X2 < 1(5) W = -5 - 2x1 + 3X2 - a^3 - X5 Now apply the simplex method. From the last entry it is clear that W increases as X2 increases. Thus X2 is the incoming variable. With the strictest bound X2 < 1 as prescribed by the third entry the outgoing variable is XQ. The second tableau is given by: II: X2 = 1 + 0.75x1+ 0.75x3+ 0.25x5- 0.25x6> 0 no bound Xo = 2- 0.25x1- 1.25x3+ 0.25x5- 0.75x6> 0 X4 = 7- 1.5x1 — 2.5x3+ 0.5X5+ 0.5x6> 0 W = -2+ 0.25x1+ 1.25x3- 0.25x5- 0.75x6 The new incoming variable is X3 and the outgoing variable XQ.