360 likes | 368 Views
Learn the Simplex Algorithm for linear programming, from basic solutions to finding optimal solutions using the tableau method. Step-by-step guide and examples are provided. Be the first in your neighborhood to solve LPs effectively!
E N D
Well, just how many basic solutions are there?!!!
ways to select the n variables to set equal to zero or equivalently the m basic variables. Basic Solutions Let n = the number of variables m = the number of constraints After adding slack variables, there are n + m variables. Since a basic solution requires setting n variables to zero and solving uniquely for the remaining variables, there are If n = 20 and m = 10 (a trivially small problem), then 30!/(20! 10!) = 30,045,015. (not all are feasible)
Basic Solutions Again! • Augmented solution - solution to the problem after slack variables have been added. • Basic solution - augmented corner point solution obtained by setting n variables to zero and solving for the remaining. • Basic feasible solution (BFS) - feasible basic solution. • Basic variables - variables that were solved for in the basic solution. • Non-basic variables - variables set equal to zero in the basic solution.
I can do this! Outline of the Simplex Algorithm • Start at a basic feasible solution (BFS) • (often the origin) • Move to a better basic feasible solution • the objective function improves • Stop when the basic feasible solution is better than all adjacent basic feasible solutions. • Solution is optimal
Now - Presenting the Simplex Algorithm! Be the first in your neighborhood to master this exciting and wonderful numerical, recursive process for solving linear programs. Two students discussing the high points of the simplex algorithm.
Max z - 6x1 - 4x2 = 0 Subj. to: x1 + x2 + x3 = 12 x1 - 2x2 + x4 = 6 x2 + x5 = 8 The Simplex Tableau-1 Basic Eq Var z x1 x2 x3 x4 x5 RHS
Max z - 6x1 - 4x2 = 0 Subj. to: x1 + x2 + x3 = 12 x1 - 2x2 + x4 = 6 x2 + x5 = 8 The Simplex Tableau-2 Basic Eq Var z x1 x2 x3 x4 x5 RHS 0 z 1 -6 -4 0 0 0 0
Max z - 6x1 - 4x2 = 0 Subj. to: x1 + x2 + x3 = 12 x1 - 2x2 + x4 = 6 x2 + x5 = 8 The Simplex Tableau-3 Basic Eq Var z x1 x2 x3 x4 x5 RHS 0 z 1 -6 -4 0 0 0 0 1 x3 0 1 1 1 0 0 12
Max z - 6x1 - 4x2 = 0 Subj. to: x1 + x2 + x3 = 12 x1 - 2x2 + x4 = 6 x2 + x5 = 8 The Simplex Tableau-4 Basic Eq Var z x1 x2 x3 x4 x5 RHS 0 z 1 -6 -4 0 0 0 0 1 x3 0 1 1 1 0 0 12 2 x4 0 1 -2 0 1 0 6
Max z - 6x1 - 4x2 = 0 Subj. to: x1 + x2 + x3 = 12 x1 - 2x2 + x4 = 6 x2 + x5 = 8 The Simplex Tableau-5 Basic Eq Var z x1 x2 x3 x4 x5 RHS 0 z 1 -6 -4 0 0 0 0 1 x3 0 1 1 1 0 0 12 2 x4 0 1 -2 0 1 0 6 3 x5 0 0 1 0 0 1 8
The Simplex Algorithm-1 Step 1: Select a new variable to enter the basis. Basic Eq Var z x1 x2 x3 x4 x5 RHS 0 z 1 -6 -4 0 0 0 0 1 x3 0 1 1 1 0 0 12 2 x4 0 1 -2 0 1 0 6 3 x5 0 0 1 0 0 1 8
Pick the non-basic variable having the greatest negative value. z = 6x1 + 4x2 The Simplex Algorithm-2 Step 1: Select a new variable to enter the basis. Basic Eq Var z x1 x2 x3 x4 x5 RHS 0 z 1 -6 -4 0 0 0 0 1 x3 0 1 1 1 0 0 12 2 x4 0 1 -2 0 1 0 6 3 x5 0 0 1 0 0 1 8
Step 2a: Select a basic variable to leave the basis. Basic Eq Var z x1 x2 x3 x4 x5 RHS 0 z 1 -6 -4 0 0 0 0 1 x3 0 1 1 1 0 0 12 2 x4 0 1 -2 0 1 0 6 3 x5 0 0 1 0 0 1 8
Ratio 12/1 6/1 Step 2b: Select a basic variable to leave the basis. Pick the basic variable having the smallest ratio of the RHS divided by the corresponding positive coefficient from the incoming variable. Basic Eq Var z x1 x2 x3 x4 x5 RHS 0 z 1 -6 -4 0 0 0 0 1 x3 0 1 1 1 0 0 12 2 x4 0 1 -2 0 1 0 6 3 x5 0 0 1 0 0 1 8
Ratio 12/1 6/1 pivot point Step 2c: Select a basic variable to leave the basis. Pick the basic variable having the smallest ratio of the RHS divided by the corresponding positive coefficient from the incoming variable. 1x1 - 2x2 + x4 = 6 Basic Eq Var z x1 x2 x3 x4 x5 RHS 0 z 1 -6 -4 0 0 0 0 1 x3 0 1 1 1 0 0 12 2 x4 0 1 -2 0 1 0 6 3 x5 0 0 1 0 0 1 8
Basic Eq Var z x1 x2 x3 x4 x5 RHS 0 z 1 x3 2 x1 3 x5 Basic Eq Var z x1 x2 x3 x4 x5 RHS 0 z 1 -6 -4 0 0 0 0 1 x3 0 1 1 1 0 0 12 2 x4 0 1 -2 0 1 0 6 3 x5 0 0 1 0 0 1 8 Step 3a: Use row operations to find the new basic solution.
Basic Eq Var z x1 x2 x3 x4 x5 RHS 0 z 1 x3 2 x1 3 x5 Basic Eq Var z x1 x2 x3 x4 x5 RHS 0 z 1 -6 -4 0 0 0 0 1 x3 0 1 1 1 0 0 12 2 x4 0 1 -2 0 1 0 6 3 x5 0 0 1 0 0 1 8 Step 3b: Use row operations to find the new basic solution. 0 1 -2 0 1 0 6
Basic Eq Var z x1 x2 x3 x4 x5 RHS 0 z 1 x3 2 x1 3 x5 Basic Eq Var z x1 x2 x3 x4 x5 RHS 0 z 1 -6 -4 0 0 0 0 1 x3 0 1 1 1 0 0 12 2 x4 0 1 -2 0 1 0 6 3 x5 0 0 1 0 0 1 8 Step 3c: Use row operations to find the new basic solution. 0 1 -2 0 1 0 6 0 0 1 0 0 1 8
Basic Eq Var z x1 x2 x3 x4 x5 RHS 0 z 1 x3 2 x1 3 x5 Basic Eq Var z x1 x2 x3 x4 x5 RHS 0 z 1 -6 -4 0 0 0 0 1 x3 0 1 1 1 0 0 12 2 x4 0 1 -2 0 1 0 6 3 x5 0 0 1 0 0 1 8 Step 3d: Use row operations to find the new basic solution. 0 0 3 1 -1 0 6 0 1 -2 0 1 0 6 0 0 1 0 0 1 8
Basic Eq Var z x1 x2 x3 x4 x5 RHS 0 z 1 x3 2 x1 3 x5 Basic Eq Var z x1 x2 x3 x4 x5 RHS 0 z 1 -6 -4 0 0 0 0 1 x3 0 1 1 1 0 0 12 2 x4 0 1 -2 0 1 0 6 3 x5 0 0 1 0 0 1 8 Step 3e: Use row operations to find the new basic solution. 1 0 -16 0 6 0 36 0 0 3 1 -1 0 6 0 1 -2 0 1 0 6 0 0 1 0 0 1 8
Max z = 6x1 + 4x2 Subj. to: x1 + x2 <= 12 x1 -2x2 <= 6 x2 <= 8 x2 12 8 (4,8) z z (10,2) x1 6 12 -3
z = 6x1 + 4x2 2nd Iteration-1 Now Sally, you want to pick the new variable to enter the basis. Basic Eq Var z x1 x2 x3 x4 x5 RHS 0 z 1 0 -16 0 6 0 36 1 x3 0 0 3 1 -1 0 6 2 x1 0 1 -2 0 1 0 6 3 x5 0 0 1 0 0 1 8
Pick the non-basic variable having the greatest negative value. z = 6x1 + 4x2 2nd Iteration-2 Basic Eq Var z x1 x2 x3 x4 x5 RHS 0 z 1 0 -16 0 6 0 36 1 x3 0 0 3 1 -1 0 6 2 x1 0 1 -2 0 1 0 6 3 x5 0 0 1 0 0 1 8
Find minimum ratio Ratio 6/3 8/1 z = 6x1 + 4x2 2nd Iteration-3 Basic Eq Var z x1 x2 x3 x4 x5 RHS 0 z 1 0 -16 0 6 0 36 1 x3 0 0 3 1 -1 0 6 2 x1 0 1 -2 0 1 0 6 3 x5 0 0 1 0 0 1 8
Find minimum ratio Ratio 6/3 8/1 Pivot point z = 6x1 + 4x2 2nd Iteration-4 Basic Eq Var z x1 x2 x3 x4 x5 RHS 0 z 1 0 -16 0 6 0 36 1 x3 0 0 3 1 -1 0 6 2 x1 0 1 -2 0 1 0 6 3 x5 0 0 1 0 0 1 8
Basic Eq Var z x1 x2 x3 x4 x5 RHS 0 z 1 x2 2 x1 3 x5 Basic Eq Var z x1 x2 x3 x4 x5 RHS 0 z 1 0 -16 0 6 0 36 1 x3 0 0 3 1 -1 0 6 2 x1 0 1 -2 0 1 0 6 3 x5 0 0 1 0 0 1 8 2nd Iteration-5
Basic Eq Var z x1 x2 x3 x4 x5 RHS 0 z 1 x2 2 x1 3 x5 Basic Eq Var z x1 x2 x3 x4 x5 RHS 0 z 1 0 -16 0 6 0 36 1 x3 0 0 3 1 -1 0 6 2 x1 0 1 -2 0 1 0 6 3 x5 0 0 1 0 0 1 8 2nd Iteration-6 0 0 1 1/3 -1/3 0 2
Basic Eq Var z x1 x2 x3 x4 x5 RHS 0 z 1 x2 2 x1 3 x5 Basic Eq Var z x1 x2 x3 x4 x5 RHS 0 z 1 0 -16 0 6 0 36 1 x3 0 0 3 1 -1 0 6 2 x1 0 1 -2 0 1 0 6 3 x5 0 0 1 0 0 1 8 2nd Iteration-7 0 0 1 1/3 -1/3 0 2 0 1 0 2/3 1/3 0 10
Basic Eq Var z x1 x2 x3 x4 x5 RHS 0 z 1 x2 2 x1 3 x5 Basic Eq Var z x1 x2 x3 x4 x5 RHS 0 z 1 0 -16 0 6 0 36 1 x3 0 0 3 1 -1 0 6 2 x1 0 1 -2 0 1 0 6 3 x5 0 0 1 0 0 1 8 2nd Iteration-8 0 0 1 1/3 -1/3 0 2 0 1 0 2/3 1/3 0 10 0 0 0 -1/3 1/3 1 6
Basic Eq Var z x1 x2 x3 x4 x5 RHS 0 z 1 x2 2 x1 3 x5 Basic Eq Var z x1 x2 x3 x4 x5 RHS 0 z 1 0 -16 0 6 0 36 1 x3 0 0 3 1 -1 0 6 2 x1 0 1 -2 0 1 0 6 3 x5 0 0 1 0 0 1 8 2nd Iteration-9 1 0 0 16/3 2/3 0 68 0 0 1 1/3 -1/3 0 2 0 1 0 2/3 1/3 0 10 0 0 0 -1/3 1/3 1 6
Basic Eq Var z x1 x2 x3 x4 x5 RHS 0 z 1 x2 2 x1 3 x5 2nd Iteration-10 Clearly, this solution must be optimal. What does it mean to be optimal? 1 0 0 16/3 2/3 0 68 0 0 1 1/3 -1/3 0 2 0 1 0 2/3 1/3 0 10 0 0 0 -1/3 1/3 1 6
Max z = 6x1 + 4x2 Subj. to: x1 + x2 <= 12 x1 -2x2 <= 6 x2 <= 8 x2 12 8 (4,8) z z (10,2) x1 6 12 -3
After the SimplexWhat can go wrong? • Minimization rather than maximization • Unbounded solutions • Alternate solutions • No feasible solution
Wanna bet! Wait until you see sensitivity analysis. What’s Next? It just doesn’t get any better than this!
Can we work another of these simplex problems next class? I think I understand how to find the most negative value and the smallest ratio, but I get dizzy when I pivot.