Presentation on theme: "16.410: Eric Feron / MIT, Spring 2001 Introduction to the Simplex Method to solve Linear Programs Eric Feron Spring 2001."— Presentation transcript:
16.410: Eric Feron / MIT, Spring 2001 Introduction to the Simplex Method to solve Linear Programs Eric Feron Spring 2001
16.410: Eric Feron / MIT, Spring 2001 Algorithms The simplex algorithm: before all, an algorithm The way an algorithm works: –Initialization step –Iteration step –Optimality test (stopping rule) –Exit No? Yes?
16.410: Eric Feron / MIT, Spring 2001 Assumption, basic results for simplex If there is exactly one optimal solution, it is corner point feasible If there are multiple optimal solutions, then at least two must be adjacent; That is, connected by an edge of the constraint polytope There are only a finite number of feasible corner-point solutions If a corner-point solution has no adjacent corner-point solution that is better, then it is optimal
16.410: Eric Feron / MIT, Spring 2001 Essence of the simplex method Step 1: Start at a corner-point feasible solution (Initialization) Step 2: Move to a better adjacent feasible solution Step 3: Optimality test. The corner-point solution is optimal when no better adjacent corner-point solution can be found. A really simple algorithm, if we have good book keeping procedures.
16.410: Eric Feron / MIT, Spring 2001 Setting up the simplex method 1 2 3 4 5 (2,6) x2x2 x1x1 Maximize Z=3x1 + 5x2 Subject to: x1 <= 4 x2 <= 6 3x1 + 2x2 <= 18 x1 >= 0 x2 >= 0 First step: Add SLACK variables Slack variables are a way to locate the current point with respect to all the constraints Let x=(x1, x2) Distance from x to x2=0 is x1 Distance from x to x1=0 is x2 Distance from x to x1=4 is 4-x1=x3 Distance from x to x2=6 is 6-x2=x4 x3x3 x4x4 x5x5 Distance from x to 3x1+2x2=18 is proportional to 18-3x1-2x2=x5
16.410: Eric Feron / MIT, Spring 2001 Salck variables (ct'd) So we can characterize the position of any point x in the decision space by its distance to all the constraints x1, x2, x3, x4, and x5 That's a new, generalized coordinate system (obviously highly redundant) Any corner point is the intersection of two constraints: For example the origin 1 is the intersection of x1>= 0 and x2>=0 In general, corner points are defined by two of the generalized coordinates vanishing to zero
16.410: Eric Feron / MIT, Spring 2001 Basic, nonbasic variables At the origin zero, these distances are zero: x1=0 x2=0 And the other distances are nonzero: x3 = 4 x4 = 6 x5=18 Consider now the point (2,6) (numbered 3). At that point: x4=0 x5=0 x1=2 x2=6 x3=2 These are called nonbasic variables These are called basic variables These are the active constraints, nonbasic variables These are the nonactive constraints, basic variables
16.410: Eric Feron / MIT, Spring 2001 1 2 3 4 5 (2,6) Simplex method, illustrated Rewriting the original optimization problem with x1,x2,x3,x4,x5 Maximize: Z=3x1+5x2 Subject to: x1+x3=4 x2+x4=6 3x1+2x2+x5=18 (2,6)-centric coordinates: Express x1, x2, x3, Z as functions of (x4, x5) From (0, 6)-centric coordinates, we get x1=6/3+2/3x4-x5/3 x2=6-x4 x3=4-x1=4-6-2/3x4+x5/3 and Z=30+3x1-5x4 =30+6+2x4-x5-5x4 =36-3x4-x5 Cost at (2,6) is 36 There is no way to improve => So we're done. x5 x4 (0,6)-centric coordinates Z=30+3x1-5x4 (Z at (0,6) is 30) (a) x1+x3=4 (b) x4+x2=6 (c) 3x1-2x4+x5=6 We can obtain an improvement of Z by moving x1 up. How far up? (a) says 4, (b) says nothing, (c) says 2=>so x1 moves to 2 => so x4 becomes the new nonbasic variable. (2,6) is the new corner-point feasible solution. x1 x4 Look at the cost function. Which decision variable has best marginal gain. x2, of course. (However that's only a heuristic. Picking x1 would work too.) Choice of x1 or x2 (ct'd) How far can we move x2? That depends on the constraints! In our case the constraint x2=6 is hit first (that's easy to see). Thus the new corner point is x1=0 x4=0 x1 x2 x2x2 x1x1 A problem formulation that's well adapted to start from (0,0): Can find out cost & x3, x4, x5 as a function of x1, x2 easily: "(0,0)- centric coordinates" x1=0 and x2=0 are the current active constraints. Let's try to move away from one of these constraints: –Either make x1>0 –Or make x2>0 –Which one do we pick? Same problem Z=3x1+5(6-x4) x1+x3=4 x4+x2=6 3x1+2(6-x4)+x5=18 Same problem Z=30+3x1-5x4 x1+x3=4 x4+x2=6 3x1-2x4+x5=6 x2,x3,x5 found easily as functions of x1, x4 New, (0,6)-centric coordinates (x1,x4) make new "natural coordinate axes" x4 x1
16.410: Eric Feron / MIT, Spring 2001 Your example Maximize Z=4x1+3x2+6x3 Subject to 3x1+x2+3x3<=30 2x1+2x2+3x3<=40 x1>=0, x2>=0, x3>=0
Your consent to our cookies if you continue to use this website.