VIEWS: 37 PAGES: 29 POSTED ON: 5/27/2012 Public Domain
The Simplex Method The Two-Phase Simplex Method Expanding Our Reach Until now, we have only considered LPs with “<=” constraints, nonnegative variables, and nonnegative right-hand-side values. Why? – Remember that simplex needs a place to start – it must start from a bfs then move to another bfs to improve the objective value. – With these assumptions, we can obtain an initial bfs/dictionary by letting all slack variables be basic, all original variables be nonbasic. Expanding Our Reach Obviously, these assumptions do not hold for every LP. What do we do when they don’t? This is where Two-Phase Simplex comes in. It involves two phases (thus the name!): – Phase I: Works to achieve feasibility. – Phase II: Works to achieve optimality. Example: Two-Phase max z 3 x1 x2 Step 1: make all s.t. x1 x2 1 right-hand-side Values nonnegative. 2 x1 x2 4 x1 x2 3 max z 3 x1 x 2 x1 , x2 0 s.t. x1 x 2 1 2 x1 x 2 4 x1 x 2 3 x1 , x 2 0 Example: Two-Phase max z 3 x1 x 2 s.t. x1 x 2 1 Step 2: put the LP 2 x1 x 2 4 in standard form. x1 x 2 3 x1 , x 2 0 max z 3 x1 x 2 s.t. x1 x 2 e1 1 2 x1 x 2 s2 4 x1 x 2 3 x1 , x 2 0 Example: Two-Phase max z 3 x1 x 2 s.t. x1 x 2 e1 1 2 x1 x 2 s2 4 x1 x 2 3 x1 , x 2 0 What if we wrote z 3 x1 x 2 the initial e1 1 x1 x 2 Infeasible! dictionary? s2 4 2 x1 x 2 ? ????? Basic var? Artifical Variables When we had a slack variable in each constraint, it was easy to find an initial bfs to initiate simplex. When there are rows without slack variables, it isn’t so obvious how to begin simplex. To deal with the problem, we will use artificial variables. Essentially, we will invent a basic variable for each row without a slack (we will use the slacks when they are available). Example: Two-Phase (cont’d) max z 3 x1 x 2 s.t. x1 x 2 e1 1 Step 3: add an 2 x1 x 2 s2 4 artificial variable to each row x1 x 2 3 without a slack. x1 , x 2 0 max z 3 x1 x 2 s.t. x1 x 2 e1 a1 1 2 x1 x 2 s2 4 x1 x 2 a3 3 x1 , x 2 0 Example: Two-Phase (cont’d) max z 3 x1 x 2 s.t. x1 x 2 e1 a1 1 2 x1 x 2 s2 4 x1 x 2 a3 3 x1 , x 2 0 z 3 x1 x 2 Step 4: write the initial dictionary, a1 1 x1 x 2 e1 using slack and artificial variables as s2 4 2 x1 x 2 basic variables. a3 3 x1 x 2 A Problem We have essentially made up extra variables to make our lives easier. Is this a valid thing to do? Yes and no. We can not start simplex with a bfs that utilizes artificial variables. We can use artificial variables as a tool to obtain a starting bfs. Solving the Problem How do we use them? Starting with our dictionary that uses artificial variables, we use simplex to find a bfs in which all artificial variables are equal to zero. Then they don’t affect the real solution. x1 x2 e1 X1 a 1 2 x1 x2 s2 4 x1 x2 X3 3 a x1 , x 2 0 Forcing Artificials = 0 To force all artificial variables to be zero, we minimize the sum of all artifical variables. – If the minimum is zero, then all artificial variables equal zero (this is what we want!!) – If the minimum is nonzero, then some artificial variable is positive. This implies feasibility!!! Example: Two-Phase (cont’d) Step 5: replace the objective with minimizing the sum of all artificial variables (call it “w” to keep it separate from the original objective). min w a1 a3 s.t. x1 x 2 e1 a1 1 2 x1 x 2 s2 4 x1 x 2 a3 3 x1 , x 2 0 Example: Two-Phase (cont’d) min w a1 a3 s.t. x1 x 2 e1 a1 1 2 x1 x 2 s2 4 x1 x 2 a3 3 x1 , x 2 0 If the objective value is zero, then both artificial variables are also zero, and we have found a feasible solution to our original LP. Otherwise, one of the artificial variables has a postive value, and there is no feasible solution to our original LP. If there IS a feasible solution, the minimum will be zero. Example: Two-Phase (cont’d) min w a1 a3 s.t. x1 x 2 e1 a1 1 2 x1 x 2 s2 4 x1 x 2 a3 3 x1 , x 2 0 The LP given above (original constraints with artificial variables, and new objective) is called the Phase I Linear Program. Example: Two-Phase (cont’d) Write the dictionary for the Phase I LP: Basic variables on the right-hand-side!! w a1 a 2 a1 1 x1 x 2 e1 Step 6: write the new objective in terms of s2 4 2 x1 x 2 nonbasic variables. a3 3 x1 x 2 Example: Two-Phase (cont’d) w a1 a 2 a1 1 x1 x 2 e1 s2 4 2 x1 x 2 a3 3 x1 x 2 w 4 2 x 2 e1 a1 1 x1 x 2 e1 s2 4 2 x1 x 2 a3 3 x1 x 2 Example: Two-Phase (cont’d) w 4 2 x 2 e1 Step 7: solve the a1 1 x1 x 2 e1 Phase I LP. s2 4 2 x1 x 2 Entering Variable? (Remember: a3 3 x1 x 2 we’re minimizing!) a1 1 x2 0 x2 1 Leaving s2 4 x 2 0 x 2 4 Variable? a3 3 x 2 0 x 2 3 Example: Two-Phase (cont’d) w 2 2 x1 e1 2a1 Step 7: solve the x 2 1 x1 e1 a1 Phase I LP. s2 3 3 x1 e1 a1 Entering Variable? a3 2 2 x1 e1 a1 x2 1 x1 0 No restriction! Leaving s2 3 3 x1 0 x1 1 Tie!! Either is a valid Variable? a3 2 2 x1 0 x1 1 choice for leaving variable. Word of Advice….. If there is a tie for leaving variable, always choose an artificial variable over another variable. If there is more than one candidate for entering variable, avoid choosing an artifical variable. The goal is to make all artifical variables zero, which can be achieved by making them nonbasic!!! Example: Two-Phase (cont’d) x2 1 x1 0 No restriction! s2 3 3 x1 0 x1 1 a3 2 2 x1 0 x1 1 w 0 a1 a3 x1 1 1 e1 1 a1 1 a3 2 2 2 New dictionary: x2 2 1 e1 1 a1 1 a3 2 2 2 s2 0 1 e1 1 a1 3 a3 2 2 2 Example: Two-Phase (cont’d) w 0 X 1 a3 a X x1 1 1 e1 1 a1 1 X 3 2 2 X 2a x2 2 1 e1 1 a1 1 a3 2 2 X 2 X s2 0 1 e1 1 a1 3 a3 2 2 X 2 X This dictionary represents a bfs in which all artificial variables are nonbasic. Since both artificial variables equal zero, we can delete them from the dictionary without destroying our current solution. Remember Phase I is concerned only with feasibility, not optimality. The primary aim of Phase I is to obtain a bfs with which to start simplex. Notice that we essentially solve an LP (using simplex!) to find this bfs. Example: Two-Phase (cont’d) Now that we have eliminated Step 8: replace the the artificial variables, we can original objective, in go back to our original terms of nonbasic objective, which is to maximize z!! variables. This creates the Phase II LP. z 3 x1 x 2 x1 1 1 e1 2 z 5 e1 x 2 2 1 e1 2 Basic variables on x1 1 1 e1 the right-hand- 2 s2 0 1 e1 2 side!! x 2 2 1 e1 2 s2 0 1 e1 2 Example: Two-Phase (cont’d) z 5 e1 Step 9: Optimize the Phase II LP. x1 1 1 e1 2 x 2 2 1 e1 2 Since we are maximizing z, s2 0 1 e1 2 this dictionary/bfs is optimal!! If it weren’t optimal, we could continue with simplex as usual. One more possibility…. What if the Phase I LP is degenerate? That is, what if we reach optimality (so that all artificial variables are zero), but one of the artificial variables is basic? Proceed with the Phase II LP, eliminating all nonbasic artificial variables. As soon as any of the remaining artificial variables becomes nonbasic, delete it. Recap Step 1: make all right-hand-side values nonnegative. Step 2: put the LP in standard form. Step 3: add an artificial variable to each row without a slack. Step 4: write the initial dictionary, using slack and artificial variables as basic variables. Step 5: replace the objective with minimizing the sum of all artificial variables (call it “w” to keep it separate from the original objective). Recap Step 6: write the new objective in terms of nonbasic variables. Step 7: solve the Phase I LP. If w > 0, the original LP is infeasible. Step 8: replace the original objective, in terms of nonbasic variables. Delete all nonbasic artificial variables. This creates the Phase II LP. Step 9: Optimize the Phase II LP. As artificial variables become nonbasic, delete them. Recap Three outcomes when solving Phase I LP: – Minimum w > 0: LP infeasible – Mimimum w = 0, all artificial variables nonbasic: • replace objective • delete artificial variables • continue with Phase II – Minimum w = 0, some artificial variable basic (and equal to zero): • replace objective • delete nonbasic artificial variables • continue with Phase II • delete each artificial variable as it becomes nonbasic.