Chapter 4 The Simplex Algorithm Part I

Similar documents
The Simplex Algorithm and Goal Programming

The Graphical Method & Algebraic Technique for Solving LP s. Métodos Cuantitativos M. En C. Eduardo Bustos Farías 1

The Simplex Algorithm

Sensitivity Analysis and Duality

Linear Programming. Xi Chen. Department of Management Science and Engineering International Business School Beijing Foreign Studies University

Linear Programming. Dr. Xiaosong DING

Theory of Linear Programming

Chapter 4 The Simplex Algorithm Part II

IE 400 Principles of Engineering Management. The Simplex Algorithm-I: Set 3

END3033 Operations Research I Sensitivity Analysis & Duality. to accompany Operations Research: Applications and Algorithms Fatih Cavdur

The use of shadow price is an example of sensitivity analysis. Duality theory can be applied to do other kind of sensitivity analysis:

OPERATIONS RESEARCH. Michał Kulej. Business Information Systems

SEN301 OPERATIONS RESEARCH I LECTURE NOTES

6.2: The Simplex Method: Maximization (with problem constraints of the form )

The Simplex Method. Formulate Constrained Maximization or Minimization Problem. Convert to Standard Form. Convert to Canonical Form

Ω R n is called the constraint set or feasible set. x 1

IE 5531: Engineering Optimization I

Lesson 27 Linear Programming; The Simplex Method

Math Models of OR: Some Definitions

4. Duality and Sensitivity

IE 400: Principles of Engineering Management. Simplex Method Continued

Chapter 5 Linear Programming (LP)

MAT016: Optimization

c) Place the Coefficients from all Equations into a Simplex Tableau, labeled above with variables indicating their respective columns

Review Solutions, Exam 2, Operations Research

The Simplex Method. Lecture 5 Standard and Canonical Forms and Setting up the Tableau. Lecture 5 Slide 1. FOMGT 353 Introduction to Management Science

In Chapters 3 and 4 we introduced linear programming

Chapter 3 Introduction to Linear Programming PART 1. Assoc. Prof. Dr. Arslan M. Örnek

Yinyu Ye, MS&E, Stanford MS&E310 Lecture Note #06. The Simplex Method

Simplex Method for LP (II)

OPTIMISATION 3: NOTES ON THE SIMPLEX ALGORITHM

1. Introduce slack variables for each inequaility to make them equations and rewrite the objective function in the form ax by cz... + P = 0.

Week 3: Simplex Method I

Prelude to the Simplex Algorithm. The Algebraic Approach The search for extreme point solutions.

February 22, Introduction to the Simplex Algorithm

MATH 445/545 Test 1 Spring 2016

AM 121 Introduction to Optimization: Models and Methods Example Questions for Midterm 1

The Simplex Method. Standard form (max) z c T x = 0 such that Ax = b.

MATH 445/545 Homework 2: Due March 3rd, 2016

Dr. S. Bourazza Math-473 Jazan University Department of Mathematics

Simplex Method in different guises

Review Questions, Final Exam

Section 4.1 Solving Systems of Linear Inequalities

TIM 206 Lecture 3: The Simplex Method

Distributed Real-Time Control Systems. Lecture Distributed Control Linear Programming

ECE 307 Techniques for Engineering Decisions

Simplex Algorithm Using Canonical Tableaus

Standard Form An LP is in standard form when: All variables are non-negativenegative All constraints are equalities Putting an LP formulation into sta

Notes: Deterministic Models in Operations Research

Simplex tableau CE 377K. April 2, 2015

9.1 Linear Programs in canonical form

Linear Programming, Lecture 4

Part 1. The Review of Linear Programming

The Simplex Method for Solving a Linear Program Prof. Stephen Graves

Dr. Maddah ENMG 500 Engineering Management I 10/21/07

Notes: Deterministic Models in Operations Research

Introduction to LP. Types of Linear Programming. There are five common types of decisions in which LP may play a role

The Simplex Method of Linear Programming

Math Homework 3: solutions. 1. Consider the region defined by the following constraints: x 1 + x 2 2 x 1 + 2x 2 6

Fundamental Theorems of Optimization

MULTIPLE CHOICE. Choose the one alternative that best completes the statement or answers the question.

Chap6 Duality Theory and Sensitivity Analysis

OPERATIONS RESEARCH. Linear Programming Problem

56:171 Operations Research Midterm Exam - October 26, 1989 Instructor: D.L. Bricker

F 1 F 2 Daily Requirement Cost N N N

Lecture 4: Algebra, Geometry, and Complexity of the Simplex Method. Reading: Sections 2.6.4, 3.5,

Part 1. The Review of Linear Programming

Lecture 5 Simplex Method. September 2, 2009

CSC Design and Analysis of Algorithms. LP Shader Electronics Example

MATH2070 Optimisation

Gauss-Jordan Elimination for Solving Linear Equations Example: 1. Solve the following equations: (3)

1 Review Session. 1.1 Lecture 2

Introduction to the Simplex Algorithm Active Learning Module 3

Introduction. Very efficient solution procedure: simplex method.

Exam 3 Review Math 118 Sections 1 and 2

Study Unit 3 : Linear algebra

Week_4: simplex method II

"SYMMETRIC" PRIMAL-DUAL PAIR

ECE 307- Techniques for Engineering Decisions

Slide 1 Math 1520, Lecture 10

2. Linear Programming Problem

Algebraic Simplex Active Learning Module 4

Chapter 1: Linear Programming

Lecture slides by Kevin Wayne

Linear programming: algebra

Sensitivity Analysis and Duality in LP

Presentation by: H. Sarper. Chapter 2 - Learning Objectives

Optimization. Broadly two types: Unconstrained and Constrained optimizations We deal with constrained optimization. General form:

Graphical and Computer Methods

Slack Variable. Max Z= 3x 1 + 4x 2 + 5X 3. Subject to: X 1 + X 2 + X x 1 + 4x 2 + X X 1 + X 2 + 4X 3 10 X 1 0, X 2 0, X 3 0

Sensitivity Analysis

Linear Programming. Linear Programming I. Lecture 1. Linear Programming. Linear Programming

Simplex Method. Dr. rer.pol. Sudaryanto

56:171 Operations Research Fall 1998

Linear Programming: Chapter 5 Duality

Systems Analysis in Construction

ORF 307: Lecture 2. Linear Programming: Chapter 2 Simplex Methods

LINEAR PROGRAMMING I. a refreshing example standard form fundamental questions geometry linear algebra simplex algorithm

February 17, Simplex Method Continued

Math Models of OR: Extreme Points and Basic Feasible Solutions

Transcription:

Chapter 4 The Simplex Algorithm Part I Based on Introduction to Mathematical Programming: Operations Research, Volume 1 4th edition, by Wayne L. Winston and Munirpallam Venkataramanan Lewis Ntaimo 1

Modeling LPs Solving 2-variable LPs graphically Introduction Most real-life LPs have many variables So a method is needed to solve LPs with more that 2 variables So we will study the simplex algorithm, which is used to solve LPs with thousands of constraints and variables. Your linear algebra skills will now come into play (Chapter 2)! 2

4.5 Converting an LP to Standard Form Before the simplex algorithm can be used to solve an LP, the LP must be converted into a problem where all the constraints are equations and all variables are nonnegative. An LP in this form is said to be in standard form. Steps: 1. If the i th constraint is a constraint, then we convert it to an = constraint by adding a slack variable s i and the sign restriction s i 0. 2. If the i th constraint is a constraint, then we convert it to an = constraint by subtracting an excess variable e i and the sign restriction e i 0. 3. If the variable x i is unrestricted in sign (urs or free), replace xi in both the objective and constraints by x i -x i, where x i 0 and x i 0. 3

4.5 Converting an LP to Standard Form Consider the following example. Leather Limited manufactures two types of leather belts: the deluxe model and the regular model. Each type requires 1 square yard of leather. A regular belt requires 1 hour of skilled labor and a deluxe belt requires 2 hours of skilled labor. Each week, 40 square yards of leather and 60 hours of skilled labor are available. Each regular belt contributes $3 profit and each deluxe belt $4. Write an LP to maximize profit. 4

4.5 Converting an LP to Standard Form The decision variables are: x 1 = number of deluxe belts produced weekly x 2 = number of regular belts produced weekly the appropriate LP is: max z = 4x 1 + 3x 2 s.t. x 1 + x 2 40 (leather constraint) 2x 1 +x 2 60 (labor constraint) x 1, x 2 0 To convert the leather and labor ( ) constraints to equalities, we define for each constraint a slack variable s i (s i = slack variable for the i th constraint). A slack variable is the amount of the resource unused in the i th constraint. 5

4.5 Converting an LP into Standard Form The LP not in standard form is: max z = 4x 1 + 3x 2 s.t. x 1 + x 2 40 (leather constraint) 2x 1 + x 2 60 (labor constraint) x 1, x 2 0 The same LP in standard form is: max z = 4x 1 + 3x 2 s.t. x 1 + x 2 + s 1 = 40 2x 1 + x 2 + s 2 = 60 x 1, x 2, s 1, s 2 0 6

4.5 Converting an LP to Standard Form Convert the following LP (Dorian Auto) to standard form: min z = 50 x 1 + 100x 2 s.t. 7x 1 + 2x 2 28 2x 1 + 12x 2 24 x 1, x 2 0 7

4.5 Converting an LP to Standard Form Transforming the Dorian Auto LP to standard form yields: min z = 50 x 1 + 100x 2 s.t. 7x 1 + 2x 2 -e 1 = 28 2x 1 + 12x 2 -e 2 = 24 x i, e i 0 (i = 1,2) 8

4.5 How to Convert an LP to Standard Form Convert the following LP (Financial Planning) to standard form. Original LP max z = 20x 1 + 15x 2 s.t. x 1 100 x 2 100 50x 1 + 35x 2 6000 20x 1 + 15x 2 2000 x 1, x 2 0 LP in Standard Form max z = 20x1 + 15x2 s.t. x 1 + s 1 = 100 x 2 + s 2 = 100 50x 1 + 35x 2 + s 3 = 6000 20x 1 + 15x 2 -e 4 = 2000 x 1, x 2, s 1, s 2, s 3, e 4 0 9

4.5 Converting an LP to Standard Form Consider the following problem. A baker has 30 oz of flour and 5 packages of yeast. Baking a loaf of bread requires 5 oz of flour and 1 package of yeast. Each loaf of bread can be sold for 30 cents. The baker may purchase additional flour at 4 cents/oz or sell leftover flour at the same price. Formulate an LP to help the baker maximize profits (revenues costs). 10

4.5 Converting an LP to Standard Form The decision variables are: The appropriate LP is: x 1 = number of loaves of bread baked x 2 = number of oz by which flour supply is increased by cash transactions max z = 30x 1-4x 2 s.t. 5x 1 -x 2 30 (flour) x 1 5 (yeast) x 1 0, x 2 urs. Note: x 2 > 0 => x 2 oz of four were purchased x 2 < 0 => x 2 oz of four were sold x 2 = 0 => no flour was bought or sold 11

4.5 Converting an LP to Standard Form Original LP LP in Standard Form max z = 30x 1-4x 2 s.t. 5x 1 -x 2 30 x 1 5 x 1 0, x 2 urs. max z = 30x 1-4x 2 + 4x 2 s.t. 5x 1 -x 2 + x 2 + s 1 = 30 x 1 + s 2 = 5 x 1, x 2, x 2, s 1, s 2 0 12

4.5 Preview of the Simplex Algorithm General form for an LP: Suppose an LP with m constraints and n variables has been converted into standard form. The from of such an LP is: max ( or min) z = c 1 x 1 + c 2 x 2 + +c n x n s.t. a 11 x 1 + a 12 x 2 + + a 1n x n = b 1 a 21 x 1 + a 22 x 2 + + a 2n x n = b 2......... a m1 x 1 + a m2 x 2 + + a mn x n = b m x i 0 ( i = 1,2,, n) 13

14 4.5 Preview of the Simplex Algorithm = b m b b b... 2 1 = mn m m n n a a a a a a a a a A.................. 2 1 2 22 21 1 12 11 = x n x x x... 2 1 If we define: The constraints may be written as a system of equations Ax = b. Consider a system Ax = b of m linear equations in n variables (where n m). A basic solution to Ax = b is obtained by setting n m variables equal to 0 and solving for the remaining m variables. This assumes that setting the n m variables equal to 0 yields a unique value for the remaining m variables, or equivalently, the columns for the remaining m variables are linearly independent.

4.5 Preview of the Simplex Algorithm To find a basic solution to Ax = b, we choose a set of n m variables (the nonbasic variables, or NBV) and set each of these variables equal to 0. Then we solve for the values of the n (n m) = m variables (the basic variables, or BV) that satisfy Ax = b. Different choices of nonbasic variables will lead to different basic solutions. 15

4.5 Preview of the Simplex Algorithm Consider the basic solutions to the following system of 2 equations: x 1 + x 2 = 3 -x 2 + x 3 = -1 The number of nonbasic variables = 3 2 = 1. Setting, for example, NBV = {x 3 } and BV = {x 1, x 2 } we get: x 1 + x 2 = 3 -x 2 + 0 = -1 We can obtain the values for these basic variables by setting x 3 = 0. Solving we find x 1 = 2, x 2 = 1. Thus, x 1 = 2, x 2 = 1, and x 3 = 0 is a basic solution. 16

4.5 Preview of the Simplex Algorithm x 1 + x 2 = 3 -x 2 + x 3 = -1 If NBV = {x 1 } and BV = {x 2, x 3 } are chosen instead, the basic solution becomes x 1 = 0, x 2 = 3, and x 3 = 2. If NBV = {x 2 } and BV = {x 1, x 3 } are chosen instead, the basic solution becomes x 1 = 3, x 2 = 0, and x 3 = -1. 17

4.5 Preview of the Simplex Algorithm Some sets of m variables do not yield a basic solution. Consider the following linear system: x 1 + 2x 2 + x 3 = 1 2x 1 + 4x 2 + x 3 = 3 If NBV = {x 3 } and BV = {x 1, x 2 } the corresponding basic solution would be: x 1 + 2x 2 = 1 2x 1 + 4x 2 = 3 Since this system has no solution, there is no basic solution corresponding to BV = {x 1, x 2 }. 18

4.5 Preview of the Simplex Algorithm Any basic solution in which all variables are nonnegative is called a basic feasible solution ( or bfs). For the basic solutions on the previous slides, x 1 = 2, x 2 = 1, x 3 = 0 and x 1 = 0, x 2 = 3, x 3 = 2 are basic feasible solutions, but the basic solution x 1 = 3, x 2 = 0, x 3 = -1 fails to be a bfs (because x 3 < 0). 19

4.5 Preview of the Simplex Algorithm The following two theorems explain why the concept of a basic feasible solution is of great importance in linear programming: Theorem 1 The feasible region for any linear programming problem is a convex set. Also, if an LP has an optimal solution, there must be an extreme point of the feasible region that is optimal. Theorem 2 For any LP, there is a unique extreme point of the LP s feasible region corresponding to each basic feasible solution. Also, there is at least one bfs corresponding to each extreme point in the feasible region. 20

60 50 40 30 20 10 4.5 Preview of the Simplex Algorithm Let us consider the Leather Limited problem and the relationship between extreme points and basic feasible solutions outlined in Theorem 2. X2 D Labor Constraint max z = 4x 1 + 3x 2 s.t. x 1 + x 2 + s 1 = 40 2x 1 + x 2 + s 2 = 60 x 1, x 2, s 1, s 2 0 B E Feasible Region Leather Constraint Both inequalities are satisfied in the shaded area. The extreme points of the feasible region are B, C, E, and F. F C 10 20 30 40 A 50 X1 21

4.5 Preview of the Simplex Algorithm Basic Variables Nonbasic Variables Basic Feasible Solution Corresponds to Corner Point x 1, x 2 s 1, s 2 s 1 = s 2 = 0, x 1 = x 2 = 20 E x 1, s 1 x 2, s 2 x 2 = s 2 = 0, x 1 = 30, s 1 = 10 C x 1, s 2 x 2, s 1 x 2 = s 1 = 0, x 1 = 40, s 2 = - 20 Not a bfs since s 2 < 0 x 2, s 1 x 1, s 2 x 1 = s 2 = 0, s 1 = - 20 x 2 = 60 Not a bfs since s 1 < 0 x 2, s 2 x 1, s 1 x 1 = s 1 = 0, x 2 = 40, s 2 = 20 B s 1, s 2 x 1, x 2 x 1 = x 2 = 0, s 1 = 40, s 2 = 60 F The table above shows the correspondence between the basic feasible solutions to the LP and the extreme points of the feasible region. The basic feasible solutions to the standard form of the LP correspond in a natural fashion to the LP s extreme points. 22

4.5 Preview of the Simplex Algorithm Adjacent Basic Feasible Solutions For any LP with m constraints, two basic feasible solutions are said to be adjacent if their sets of basic variables have m 1 basic variables in common. Note that two basic feasible solutions are adjacent if they both lie on the same edge of the boundary of the feasible region. 23

60 50 40 30 20 10 4.5 Preview of the Simplex Algorithm Adjacent Basic Feasible Solutions X2 For example in the Leather Limited LP, the bfs corresponding to point E is adjacent to the bfs corresponding to point C. These points share (m 1 = 2-1 = 1) one basic variable, x 1. D B Labor Constraint Feasible Region Points E (BV = {x 1,x 2 }) and F (BV = {s 1,s 2 }) are not adjacent since they share no basic variables. E Leather Constraint F C 10 20 30 40 A 50 X1 24

4.5 Preview of the Simplex Algorithm General description of the simplex algorithm solving an LP in a maximization problem: Step 1 Find a bfs to the LP. We will call this bfs the initial bfs. In general, the most recent bfs will be called the current bfs, so at the beginning of the problem, the initial bfs is the current bfs. Step 2 Determine if the current bfs is an optimal solution to the LP. If it is not, find an adjacent bfs that has a larger z-value. Step 3 Return to Step 2, using the new bfs as the current bfs. 25

4.5 The Simplex Algorithm The Simplex Algorithm Procedure for maximization LPs Step 1 Step 2 Step 3 Step 4 Step 5 Convert the LP to standard form Obtain a bfs (if possible) from the standard form Determine whether the current bfs is optimal If the current bfs is not optimal, determine which nonbasic variable should be come a basic variable and which basic variable should become a nonbasic variable to find a bfs with a better objective function value. Use elementary row operations (ERO s) to find a new bfs with a better objective function value. Return to Step 3. 26

4.5 The Simplex Algorithm In performing the simplex algorithm, write the objective function in the form: z c 1 x 1 c 2 x 2 - -c n x n = 0 We call this format the row 0 version (or row 0 for short) of the objective function. 27

4.5 The Simplex Algorithm (Max LPs) Example: Consider the simplex algorithm applied to the following problem: The Dakota Furniture company manufactures desk, tables, and chairs. The manufacture of each type of furniture requires lumber and two types of skilled labor: finishing and carpentry. The amount of each resource needed to make each type of furniture is given in the table below. Resource Desk Table Chair Lumber 8 board ft 6 board ft 1 board ft Finishing hours 4 hours 2 hours 1.5 hours Carpentry hours 2 hours 1.5 hours 0.5 hours At present, 48 board feet of lumber, 20 finishing hours, 8 carpentry hours are available. A desk sells for $60, a table for $30, and a chair for $ 20. Dakota believes that demand for desks and chairs is unlimited, but at most 5 tables can be sold. Since the available resources have already been purchased, Dakota wants to maximize total revenue. Formulate and solve an LP to maximize total revenue. 28

4.5 The Simplex Algorithm (Max LPs) Decision Variables: x 1 = number of desks produced x 2 = number of tables produced x 3 = number of chairs produced. LP: Max z = 60x 1 + 30x 2 + 20x 3 s.t. 8x 1 + 6x 2 + x 3 48 (lumber constraint) 4x 1 + 2x 2 + 1.5x 3 20 (finishing constraint) 2x 1 + 1.5x 2 + 0.5x 3 8 (carpentry constraint) x 2 x 1, x 2, x 3 0 5 (table demand constraint) 29

4.5 The Simplex Algorithm (Max LPs) Step 1 - Convert the LP to Standard Form Canonical Form 0 Basic Variables Row 0 z 60x 1 30x 2 20x 3 = 0 z = 0 Row 1 8x 1 + 6x 2 + x 3 + s 1 = 48 s 1 = 48 Row 2 4x 1 + 2x 2 + 1.5x 3 + s 2 = 20 s 2 = 20 Row 3 2x 1 + 1.5x 2 + 0.5x 3 + s 3 = 8 s 3 = 6 Row 4 x 2 + s 4 = 5 s 4 = 5 If we set x 1 = x 2 = x 3 = 0, we can solve for the values s 1, s 2, s 3, s 4. Thus, BV = {s 1, s 2, s 3, s 4 } and NBV = {x 1, x 2, x 3 }. Each constraint is in canonical form with a nonnegative rhs. Canonical form: BVs have a coefficient = 1 in one row and zeros in all other rows Therefore, a bfs can be obtained by inspection! 30

4.5 The Simplex Algorithm (Max LPs) Step 2 Obtain a Basic Feasible Solution To perform the simplex algorithm, we need a basic (although not necessarily nonnegative) variable for row 0. Since z appears in row 0 with a coefficient of 1, and z does not appear in any other row, we use z as the basic variable. With this convention, the basic feasible solution for our initial canonical form has: BV = {z, s 1, s 2, s 3, s 4 } and NBV = {x 1, x 2, x 3 }. For this initial bfs, z = 0, s 1 = 48, s 2 = 20, s 3 = 8, s 4 =5, x 1 = x 2 = x 3 = 0. Note that a slack variable can be used as a basic variable if the rhs of the constraint is nonnegative. 31

4.5 The Simplex Algorithm (Max LPs) Step 3 Determine if the Current BFS is Optimal Once we have obtained a bfs, we need to determine whether it is optimal. To do this, we try to determine if there is any way z can be increased by increasing some nonbasic variable from its current value of zero while holding all other nonbasic variables at their current values of zero. Solving for z in row 0 yields: z = 60x 1 + 30x 2 + 20x 3 For each nbv, we can use the equation above to determine if increasing a nbv (while holding all other nonbasic variables to zero) will increase z. Increasing any of the nonbasic variables will cause an increase in z. However increasing x 1 causes the greatest rate of increase in z. If x 1 increases from its current value of zero, it will have to become a basic variable. For this reason, x 1 is called the entering variable. Observe x 1 has the most negative coefficient in row 0. 32

4.5 The Simplex Algorithm (Max LPs) Step 4 - We choose the entering variable (in a max problem) to be the nonbasic variable with the most negative coefficient in row 0 (ties broken arbitrarily). We desire to make x 1 as large as possible but as we do, the current basic variables (s 1, s 2, s 3, s 4 ) will change value. Thus, increasing x 1 may cause a basic variable to become negative. Ratio From row 1 we see that s 1 = 48 8x 1. Since s 1 0, x 1 48 / 8 = 6 From row 2, we see that s 2 = 20 4x 1. Since s 2 0, x 1 20 / 4 = 5 From row 3, we see that s 3 = 8 2x 1. Since s 3 0, x 1 8 / 2 =4 From row 4, we see that s 4 = 5. For any x 1, s 4 will always be 0 This means to keep all the basic variables nonnegative, the largest we can make x 1 is min {6, 5, 4} = 4. 33

4.5 The Simplex Algorithm (Max LPs) The Ratio Test (I call it the minimum ratio test or MRT) When entering a variable into the basis, compute the ratio: rhs of row / coefficient of entering variable in row For every constraint in which the entering variable has a positive coefficient. The constraint with the smallest ratio is called the winner of the ratio test. The smallest ratio is the largest value of the entering variable that will keep all the current basic variables nonnegative. Make the entering variable x 1 a basic variable in row 3 since this row (constraint) was the winner of the ratio test (8/2 = 4). 34

4.5 The Simplex Algorithm (Max LPs) To make x 1 a basic variable in row 3, we use ero s to make x 1 have a coefficient of 1 in row 3 and a coefficient of 0 in all other rows. This procedure is called pivoting on row 3; and row 3 is called the pivot row. The final result is that x 1 replaces s 3 as the basic variable for row 3. The term in the pivot row that involves the entering basic variable is called the pivot term. 35

4.5 The Simplex Algorithm (Max LPs) Step 5 - The Gauss-Jordan method using ero s and simplex tableaus makes x 1 a basic variable (next slide): Row z x1 x2 x3 s1 s2 s3 s4 rhs BVs Entering Variable 0 1-60 -30-20 z = 0 (Most Neg) = x1 1 8 6 1 1 48 s1 = 48 2 4 2 1.5 1 20 s2 = 20 3 2 1.5 0.5 1 8 s3 = 8 Pivot Row 4 1 1 5 s4 = 5 36

4.5 The Simplex Algorithm (Max LPs) ero 1 z x1 x2 x3 s1 s2 s3 s4 rhs ero 0 1-60 -30-20 1 8 6 1 1 48 2 1 4 2 1.5 1 20 3 1 0.75 0.25 0.5 4 row 3 multiplied by 1/2 4 1 1 5 ero 2 z x1 x2 x3 s1 s2 s3 s4 rhs 0 1 15-5 30 240 60 times row 3 added to row 0 1 8 6 1 1 48 2 4 2 1.5 1 20 3 1 0.75 0.25 0.5 4 4 1 1 5 ero 3 z x1 x2 x3 s1 s2 s3 s4 rhs 0 1 15-5 30 240 1-1 1-4 16-8 times row 3 added to row 1 2 4 2 1.5 1 20 3 1 0.75 0.25 0.5 4 4 1 1 5 ero 4 z x1 x2 x3 s1 s2 s3 s4 rhs 0 1 15-5 30 240 1-1 1-4 16 2-1 0.5 1-2 4-4 times row 3 added to row 2 3 1 0.75 0.25 0.5 4 4 1 1 5 37

4.5 The Simplex Algorithm (Max LPs) We now get: Canonical Form 1 Basic Variables Row 0 z + 15x 2-5x 3 + 30s 3 = 240 z = 240 Row 1 - x 3 + s 1-4s 3 = 16 s 1 = 16 Row 2 - x 2 + 0.5 x 3 + s 2-2 s 3 = 4 s 2 = 4 Row 3 x 1 + 0.75x 2 + 0.25x 3 + 0.5s 3 = 4 x 1 = 4 Row 4 x 2 + s 4 = 5 s 4 = 5 In canonical form 1, BV = {z, s 1, s 2, x 1, s 4 } and NBV = {s 3, x 2, x 3 }. yielding the bfs z = 240, s 1 = 16, s 2 = 4, x 1 = 4, s 4 = 5, s 3 = x 2 = x 3 = 0. The procedure from going to one bfs to a better adjacent bfs is called an iteration (or pivot) of the simplex algorithm. 38

4.5 The Simplex Algorithm (Max LPs) Returning to Step 3, we attempt to determine if the current bfs is optimal. Rearranging row 0 from Canonical Form 1, and solving for a yields: z = 240 15x 2 +5x 3-30s 3 The current bfs is NOT optimal because increasing x 3 to 1 while holding the other nonbasic variable to zero will increase the value of z. Making either x 2 or s 3 basic will caused the value of z to decrease. Step 4 - Recall the rule for determining the entering variable is the row 0 coefficient with the greatest negative value. Since x 3 is the only variable with a negative coefficient, x 3 should be entered into the basis. 39

4.5 The Simplex Algorithm (Max LPs) Begin iteration 2: Performing the ratio test using x 3 as the entering variable yields the following results (holding other NBVs to zero): From row 1, s 1 0 for all values of x 3 since s 1 = 16 + x 3 From row 2, s 2 0 if x 3 > 4 / 0.5 = 8 From row 3, x 1 0 if x 3 >4 / 0.25 = 16 From row 4, s 4 0 for all values of x 3 since s 4 = 5 This means to keep all the basic variables nonnegative, the largest we can make x 1 is min {8,16} = 8. So, row 2 becomes the pivot row. Step 5 - Now use ero s, to make x 3 a basic variable in row 2. 40

4.5 The Simplex Algorithm (Max LPs) ero 1 z x1 x2 x3 s1 s2 s3 s4 rhs 0 1 15-5 30 240 1-1 1-4 16 2-2 1 2-4 8 multiply row 2 by 2 3 1 0.75 0.25 0.5 4 4 1 1 5 ero 2 z x1 x2 x3 s1 s2 s3 s4 rhs 0 1 5 10 10 280 add 5 times row 2 to row 0 1-1 1-4 16 2-2 1 2-4 8 3 1 0.75 0.25 0.5 4 4 1 1 5 ero 3 z x1 x2 x3 s1 s2 s3 s4 rhs 0 1 5 10 10 280 1-2 1 2-8 24 add row 2 to row 1 2-2 1 2-4 8 3 1 0.75 0.25 0.5 4 4 1 1 5 ero 4 z x1 x2 x3 s1 s2 s3 s4 rhs 0 1 5 10 10 280 1-2 1 2-8 24 2-2 1 2-4 8 3 1 1.25-0.5 1.5 2 add -1/4 times row 2 to row 3 4 1 1 5 41

We now obtain: Canonical Form 2 4.5 The Simplex Algorithm (Max LPs) Basic Variables Row 0 z + 5x 2 + 10s 2 + 10s 3 = 280 z = 280 Row 1-2x 2 + s 1 + 2s 2-8s 3 = 24 s 1 = 24 Row 2-2x 2 + x 3 + 2s 2-4s 3 = 8 x 3 = 8 Row 3 x 1 + 1.25x 2-0.5 s 2 + 1.5s 3 = 2 x 1 = 2 Row 4 x 2 + s 4 = 5 s 4 = 5 In Canonical Form 2, BV = {z, s 1, x 3, x 1, s 4 } and NBV = {s 3, s 2, x 2 }, yielding the bfs z = 280, s 1 = 24, x 3 = 8, x 1 = 2, s 4 = 5, s 2 = s 3 = x 2 = 0. 42

4.5 The Simplex Algorithm (Max LPs) Now solving for z in row 0 yields: Z = 280-5x 2-10s 2-10s 3 We can see that increasing x2, s2, or s3 while holding the other NBVs to zero will not cause the value of z to decrease. The solution at the end of iteration 2 is therefore optimal. Optimality Rule: A canonical form is optimal (for a max problem) if each nonbasic variable has a nonnegative coefficient in the canonical form s row 0. 43

4.5 The Simplex Algorithm (Max LPs) Summary: Solving Example LP Using the Simplex Tableau Method Max z = 60x 1 + 30x 2 + 20x 3 s.t. 8x 1 + 6x 2 + x 3 48 (lumber constraint) 4x 1 + 2x 2 + 1.5x 3 20 (finishing constraint) 2x 1 + 1.5x 2 + 0.5x 3 8 (carpentry constraint) x 2 5 (table demand constraint) x 1, x 2, x 3 0 LP in Standard Form: Max z = 60x 1 + 30x 2 + 20x 3 s.t. 8x 1 + 6x 2 + x 3 + s1 = 48 4x 1 + 2x 2 + 1.5x 3 + s2 = 20 2x 1 + 1.5x 2 + 0.5x 3 + s3 = 8 x 2 + s4 = 5 x 1, x 2, x 3, s1, s2, s3, s4 0 44

4.5 The Simplex Algorithm (Max LPs) Solving Example LP Using the Simplex Tableau Method: Initial Tableau BV = {z, s1, s2, s3, s4} and NBV = {x1, x2, x3 }, Row z x1 x2 x3 s1 s2 s3 s4 RHS BV MRT 0 1-60 -30-20 0 0 0 0 0 z = 0 1 0 8 6 1 1 0 0 0 48 s1 = 48 6 2 0 4 2 1.5 0 1 0 0 20 s2 = 20 5 3 0 2 1.5 0.5 0 0 1 0 8 s3 = 8 4* 4 0 0 1 0 0 0 0 1 5 s4 = 5 None Iteration 1 Second Tableau BV = {z, s1, s2, x1, s4} and NBV = {s3, x2, x3 }, Row z x1 x2 x3 s1 s2 s3 s4 RHS BV MRT 0 1 0 15-5 0 0 30 0 240 z =240 1 0 0 0-1 1 0-4 0 16 s1 = 16 None 2 0 0-1 0.5 0 1-2 0 4 s2 = 4 8* 3 0 1 0.75 0.25 0 0 0.5 0 4 x1 = 4 16 4 0 0 1 0 0 0 0 1 5 s4 = 5 None Iteration 2 Optimal Tableau BV = {z, s1, x3, x1, s4} and NBV = {s3, s2, x2 }, Row z x1 x2 x3 s1 s2 s3 s4 RHS BV MRT 0 1 0 5 0 0 10 10 0 280 z=280 1 0 0-2 0 1 2-8 0 24 s1=24 2 0 0-2 1 0 2-4 0 8 x3=8 3 0 1 1.25 0 0-0.5 1.5 0 2 x1=2 4 0 0 1 0 0 0 0 1 5 s4 = 5 Optimal Solution: z = 280, x1 = 2, x2 = 0, x3 = 8 45

4.6 The Simplex Algorithm (Min LPs) The simplex method can be used to solve minimization problems in two different ways. Consider this LP: Min z = 2x 1 3x 2 s.t. x 1 + x 2 4 x 1 x 2 6 x 1, x 2 0 Method 1: The optimal solution is the point (x 1,x 2 ) that makes z = 2x 1 3x 2 the smallest. Equivalently, this point makes max -z = - 2x 1 + 3x 2 the largest. This means we can find the optimal solution to the LP by solving the following LP: Max -z = -2x 1 + 3x 2 s.t. x 1 + x 2 4 x 1 x 2 6 x 1, x 2 0 46

4.6 The Simplex Algorithm (Min LPs) In summary: Multiply the objective function for the min problem by -1 and solve the problem as a max problem with the objective function z. The optimal solution to the max problem will give you the optimal solution for to the min problem. Note: (optimal z-value for the min problem) = - (optimal z-value for the max problem). Example: Solve the LP shown to the right using the simplex tableau method: Min z = 2x 1 3x 2 s.t. x 1 + x 2 4 x 1 x 2 6 x 1, x 2 0 47

4.6 The Simplex Algorithm (Min LPs) Method 1: In solving this modified LP, use z as the basic variable in row 0. After adding slack variables s1 and s2 to the constraints we obtain the initial tableau: BV = {-z, s1, s2} and NBV = {x1, x2}, Initial Tableau Row -z x1 x2 s1 s2 RHS BV MRT 0 1 2-3 0 0 0 -z = 0 1 0 1 1 1 0 4 s1 = 4 4* 2 0 1-1 0 1 6 s2 = 6 None Optimal Tableau BV = {-z, x2, s2} and NBV = {s1, x2}, Row -z x1 x2 s1 s2 RHS BV MRT 0 1 5 0 3 0 12 -z = 12 1 0 1 1 1 0 4 x2 = 4 2 0 2 0 1 1 10 s2 = 10 Optimal Solution: z = -12, x1 = 0, x2 =4 48

Method 2: 4.6 The Simplex Algorithm (Min LPs) A simple modification of the simplex algorithm can be used to solve min problems directly. Modify Step 3 of the simplex algorithm as follows: If all nonbasic variables (NBV) in row 0 have nonpositive coefficients, the current bfs is optimal. If any nonbasic variable has a positive coefficient, choose the variable with the most positive coefficient in row 0 as the entering variable. Note: This modification of the simplex algorithm works because increasing a nonbasic variable (NBV) with a positive coefficient in row 0 will decrease z. 49

4.6 The Simplex Algorithm (Min LPs) Method 2: BV = {z, s1, s2} and NBV = {x1, x2}, Initial Tableau Row z x1 x2 s1 s2 RHS BV MRT 0 1-2 3 0 0 0 z = 0 1 0 1 1 1 0 4 s1 = 4 4* 2 0 1-1 0 1 6 s2 = 6 None Optimal Tableau BV = {z, x2, s2} and NBV = {s1, x2}, Row z x1 x2 s1 s2 RHS BV MRT 0 1-5 0-3 0-12 z = -12 1 0 1 1 1 0 4 x2 = 4 2 0 2 0 1 1 10 s2 = 10 Optimal Solution: z = -12, x1 = 0, x2 =4 50

4-7 Alternate Optimal solutions For some LPs, more than one extreme point is optimal. If an LP has more than one optimal solution, it has multiple optimal solutions. If there is no nonbasic variable (NBV) with a zero coefficient in row 0 of the optimal tableau, the LP has a unique optimal solution. If there is a nonbasic variable with a zero coefficient in row 0 of the optimal tableau, it is possible that the LP may have alternative optimal solutions. 51

4-7 Alternate Optimal solutions Solve the following LP using the simplex tableau method (Prob. 5, page 154): Max z = 2x 1 + 2x 2 s.t. x 1 + x 2 6 2x 1 + x 2 13 x 1, x 2 0 52

4-7 Alternate Optimal solutions Initial Tableau BV = {z, s1, s2} and NBV = {x1, x2}, Row z x1 x2 s1 s2 RHS BV MRT 0 1-2 -2 0 0 0 z = 0 1 0 1 1 1 0 6 s1 = 6 6* 2 0 2 1 0 1 13 s2 = 13 6.5 Iteration 1 Second (Optimal) Tableau BV = {z, x1, s2} and NBV = {s1, x2}, Row z x1 x2 s1 s2 RHS BV MRT 0 1 0 0 2 0 12 z = 12 1 0 1 1 1 0 6 x1 = 6 6.00 2 0 0-1 -2 1 1 s2 = 1 None Optimal Solution: z = 12, x1 = 6, x2 = 0 Iteration 2 Alternative Optimal Tableau BV = {z, s1, x2} and NBV = {s1, x1}, Row z x1 x2 s1 s2 RHS BV MRT 0 1 0 0 2 0 12 z = 12 1 0 1 1 1 0 6 x2 = 6 2 0 1 0-1 1 7 s2 = 7 Alternative Optimal Solution: z = 12, x1 = 0, x2 = 6 53

4.8 Unbounded LPs For some LPs, there exist points in the feasible region for which z assumes arbitrarily large (in max problems) or arbitrarily small (in min problems) values. When this occurs, we say the LP is unbounded. An unbounded LP occurs in a max problem if there is a nbv with a negative coefficient in row 0 and there is no constraint that limits how large we can make this NBV. Specifically, an unbounded LP for a max problem occurs when a variable with a negative coefficient in row 0 has a non-positive coefficient in each constraint the ratio test fails! 54

4-8 Unbounded LPs Solve the following LP using the simplex tableau method (Prob. 5, page 158): Max z = x 1 + 2x 2 s.t. -x 1 + x 2 2-2x 1 + x 2 1 x 1, x 2 0 55

4.8 Unbounded LPs Initial Tableau BV = {z, s1, s2} and NBV = {x1, x2}, Row z x1 x2 s1 s2 RHS BV MRT 0 1-1 -2 0 0 0 z = 0 1 0-1 1 1 0 2 s1 = 2 2 2 0-2 1 0 1 1 s2 = 1 1* Iteration 1 BV = {z, x1, s2} and NBV = {s1, x2}, Second Tableau Row z x1 x2 s1 s2 RHS BV MRT 0 1-5 0 0 2 2 z = 2 1 0 1 0 1-1 1 s1 = 1 1 2 0-2 1 0 1 1 x2 = 1 None Iteration 2 Third (Final) Tableau BV = {z, x1, x2} and NBV = {s1, s2}, Row z x1 x2 s1 s2 RHS BV MRT 0 1 0 0 5-3 7 z = 7 1 0 1 0 1-1 1 x1 = 1 2 0 0 1 2-1 3 x2 = 3 We would like S2 to enter the basis but there is no row in which S2 has a positive coefficient. Therefore the LP is unbounded. 56