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

Similar documents
Chapter 4 The Simplex Algorithm Part I

The Simplex Algorithm and Goal Programming

The Simplex Algorithm

Theory of Linear Programming

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

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

Linear Programming. Dr. Xiaosong DING

Sensitivity Analysis and Duality

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

Section 4.1 Solving Systems of Linear Inequalities

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

2. Linear Programming Problem

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

MAT016: Optimization

OPERATIONS RESEARCH. Michał Kulej. Business Information Systems

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

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

Chapter 2 Introduction to Optimization & Linear Programming

Linear Programming. H. R. Alvarez A., Ph. D. 1

Introduction. Very efficient solution procedure: simplex method.

The Simplex Method of Linear Programming

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

SEN301 OPERATIONS RESEARCH I LECTURE NOTES

Chapter 5 Linear Programming (LP)

IE 400: Principles of Engineering Management. Simplex Method Continued

In Chapters 3 and 4 we introduced linear programming

Linear programming I João Carlos Lourenço

9.5 THE SIMPLEX METHOD: MIXED CONSTRAINTS

Week 3: Simplex Method I

Study Unit 3 : Linear algebra

Review Questions, Final Exam

Math Models of OR: Some Definitions

CSC Design and Analysis of Algorithms. LP Shader Electronics Example

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

4. Duality and Sensitivity

Summary of the simplex method

Chapter 4 The Simplex Algorithm Part II

Simplex Algorithm Using Canonical Tableaus

Chap6 Duality Theory and Sensitivity Analysis

LP Definition and Introduction to Graphical Solution Active Learning Module 2

Introduction to Operations Research. Linear Programming

Graphical and Computer Methods

F 1 F 2 Daily Requirement Cost N N N

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

Introduction to Operations Research

February 22, Introduction to 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.

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

IE 5531: Engineering Optimization I

Review Solutions, Exam 2, Operations Research

OPTIMISATION 3: NOTES ON THE SIMPLEX ALGORITHM

56:270 Final Exam - May

Simplex Method for LP (II)

UNIT-4 Chapter6 Linear Programming

The Dual Simplex Algorithm

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

Contents. 4.5 The(Primal)SimplexMethod NumericalExamplesoftheSimplexMethod

1 Review Session. 1.1 Lecture 2

TIM 206 Lecture 3: The Simplex Method

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

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

LINEAR PROGRAMMING. Introduction

9.1 Linear Programs in canonical form

Solutions to Review Questions, Exam 1

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

OPRE 6201 : 3. Special Cases

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

Part 1. The Review of Linear Programming

"SYMMETRIC" PRIMAL-DUAL PAIR

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

Chapter 1: Linear Programming

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

Fundamental Theorems of Optimization

OPERATIONS RESEARCH. Linear Programming Problem

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

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

Simplex Method in different guises

42 Average risk. Profit = (8 5)x 1 é ù. + (14 10)x 3


ECE 307 Techniques for Engineering Decisions

Algebraic Simplex Active Learning Module 4

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

AM 121: Intro to Optimization Models and Methods

MATH 445/545 Test 1 Spring 2016

Optimisation. 3/10/2010 Tibor Illés Optimisation

4.4 The Simplex Method and the Standard Minimization Problem

Linear Programming in Matrix Form

Week_4: simplex method II

February 17, Simplex Method Continued

Simplex tableau CE 377K. April 2, 2015

MS-E2140. Lecture 1. (course book chapters )

Systems Analysis in Construction

Lecture 2: The Simplex method. 1. Repetition of the geometrical simplex method. 2. Linear programming problems on standard form.

Lesson 27 Linear Programming; The Simplex Method

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

Lecture 5 Simplex Method. September 2, 2009

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

Understanding the Simplex algorithm. Standard Optimization Problems.

Transcription:

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

The Graphical Method for Solving LP s If LP models have only two variables, they can be solved graphically: Plot all constraints by first plotting the equality relationship between resource usage and availability (the boundary), then determine the direction of the inequality if necessary Plot the objective function and move it parallel to itself, in the direction of optimization, until it last touches the feasible solution space. Métodos Cuantitativos M. En C. Eduardo Bustos Farías 2

An Example LP Problem Blue Ridge Hot Tubs produces two types of hot tubs: Aqua-Spas & Hydro-Luxes. Aqua-Spa Hydro-Lux Pumps Labor 9 hours 6 hours Tubing 2 feet 6 feet Unit Profit $35 $3 There are 2 pumps, 566 hours of labor, and 288 feet of tubing available. Métodos Cuantitativos M. En C. Eduardo Bustos Farías 3

LP Model for Blue Ridge Hot Tubs MAX: 35X + 3X 2 S.T.: X + X 2 <= 2 9X + 6X 2 <= 566 2X + 6X 2 <= 288 X >= X 2 >= Métodos Cuantitativos M. En C. Eduardo Bustos Farías 4

Solving LP Problems: An Intuitive Approach Idea: Each Aqua-Spa (X ) generates the highest unit profit ($35), so let s make as many of them as possible! How many would that be? Let X 2 = st constraint: X <= 2 2nd constraint: 9X <=566 or X <=74 3rd constraint: 2X <= 288 or X <= 24 If X 2 =, the maximum value of X is 74 and the total profit is $35*74 + $3* = $6,9 This solution is feasible, but is it optimal? No! Métodos Cuantitativos M. En C. Eduardo Bustos Farías 5

Solving LP Problems: A Graphical Approach The constraints of an LP problem defines its feasible region. The best point in the feasible region is the optimal solution to the problem. For LP problems with 2 variables, it is easy to plot the feasible region and find the optimal solution. Métodos Cuantitativos M. En C. Eduardo Bustos Farías 6

X 2 Plotting the First Constraint 25 2 5 (, 2) boundary line of pump constraint X + X 2 = 2 5 (2, ) 5 5 2 25 Métodos Cuantitativos M. En C. Eduardo Bustos Farías 7 X

X 2 25 2 Plotting the Second Constraint (, 26) boundary line of labor constraint 9X + 6X 2 = 566 5 5 (74, ) 5 5 2 25 Métodos Cuantitativos M. En C. Eduardo Bustos Farías 8 X

X 2 25 Plotting the Third Constraint (, 8) 2 5 boundary line of tubing constraint 2X + 6X 2 = 288 5 Feasible Region 5 5 2 25 (24, ) Métodos Cuantitativos M. En C. Eduardo Bustos Farías 9 X

X 2 Plotting A Level Curve of the Objective Function 25 2 5 (, 6.67) objective function 35X + 3X 2 = 35 5 (, ) 5 5 2 25 Métodos Cuantitativos M. En C. Eduardo Bustos Farías X

X 2 A Second Level Curve of the Objective Function 25 2 5 (, 75) objective function 35X + 3X 2 = 35 objective function 35X + 3X 2 = 525 5 (5, ) 5 5 2 25 Métodos Cuantitativos M. En C. Eduardo Bustos Farías X

X 2 Using A Level Curve to Locate the Optimal Solution 25 2 objective function 35X + 3X 2 = 35 5 5 optimal solution objective function 35X + 3X 2 = 525 5 5 2 25 Métodos Cuantitativos M. En C. Eduardo Bustos Farías 2 X

Calculating the Optimal Solution The optimal solution occurs where the pumps and labor constraints intersect. This occurs where: X + X 2 = 2 () and 9X + 6X 2 = 566 (2) From () we have, X 2 = 2 -X (3) Substituting (3) for X 2 in (2) we have, So the optimal solution is, 9X + 6 (2 -X ) = 566 which reduces to X = 22 X =22, X 2 =2-X =78 Total Profit = $35*22 + $3*78 = $66, Métodos Cuantitativos M. En C. Eduardo Bustos Farías 3

Enumerating The Corner Points X 2 25 2 obj. value = $54, (, 8) Note: This technique will not work if the solution is unbounded. 5 obj. value = $64, (8, 2) obj. value = $66, (22, 78) 5 obj. value = $ obj. value = $6,9 (, ) (74, ) 5 5 2 25 Métodos Cuantitativos M. En C. Eduardo Bustos Farías 4 X

Summary of Graphical Solution to LP Problems. Plot the boundary line of each constraint 2. Identify the feasible region 3. Locate the optimal solution by either: a. Plotting level curves b. Enumerating the extreme points (corner points) Métodos Cuantitativos M. En C. Eduardo Bustos Farías 5

Graphing 2-Dimensional LPs Example : y Optimal Solution 4 Maximize x + y Subject to: x + 2 y 2 x 3 3 2 Feasible Region y 4 x y 2 Métodos Cuantitativos M. En C. Eduardo Bustos Farías 6 3 x

Graphing 2-Dimensional LPs Example 2: 4 y Multiple Optimal Solutions! Minimize ** x - y Subject to: /3 x + y 4 3-2 x + 2 y 4 x 3 x y 2 Feasible Region 2 3 Métodos Cuantitativos M. En C. Eduardo Bustos Farías 7 x

Graphing 2-Dimensional LPs Example 3: y Minimize x + /3 y Subject to: x + y 2-2 x + 5 y 5 4 3 2 Feasible Region x 5 x y Optimal Solution 2 Métodos Cuantitativos M. En C. Eduardo Bustos Farías 8 3 4 x

Do We Notice Anything From These 3 Examples? 4 y 4 y 4 y 3 3 3 2 2 2 2 3 x 2 3 x 2 3 4 x Métodos Cuantitativos M. En C. Eduardo Bustos Farías 9

A Fundamental Point 4 y 4 y 4 y 3 3 3 2 2 2 2 3 x 2 3 x 2 3 4 x If an optimal solution exists, there is always a corner point optimal solution! Métodos Cuantitativos M. En C. Eduardo Bustos Farías 2

Graphing 2-Dimensional LPs Example : Second Corner pt. y Optimal Solution 4 Maximize x + y Subject to: x + 2 y 2 x 3 3 2 Feasible Region y 4 x y Initial Corner pt. 2 Métodos Cuantitativos M. En C. Eduardo Bustos Farías 2 3 x

And We Can Extend this to Higher Dimensions Métodos Cuantitativos M. En C. Eduardo Bustos Farías 22

Then How Might We Solve an LP? The constraints of an LP give rise to a geometrical shape - we call it a polyhedron. If we can determine all the corner points of the polyhedron, then we can calculate the objective value at these points and take the best one as our optimal solution. The Simplex Method intelligently moves from corner to corner until it can prove that it has found the optimal solution. Métodos Cuantitativos M. En C. Eduardo Bustos Farías 23

Exercise : Formulating an LP-Problem Advertising Media Selection An advertising company wishes to plan an advertising campaign in three different media television, radio, and magazines. The purpose of the advertising program is to reach as many potential customers as possible. Result of a market study are given below: TV, TV, day time prime time Radio Magazines Cost of an Advertising 4 75 3 5 unit, in $ # of potential customers 4 9 5 2 reached/unit # of women customers 3 4 2 reached/unit The company does not want to spend more than $8 on advertising. It further requires that () at least 2 million exposures take place among women; (2) advertising on TV Métodos be limited Cuantitativos to $5 ; (3) M. at En least C. Eduardo 3 advertising Bustos Farías units be bought on day time 24 TV, and two units during prime time; and (4) the number of advertising units on radio and

Solving Linear Programming Problems Graphical Technique First graph the constraints: the solution set of the system is that region (or set of ordered pairs), which satisfies ALL the constraints. This region is called the feasible set Métodos Cuantitativos M. En C. Eduardo Bustos Farías 25

Solving Linear Programming Problems: Graphical Technique continued Locate all the corner points of the graph: the coordinates of the corners will be determined algebraically It is important to note that the optima is obtained at the boundary of the solution set and furthermore at the corner points. For linear programs, it can be shown that the optima will always be obtained at corner points. Métodos Cuantitativos M. En C. Eduardo Bustos Farías 26

Solving Linear Programming Problems: Graphical Technique continued Determine the optimal value: test all the corner points to see which yields the optimum value for the objective function Objective function Feasible set Optimum Métodos Cuantitativos M. En C. Eduardo Bustos Farías 27

Example 2 Suppose a company produces two types of widgets, manual and electric. Each requires in its manufacture the use of three machines; A, B, and C. A manual widget requires the use of the machine A for 2 hours, machine B for hour, and machine C for hour. An electric widget requires hour on A, 2 hours on B, and hour on C. Furthermore, suppose the maximum numbers of hours available per month for the use of machines A, B, and C are 8, 6, and, respectively. The profit on a manual widget is $4 and on electric widget it is $6. See the table below for a summary of data. If the company can sell all the widgets it can produce, how many of each type should it make in order to maximize the monthly profit? Manual Electric Hours available A 2 8 B 2 6 C profit $4 $6 Métodos Cuantitativos M. En C. Eduardo Bustos Farías 28

Example 2 continued Step I Identify decision variables: x = number of manual widgets y = number of electric widgets Step II Identify constraints: 2x + y 8 x + 2y 6 x + y x y Métodos Cuantitativos M. En C. Eduardo Bustos Farías 29

Example 2 continued Step III Define objective function: Solving P for y gives max P = 4x + 6y y = -2/3 + P/3. This defines a so-called family of parallel lines, isoprofit lines. Each line gives all possible combinations of x and y that yield the same profit. Métodos Cuantitativos M. En C. Eduardo Bustos Farías 3

Example 2 continued Métodos Cuantitativos M. En C. Eduardo Bustos Farías 3

Example 2 continued Métodos Cuantitativos M. En C. Eduardo Bustos Farías 32

Special Conditions in LP Models A number of special conditions may occur in LP problems: Alternate Optimal Solutions Redundant Constraints Unbounded Solutions Infeasibility Métodos Cuantitativos M. En C. Eduardo Bustos Farías 33

Example of Alternate Optimal Solutions X 2 25 2 What if the price of Aqua-Spas generates a profit of $45 instead of $35? objective function level curve 45X + 3X 2 = 783 5 5 alternate optimal solutions 5 5 2 25 Métodos Cuantitativos M. En C. Eduardo Bustos Farías 34 X

Example of a Redundant Constraint X 2 25 2 What if 225 pumps are avaivale instead of 2? X + X2 <= 225 Pumps boundary line of tubing constraint boundary line of pump constraint 5 boundary line of labor constraint 5 Feasible Region 5 5 2 25 Métodos Cuantitativos M. En C. Eduardo Bustos Farías 35 X

Example of an Unbounded Solution Consider the following problem: MAX: Z= X + X2 S.T.:X + X2 >= 4 -X + 2X2 <= 4 X >= X2 >= Métodos Cuantitativos M. En C. Eduardo Bustos Farías 36

Example of an Unbounded Solution X 2 8 6 objective function X + X 2 = 6 objective function X + X 2 = 8 -X + 2X 2 = 4 4 2 X + X 2 = 4 2 4 6 8 Métodos Cuantitativos M. En C. Eduardo Bustos Farías 37 X

Example of Infeasibility Consider the following problem: MAX: Z= X + X2 S.T.:X + X2 <= 5 X + X2 >= 2 X >= X2 >= Métodos Cuantitativos M. En C. Eduardo Bustos Farías 38

Example of Infeasibility X 2 25 2 5 X + X 2 = 2 feasible region for second constraint 5 feasible region for first constraint X + X 2 = 5 5 5 2 25 Métodos Cuantitativos M. En C. Eduardo Bustos Farías 39 X

Prototype Example The WYNDOR GLASS CO. produces high-quality glass products including windows and galss doors. It has three plants. Aluminum frames and hardware are made in Plant, wood frames in Plant 2, and Plant 3 produces the glass and assembles the products. Because of declining earnings, top management has decided to revamp the company s product line. Unprofitable products are being discontinued, releasing production capacity to launch two new products having large sales potential. Métodos Cuantitativos M. En C. Eduardo Bustos Farías 4

Prototype Example The two new products are: Product : An 8-foot glass door with aluminum framing Product 2: A 4 x 6 foot double-hung wood-framed window An OR team has been assembled to recommend the product mix of these two new products which will maximize the profit from their sales. The team has assembled the data in the following table: Métodos Cuantitativos M. En C. Eduardo Bustos Farías 4

Prototype Example Production Time/Batch (hrs.) Product Plant 2 Available Production Time/Week (hrs.) 4 2 2 2 3 3 2 8 Profit per batch $3, $5, Métodos Cuantitativos M. En C. Eduardo Bustos Farías 42

Max Z = 3x + 5x st.. x 2 x 2 3x + 2x 8 2 x, x 2 4 6 Example x 2 8 6 4 2 2 4 6 8 x Métodos Cuantitativos M. En C. Eduardo Bustos Farías 43

Example Problem Maximize Z = 5x + 2x 2 + x 3 subject to x + 3x 2 - x 3 6, x 2 + x 3 4, 3x + x 7, 2 x, x 2, x 3. Métodos Cuantitativos M. En C. Eduardo Bustos Farías 44

Simplex and Example Problem Step. Convert to Standard Form a x + a 2 x 2 + + a n x n b, a 2 x + a 22 x 2 + + a 2n x n b 2, a m x + a m2 x 2 + + a mn x n b m, a x + a 2 x 2 + + a n x n + x n+ = b, a 2 x + a 22 x 2 + + a 2n x n - x n+2 = b 2, a m x + a m2 x 2 + + a mn x n + x n+k = b m, In our example problem: x + 3x 2 - x 3 6, x 2 + x 3 4, 3x + x 7, 2 x, x 2, x 3. x + 3x 2 - x 3 + x 4 = 6, x 2 + x 3 + x 5 = 4, 3x + x + x 2 6 = 7, x, x 2, x 3, x 4, x 5, x 6. Métodos Cuantitativos M. En C. Eduardo Bustos Farías 45

Simplex: Step 2 Step 2. Start with an initial basic feasible solution (b.f.s.) and set up the initial tableau. In our example Maximize Z = 5x + 2x 2 + x 3 x + 3x 2 - x 3 + x 4 = 6, x 2 + x 3 + x 5 = 4, 3x + x 2 + x 6 = 7, x, x 2, x 3, x 4, x 5, x 6. c B Basis c j Constants 5 2 x x 2 x 3 x 4 x 5 x 6 x 4 3-6 x 5 4 x 6 3 7 c row 5 2 Z= Métodos Cuantitativos M. En C. Eduardo Bustos Farías 46

Step 2: Explanation Adjacent Basic Feasible Solution If we bring a nonbasic variable x s into the basis, our system changes from the basis, x b, to the following (same notation as the book): x + ā s x s = x r + ā rs x r = x m + ā ms x s = b b r b s s i is i= Métodos Cuantitativos M. En C. Eduardo Bustos Farías 47 x i = x s = x j = bi a is for i =,, m for j=m+,..., n and j s The new value of the objective function becomes: Z = m i= c i (b i a is ) + c Thus the change in the value of Z per unit increase in x s is c s = new value of Z - old value of Z m m = ci (bi ais ) + cs cibi = i= c m c a i= s This is the Inner Product rule

Simplex: Step 3 Use the inner product rule to find the relative profit coefficients c B Basis c j Constants 5 2 x x 2 x 3 x 4 x 5 x 6 x 4 3-6 x 5 4 x 6 3 7 c row 5 2 Z= c j = c j c B P j c = 5 - () - () - (3) = 5 -> largest positive c 2 =. c 3 =. Step 4: Is this an optimal basic feasible solution? Métodos Cuantitativos M. En C. Eduardo Bustos Farías 48

Simplex: Step 5 Apply the minimum ratio rule to determine the basic variable to leave the basis. The new values of the basis variables: x i = b a i is x s for i =,..., m In our example: max x s b min ais a = > is c B Basis c j Constants 5 2 x x 2 x 3 x 4 x 5 x 6 x 4 3-6 x 5 4 x 6 3 7 c row 5 2 Z= i Row Basic Variable Ratio x 4 6 2 x 5-3 x 6 7/3 Métodos Cuantitativos M. En C. Eduardo Bustos Farías 49

Simplex: Step 6 Perform the pivot operation to get the new tableau and the b.f.s. c B Basis c j Constants 5 2 x x 2 x 3 x 4 x 5 x 6 x 4 3-6 x 5 4 x 6 3 7 c row 5 2 Z= New iteration: find entering variable: c j = c j c B c B = ( 5) P j c 2 = 2 - () 8/3 - () - (5) /3 = /3 c 3 = - () (-) - () - (5) = c 6 = - () - () - (5) /3 = -5/3 c B Basis c j Constants 5 2 x x 2 x 3 x 4 x 5 x 6 x 4 8/3 - /3 x 5 4 5 x /3 /3 7/3 c row /3-5/3 Z=35/3 Métodos Cuantitativos M. En C. Eduardo Bustos Farías 5

Final Tableau c B Basis c j Constants 5 2 x x 2 x 3 x 4 x 5 x 6 x 4 8/3 - /3 x 5 4 5 x /3 /3 7/3 c row /3-5/3 Z=35/3 x 3 enters basis, x 5 leaves basis Wrong value! 4 should be /3 c B Basis c j Constants 5 2 x x 2 x 3 x 4 x 5 x 6 x 4 4 23/3 x 3 4 5 x /3 /3 7/3 c row -2/3 - -5/3 Z=47/3 Métodos Cuantitativos M. En C. Eduardo Bustos Farías 5

Exercise: Solving an LP-problem: A California vintner has available 66 lbs of Cabernet Sauvignon (CS) grapes, 86 lbs of Pinot Noir (PN) grapes, and 2 lbs of Barbera (B) grapes. The vintner makes a Pinot Noir (PN) wine, which contains 2% CS, 6% PN, and 2% B grapes and sells $3 a bottle, and a Barbera (B) wine, which contains % CS, 2% PN, and 7% B grapes and sells for $2 a bottle. Assuming each bottle of wine requires 3 lbs of grapes, determine how many bottles of each type of wine should be produced to maximize income. Métodos Cuantitativos M. En C. Eduardo Bustos Farías 52

Solving an LP-problem continued: Algebraic Technique The graphical method solving linear programming problems can be used for problems with two variables (with some difficulty three) However, for problems were the number of variables might run into hundreds or thousands, algebraic techniques must be used The simplex method, with the aid of the computer, can solve these problems Métodos Cuantitativos M. En C. Eduardo Bustos Farías 53

As with the graphical procedure, the simplex method finds the optimal cornerpoint solution of the set of feasible solutions. Regardless of the number of decision variables and regardless of the number of constraints, the simplex method uses the key property of a linear programming problem, which is: Métodos Cuantitativos M. En C. Eduardo Bustos Farías 54

A linear programming problem always has an optimal solution occurring at a corner-point solution Simplex method begins with a feasible solution and tests whether or not it is optimum. If not optimum, the method proceeds to a better solution. Métodos Cuantitativos M. En C. Eduardo Bustos Farías 55

Solution of a maximum-type linear programming problem by the simplex algorithm involves the following steps:. Adding slack variables to convert the inequalities into equations In the case of less-than-or-equal-to constraints, slack variables are used to increase the left-hand side to equal the righthand side limits of the constraint conditions. Métodos Cuantitativos M. En C. Eduardo Bustos Farías 56

Example: max Z = 3x + x 2 st. 2x + x 2 8 2x + 3x 2 2 adding slacks and rewriting the object row: 2x + x 2 + s = 8 2x + 3x 2 + s 2 = 2-3x x 2 + Z = where x, x 2, s and s 2 are non-negative. Métodos Cuantitativos M. En C. Eduardo Bustos Farías 57

Métodos Cuantitativos M. En C. Eduardo Bustos Farías 58 2x + x 2 + s = 8 2x + 3x 2 + s 2 = 2-3x x 2 + Z = 2. Setting up the initial simplex tableau Form an augmented coefficient matrix: 3 2 3 2 8 2 2 2 2 Z s s Z s s x x

3. Finding an initial feasible solution Simplex algorithm starts always from origin. In our case it means that the initial feasible solution is: x =, x 2 =, s = 8, s 2 = 2. Simplex method proceeds from this corner point to an adjacent corner point. Such corner points are called basic feasible solutions. Métodos Cuantitativos M. En C. Eduardo Bustos Farías 59

4. Introducing basic and nonbasic variables as the natural way to express basic feasible solutions For any basic feasible solution (B.F.S.), the variables held zero are called nonbasic variables and the other are called basic variables. Moving form one B.F.S. to another means that one basic variable (we call it a departing or exiting variable) becomes nonbasic and a nonbasic variable (entering variable) becomes a basic variable. Métodos Cuantitativos M. En C. Eduardo Bustos Farías 6

Métodos Cuantitativos M. En C. Eduardo Bustos Farías 6

5. Choosing the proper pivot element to advance the solution and maintain the non-negativity of all variables How to decide which variable to make basic and which nonbasic (in other words in which direction to move from the current B.F.S.)? Métodos Cuantitativos M. En C. Eduardo Bustos Farías 62

The natural direction is the one in which the value of the objective function increases the most: If in Z = 3x + x 2, x is allowed to become basic, x 2 remains at and Z = 3x ; thus for each oneunit increase in x, Z increases by 3 units. On the other hand, if x 2 is allowed to become basic, Z will increase only by one unit if x 2 is increased by one unit. This is one way to determine the pivot column. Métodos Cuantitativos M. En C. Eduardo Bustos Farías 63

Métodos Cuantitativos M. En C. Eduardo Bustos Farías 64 Choosing the proper pivot element continued Another way to determine the pivot column is to examine the bottom row of the simplex tableau: 3 2 3 2 8 2 2 2 2 Z s s Z s s x x indicators entering variable

The bottom row entries to the left of the vertical line are called indicators. We choose the column with the most negative indicator as the pivot column. Having chosen the pivot column, we must now determine the pivot row in order to know which element in our simplex tableau is the pivoting element. Métodos Cuantitativos M. En C. Eduardo Bustos Farías 65

For that purpose we divide the right hand side entries of the simplex tableau by corresponding entries of the pivot column. Of the resulting quotients we choose the smallest (minimum quotient). So the pivot element is the intersection of the pivot column and pivot row. Métodos Cuantitativos M. En C. Eduardo Bustos Farías 66

The pivot element is the intersection of the pivot column and pivot row: departing variable s s 2 Z x x 2 s 2 8 2 3 2 3 s 2 Z Quotients 8 2 = 4 (smaller) 2 2 = 6 entering variable (most negative indicator) Métodos Cuantitativos M. En C. Eduardo Bustos Farías 67

Since x and s 2 will be the basic variables in our new B.F.S, it would be convenient to change our previous tableau by elementary row operations into a form where the values of x, s 2, and Z can be read off with ease just as in the initial basic solution. Métodos Cuantitativos M. En C. Eduardo Bustos Farías 68

Métodos Cuantitativos M. En C. Eduardo Bustos Farías 69 To do this we want to find a matrix which is equivalent to the tableau above but which has the form:????????? 2 2 Z s s x x where the question marks represent numbers to be determined.

6. Pivoting, which is done column wise. We must transform the tableau to an equivalent matrix that has a at the place of the pivot element (pivot entry) and s elsewhere in the column x. departing variable s s 2 Z x x s * 2 8 2 3 2 3 entering variable 2 Métodos Cuantitativos M. En C. Eduardo Bustos Farías 7 s 2 Z

Métodos Cuantitativos M. En C. Eduardo Bustos Farías 7 By elementary row operations, we have: 2 4 2 4 Z s s x x 3 2 3 2 4 3 2 3 2 8 2 Z s s x x 2 3 2 2 2 2 2 2 2 2 2 ½R -2R + R 2 3R + R 3

7. Continuing and recognizing when the algorithm terminates. General termination rule: all values in the indicator row are non-negative. Métodos Cuantitativos M. En C. Eduardo Bustos Farías 72

Métodos Cuantitativos M. En C. Eduardo Bustos Farías 73 We have a new simplex tableau: 2 4 2 4 Z s x Z s s x x 2 3 2 2 2 2 2 2 indicators All values in the indicator row are nonnegative. Hence, we have found the optimal solution for the problem. The solution is: x = 4, x 2 = and Z= 2

Linear Programs in higher dimensions maximize z = -4x + x 2 - x 3 + x 4 subject to -7x + 5x 2 + x 3 + x 4 = 8-2x + 4x 2 + 2x 3 - x 4 = x, x 2, x 3, x 4 We will describe LPs that start with the following form: equality constraints non-negative RHS nonnegative variables Métodos Cuantitativos M. En C. Eduardo Bustos Farías 74

Basic Feasible Solutions maximize z = -4x + x 2 - x 3 + x 4 subject to -7x + 5x 2 + x 3 + x 4 = 8-2x + 4x 2 + 2x 3 - x 4 = x, x 2, x 3, x 4 Suppose there are m constraints, n variables A basic solution is found by setting n-m variables to and solving the remaining system with n variables and n constraints. The n m variables are called non-basic variables The m variables are called basic variables Métodos Cuantitativos M. En C. Eduardo Bustos Farías 75

Basic Feasible Solutions maximize z = -4x + x 2 - x 3 + x 4 subject to -7x + 5x 2 + x 3 + x 4 = 8-2x + 4x 2 + 2x 3 - x 4 = x, x 2, x 3, x 4 -z x x 2 x 3 x 4-4 - = -7 5 = 8-2 4 2 - = Métodos Cuantitativos M. En C. Eduardo Bustos Farías 76

Basic Feasible Solutions -z x x 2 x 3 x 4 - -4 6-2 = 8-7 5 = 8 2-2 46 2 - -3 = -6 Example: Suppose we want the solution with basic variables x 3 and x 4, and thus x and x 2 are non-basic. We then perform pivot operations. Métodos Cuantitativos M. En C. Eduardo Bustos Farías 77

Basic Feasible Solutions Next pivot on the 3. -z x x 2 x 3 x 4 - -4-3 6 2-2 = 84-7 -3 53 = 86 2-2 -4 46 2 2-3 = -62 Métodos Cuantitativos M. En C. Eduardo Bustos Farías 78

reduced costs Basic Feasible Solutions Canonical form: basic variables have a single one in the column. -z x x 2 x 3 x 4 - -4-3 6 2-2 = 4-7 -3 53 = 86 2-2 -4 46 2 2 - -3 = -62 The basic solution is found by setting non-basic variables to. We get x =, x 2 =, x 3 =6, x 4 =2. This solution also satisfies x. It is called a basic feasible solution. Métodos Cuantitativos M. En C. Eduardo Bustos Farías 79

More on Basic Feasible Solutions Each corner point solution of the polyhedron is a basic feasible solution. The simplex method is a systematic way of moving from one basic feasible solution to another, always improving the solution, until the optimum solution is obtained. Métodos Cuantitativos M. En C. Eduardo Bustos Farías 8

The Simplex Algorithm -z x x 2 x 3 x 4 z = -3x + 2x 2-4 -3 2 = 4-3 3 = 6-4 2 = 2 The entering variable for a max problem is a variable with positive reduced cost. The pivot element is chosen uniquely in the column of Métodos Cuantitativos M. En C. Eduardo Bustos Farías 8 the entering variable so that the next basis is feasible.

The Simplex Algorithm The pivot element is chosen according to a min ratio rule. -z x x 2 x 3 x 4-3 2 - = -2 4-33 3 -.5 = 63-4 -2 2.5 = 2 A pivot is carried out, leading to the next bfs. Variable x 4 has left the basis. The new basis consists of x 2 and x 3. Métodos Cuantitativos M. En C. Eduardo Bustos Farías 82

The Simplex Algorithm Pivots are carried out until the bfs is optimal. -z x x 2 x 3 x 4-3 2 -/3 -/2 = -2-3 4-3 3 3 /3 -.5 -/2 = 63-4 -2 2 2/3 -/2.5 = 2 3 z = -x 3 /3 x 4 /2 + 3 This new bfs is optimal. Increasing x 3 or x 4 makes the solution worse. Métodos Cuantitativos M. En C. Eduardo Bustos Farías 83

The Simplex Algorithm -z x x 2 x 3 x 4-3 2 -/3 -/2 = -2-3 4-3 3 3 /3 -.5 -/2 = 63-4 -2 2 2/3 -/2.5 = 2 3 Optimality conditions for a maximization problem: all reduced costs are non-positive. Métodos Cuantitativos M. En C. Eduardo Bustos Farías 84

Simplex Method in Matrix Form x B : basic variables of final tableau x L : non-basic variables of final tableau Rearranging columns, we can express the LP as: A = [B L]: the original constraint matrix c = [c B c L ]: the original objective coefficient vector Initial Problem: Maximize z = c B x B + c L x L B x B + L x L = b x B, x L Métodos Cuantitativos M. En C. Eduardo Bustos Farías 85

Basic Feasible Solutions in Matrix Form Initial Problem: minimize z = c B x B + c L x L B x B + L x L = b x B, x L Let the bar above a vector or matrix represent the updated values in the tableau after pivoting. Final System in canonical form (after pivoting): minimize - -z + c L x L = - z x B + L x L = b x B, x L Métodos Cuantitativos M. En C. Eduardo Bustos Farías 86

L and b Start with: B x B + L x L = b B - B x B + B - L x L = B - b x B + B - L x L = B - b --> L= B - L, and b= B - b, The basic feasible solution is obtained by setting x L to. Therefore, x B = B - b. Métodos Cuantitativos M. En C. Eduardo Bustos Farías 87

c L Start with: z = c B x B + c L x L z = c B (B - b - B - L x L ) + c L x L z = c B B - b + (c L -c B B - L ) x L c L = c L -c B B - L and z= c B B - b, There is no coefficient for x B in the final system. So, we substitute for x B. Métodos Cuantitativos M. En C. Eduardo Bustos Farías 88

Notation: let π = c B B - Start with: z = c B x B + c L x L c L = c L -c B B - L and z= c B B - b, c L = c L - π L and z= π b, π is called the vector of simplex multipliers. Métodos Cuantitativos M. En C. Eduardo Bustos Farías 89

How to Convert 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. Consider the following example. Leather Limited manufactures two types of leather belts: the deluxe model and the regular model. Each type requires square yard of leather. A regular belt requires hour of skilled labor and a deluxe belt requires 2 hours of skilled labor. Each week, 4 square yards of leather and 6 hours of skilled labor are available. Each regular belt contributes $3 profit and each deluxe belt $4. Write an LP to maximize profit. Métodos Cuantitativos M. En C. Eduardo Bustos Farías 9

How to Convert an LP to Standard Form The decision variables are: x = number of deluxe belts produced weekly x 2 = number of regular belts produced weekly the appropriate LP is: max z = 4x + 3x 2 s.t. x + x 2 4 (leather constraint) 2x +x 2 6 (labor constraint) x, x 2 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. Métodos Cuantitativos M. En C. Eduardo Bustos Farías 9

How to Convert an LP to Standard Form The LP not in standard form is: max z = 4x + 3x 2 s.t. x + x 2 4 (leather constraint) 2x + x 2 6 (labor constraint) x, x 2 The same LP in standard form is: max z = 4x + 3x 2 s.t. x + x 2 + s = 4 2x + x 2 + s 2 = 6 x, x 2, s, s 2 In summary, if a constraint i of an LP is a constraint, convert it to an equality constraint by adding a slack variable s i to the i th constraint and adding the sign restriction s i. Métodos Cuantitativos M. En C. Eduardo Bustos Farías 92

How to Convert an LP to Standard Form A constraint can be converted to an equality constraint. Consider the formulation below: min z = 5 x + 2x 2 + 3X 2 + 8 x 4 s.t. 4x + 2x 2 + 5 x 3 + 5x 4 5 3x + 2x 2 6 2x + 2x 2 + 4x 3 + 4x 4 2x + 4x 2 + x 3 + 5x 4 8 x, x 2, x 3, x 4 To convert the i th constraint to an equality constraint, define an excess variable (sometimes called a surplus variable) e i (e i will always be the excess variable for the i th constraint. We define e i to be the amount by which i th constraint is over satisfied. Métodos Cuantitativos M. En C. Eduardo Bustos Farías 93

How to Convert an LP to Standard Form Transforming the LP on the previous slide to standard form yields: min z = 5 x + 2x 2 + 3X 2 + 8 x 4 s.t. 4x + 2x 2 + 5 x 3 + 5x 4 e = 5 3x + 2x 2 -e 2 = 6 2x + 2x 2 + 4x 3 + 4x 4 -e 3 = 2x + 4x 2 + x 3 + 5x 4 -e 4 = 8 x i, e i > (i =,2,3,4) In summary, if the i th constraint of an LP is a constraint, it can be converted to an equality constraint by subtracting the excess variable e i from the i th constraint and adding the sign restriction e i. Métodos Cuantitativos M. En C. Eduardo Bustos Farías 94

How to Convert an LP to Standard Form If an LP has both and constraints, apply the previous procedures to the individual constraints. Consider the example below. Nonstandard Form max z = 2x + 5x 2 s.t. x x 2 5x + 35x 2 6 2x + 5x 2 2 x, x 2 > Standard Form max z = 2x + 5x2 s.t. x + s = x 2 + s 2 = 5x + 35x 2 + s 3 = 6 2x + 5x 2 -e 4 = 2 x, x 2, s, s 2, s 3, e 4 > Métodos Cuantitativos M. En C. Eduardo Bustos Farías 95

Preview of the Simplex Algorithm 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 x + c 2 x 2 + +c n x n s.t. a x + a 2 x 2 + + a n x n =b a 2 x + a 22 x 2 + + a 2n x n =b 2...... a m x + a m2 x 2 + + a mn x n =b m x i ( i =,2,, n) Métodos Cuantitativos M. En C. Eduardo Bustos Farías 96

Preview of the Simplex Algorithm If we define: A a a 2... a m a 2 a 22... a m2............ a n a 2n... a mn x x x 2... x n b b b 2... b m 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 and solving for the remaining m variables. This assumes that setting the n m variables equal to yields a unique value for the remaining m variables, or equivalently, the columns for the remaining m variables are linearly independent. Métodos Cuantitativos M. En C. Eduardo Bustos Farías 97

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. 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. Consider the basic solutions to the system of 2 equations shown to the right: The number of nonbasic variables = 3 2 =. Setting, for example, NBV = {x 3 } (as shown to the right, then BV = {x, x 2 }. We can obtain the values for these basic variables by setting x 3 =. Solving we find x = 2, x 2 =. Thus, x = 2, x 2 =, and x 3 = is a basic solution. x + x 2 = 3 -x 2 + x 3 = - x + x 2 = 3 -x 2 + = - Métodos Cuantitativos M. En C. Eduardo Bustos Farías 98

Preview of the Simplex Algorithm If NBV = {x } and BV = {x 2, x 3 } are chosen instead, the basic solution becomes x =, x 2 = 3, and x 3 = 2. If NBV = {x 2 } and BV = {x, x 3 } are chosen instead, the basic solution becomes x = 3, x 2 =, and x 3 = -. Some sets of m variables do not yield a basic solution. Consider the linear system shown to the right: If NBV = {x 3 } and BV = {x, x 2 } the corresponding basic solution would be: x + 2x 2 + x 3 = 2x + 4x 2 + x 3 = 3 x + 2x 2 = 2x + 4x 2 = 3 Since this system has no solution, there is no basic solution corresponding to BV = {x, x 2 }. Métodos Cuantitativos M. En C. Eduardo Bustos Farías 99

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 = 2, x 2 =, x 3 = and x =, x 2 = 3, x 3 = 2 are basic feasible solutions, but the basic solution x = 3, x 2 =, x 3 = - fails to be a bfs (because x 3 < ). The following two theorems explain why the concept of a basic feasible solution is of great importance in linear programming: Theorem 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. Métodos Cuantitativos M. En C. Eduardo Bustos Farías

6 5 4 3 2 Preview of the Simplex Algorithm The relationship between extreme points and basic feasible solutions outlined in Theorem 2, is seen in the Leather Limited problem. The LP (with slack variables) was: X2 D B Labor Constraint max z = 4x + 3x 2 s.t. x + x 2 + s = 4 2x + x 2 + s 2 = 6 x, x 2, s, s 2 E Feasible Region Leather Constraint Both inequalities are satisfied in the shaded area. The extreme points are of the feasible region are B, C, E, and F. F C 2 3 4 A 5 X Métodos Cuantitativos M. En C. Eduardo Bustos Farías

Preview of the Simplex Algorithm Basic Variables Nonbasic Variables Basic Feasible Solution Corresponds to Corner Point x, x 2 s, s 2 s = s 2 =, x = x 2 = 2 E x, s x 2, s 2 x 2 = s 2 =, x = 3, s = C x, s 2 x 2, s x 2 = s =, x = 4, s 2 = - 2 Not a bfs since s 2 < x 2, s x, s 2 x = s 2 =, s = - 2 x 2 = 6 Not a bfs since s < x 2, s 2 x, s x = s =, x 2 = 4, s 2 = 2 B s, s 2 x, x 2 x = x 2 =, s = 4, s 2 = 6 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. Métodos Cuantitativos M. En C. Eduardo Bustos Farías 2

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 basic variables in common. For example in the Leather Limited LP on the previous slide, the bfs corresponding to point E is adjacent to the bfs corresponding to point C. These points share (m = 2 - = ) one basic variable, x. Points E (BV = {x,x 2 }) and F (BV = {s,s 2 }) are not adjacent since they share no basic variables. Intuitively, two basic feasible solutions are adjacent if they both lie on the same edge of the boundary of the feasible region. Métodos Cuantitativos M. En C. Eduardo Bustos Farías 3

Preview of the Simplex Algorithm General description of the simplex algorithm solving an LP in a maximization problem: Step 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 bfs. Return to Step 2, using the new bfs as the current Métodos Cuantitativos M. En C. Eduardo Bustos Farías 4

The Simplex Algorithm (max LPs) The Simplex Algorithm Procedure for maximization LPs Step Convert the LP to standard form Step 2 Obtain a bfs (if possible) from the standard form Step 3 Determine whether the current bfs is optimal Step 4 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. Step 5 Use ero s to find a new bfs with a better objective function value. Go back to Step 3. In performing the simplex algorithm, write the objective function in the form: z c x c 2 x 2 - -c n x n = We call this format the row version of the objective function (row for short). Métodos Cuantitativos M. En C. Eduardo Bustos Farías 5

The Simplex Algorithm (max LPs) Consider the simplex algorithm applied to the maximization below: The Dakota Furniture company manufactures desk, tables, and chairs. The manufacturer 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 board ft Finishing hours 4 hours 2 hours.5 hours Carpentry hours 2 hours.5 hours.5 hours Métodos Cuantitativos M. En C. Eduardo Bustos Farías 6

The Simplex Algorithm (max LPs) At present, 48 board feet of lumber, 2 finishing hours, 8 carpentry hours are available. A desk sells for $6, a table for $3, and a chair for $ 2. 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. Métodos Cuantitativos M. En C. Eduardo Bustos Farías 7

The Simplex Algorithm (max LPs) Define: x = number of desks produced x 2 = number of tables produced x 3 = number of chairs produced. The LP is: max z = 6x + 3x 2 + 2x 3 s.t. 8x + 6x 2 + x 3 48 (lumber constraint) 4x + 2x 2 +.5x 3 2 (finishing constraint) 2x +.5x 2 +.5x 3 8 (carpentry constraint) x 2 x, x 2, x 3 5 (table demand constraint) Métodos Cuantitativos M. En C. Eduardo Bustos Farías 8

The Simplex Algorithm (max LPs) Step - Convert the LP to Standard Form Canonical Form Basic Variable Row z 6x 3x 2 2x 3 = z = Row 8x + 6x 2 + x 3 + s = 48 s = 48 Row 2 4x + 2x 2 +.5x 3 + s 2 = 2 s 2 = 2 Row 3 2x +.5x 2 +.5x 3 + s 3 = 8 s 3 = 6 Row 4 x 2 + s 4 = 5 s 4 = 5 If we set x = x 2 = x 3 =, we can solve for the values s, s 2, s 3, s 4. Thus, BV = {s, s 2, s 3, s 4 } and NBV = {x, x 2, x 3 }. Since each constraint is then in canonical form (BVs have a coefficient = in one row and zeros in all other rows) with a nonnegative rhs, a bfs can be obtained by inspection. Métodos Cuantitativos M. En C. Eduardo Bustos Farías 9

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. Since z appears in row with a coefficient of, 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, s 2, s 3, s 4 } and NBV = {x, x 2, x 3 }. For this initial bfs, z =, s = 48, s 2 = 2, s 3 = 8, s 4 =5, x = x 2 = x 3 =. As this example indicates, a slack variable can be used as a basic variable if the rhs of the constraint is nonnegative. Métodos Cuantitativos M. En C. Eduardo Bustos Farías

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 yields: Z = 6x + 3x 2 + 2x 3 For each nonbasic variable, we can use the equation above to determine if increasing a nonbasic variable (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 causes the greatest rate of increase in z. If x increases from its current value of zero, it will have to become a basic variable. For this reason, x is called the entering variable. Observe x has the most negative coefficient in row. Métodos Cuantitativos M. En C. Eduardo Bustos Farías

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

The Simplex Algorithm (max LPs) The Ratio Test 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 ration is the largest value of the entering variable that will keep all the current basic variables nonnegative. Make the entering variable x a basic variable in row 3 since this row (constraint) was the winner of the ratio test (8/2 =4). Métodos Cuantitativos M. En C. Eduardo Bustos Farías 3

The Simplex Algorithm (max LPs) To make x a basic variable in row 3, we use elementary row operations (ero s) to make x have a coefficient of in row 3 and a coefficient of 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 replaces s3 as the basic variable for row 3. The term in the pivot row that involves the entering basic variable is called the pivot term. Step 5 - The Gauss-Jordan method using ero s and simplex tableaus shown on the next slide makes x a basic variable. Métodos Cuantitativos M. En C. Eduardo Bustos Farías 4

The Simplex Algorithm (max LPs) ero z x x2 x3 s s2 s3 s4 rhs ero -6-3 -2 8 6 48 2 4 2.5 2 3.75.25.5 4 row 3 divided by /2 4 5 ero 2 z x x2 x3 s s2 s3 s4 rhs 5-5 3 24 6 times row 3 added to row 8 6 48 2 4 2.5 2 3.75.25.5 4 4 5 ero 3 z x x2 x3 s s2 s3 s4 rhs 5-5 3 24 - -4 6-8 times row 3 added to row 2 4 2.5 2 3.75.25.5 4 4 5 ero 4 z x x2 x3 s s2 s3 s4 rhs 5-5 3 24 - -4 6 2 -.5-2 4-4 times row 3 added to row 2 3.75.25.5 4 4 5 Métodos Cuantitativos M. En C. Eduardo Bustos Farías 5

The result is: The Simplex Algorithm (max LPs) Canonical Form Basic Variable Row z + 5x 2-5x 3 + 3s 3 = 24 z = 24 Row - x 3 + s - 4s 3 = 6 s = 6 Row 2 - x 2 +.5 x 3 + s 2-2 s 3 = 4 s 2 = 4 Row 3 x +.75x 2 +.25x 3 +.5s 3 = 4 x = 4 Row 4 x 2 + s 4 = 5 s 4 = 5 In canonical form, BV = {z, s, s 2, x, s 4 } and NBV = {s 3, x 2, x 3 }. yielding the bfs z = 24, s = 6, s 2 = 4, x = 4, s 4 = 5, s 3 = x 2 = x 3 =. The procedure from going to one bfs to a better adjacent bfs is called an iteration (or sometime pivot) of the simplex algorithm. Métodos Cuantitativos M. En C. Eduardo Bustos Farías 6

The Simplex Algorithm (max LPs) Returning to Step 3, we attempt to determine if the current bfs is optimal. Rearranging row from Canonical Form, and solving for a yields: z = 24 5x 2 +5x 3-3s 3 The current bfs is NOT optimal because increasing x 3 to (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 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. Métodos Cuantitativos M. En C. Eduardo Bustos Farías 7

The Simplex Algorithm (max LPs) Begin iteration (pivot) 2 Performing the ratio test using x 3 as the entering variable yields the following results (holding other NBVs to zero): From row, s for all values of x 3 since s = 6 + x 3 From row 2, s 2 if x 3 > 4 /.5 = 8 From row 3, x if x 3 >4 /.25 = 6 From row 4, s 4 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 is min {8,6} = 8. So, row 2 becomes the pivot row. Step 5 - Now use ero s, to make x 3 a basic variable in row 2. Métodos Cuantitativos M. En C. Eduardo Bustos Farías 8

The Simplex Algorithm (max LPs) ero z x x2 x3 s s2 s3 s4 rhs 5-5 3 24 - -4 6 2-2 2-4 8 multiplied row 2 by 2 3.75.25.5 4 4 5 ero 2 z x x2 x3 s s2 s3 s4 rhs 5 28 add 5 times row 2 to row - -4 6 2-2 2-4 8 3.75.25.5 4 4 5 ero 3 z x x2 x3 s s2 s3 s4 rhs 5 28-2 2-8 24 add row 2 to row 2-2 2-4 8 3.75.25.5 4 4 5 ero 4 z x x2 x3 s s2 s3 s4 rhs 5 28-2 2-8 24 2-2 2-4 8 3.25 -.5.5 2 add -/4 times row 2 to row 3 4 5 Métodos Cuantitativos M. En C. Eduardo Bustos Farías 9

The Simplex Algorithm (max LPs) The result is: Canonical Form 2 Basic Variable Row z + 5x 2 + s 2 + s 3 = 28 z = 28 Row - 2x 2 + s + 2s 2-8s 3 = 24 s = 24 Row 2-2x 2 + x 3 + 2s 2-4s 3 = 8 x 3 = 8 Row 3 x +.25x 2 -.5 s 2 +.5s 3 = 2 x = 2 Row 4 x 2 + s 4 = 5 s 4 = 5 In Canonical Form 2, BV = {z, s, x 3, x, s 4 } and NBV = {s 3, s 2, x 2 }, yielding the bfs z = 28, s = 24, x 3 = 8, x = 2, s 4 = 5, s 2 = s 3 = x 2 =. Métodos Cuantitativos M. En C. Eduardo Bustos Farías 2

The Simplex Algorithm (max LPs) Solving for z in row yields: Z = 28-5x 2 - s 2 -s 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. The following rule can be applied to determine whether a canonical form s bfs is optimal: A canonical form is optimal (for a max problem) if each nonbasic variable has a nonnegative coefficient in the canonical form s row. Métodos Cuantitativos M. En C. Eduardo Bustos Farías 2

The Simplex Algorithm (min LPs) Two different ways the simplex method can be used to solve minimization problems. Consider the LP shown to the right: Method The optimal solution is the point (x,x 2 ) that makes z = 2x 3x 2 the smallest. Equivalently, this point makes max -z = - 2x + 3x 2 the largest. This means we can find the optimal solution to the LP by solving the LP shown to the right. min z = 2x 3x 2 s.t. x + x 2 4 x x 2 6 x, x 2 max -z = -2x + 3x 2 s.t. x + x 2 4 x x 2 6 x, x 2 Métodos Cuantitativos M. En C. Eduardo Bustos Farías 22

The Simplex Algorithm (min LPs) In solving this modified LP, use z as the basic variable in row. After adding slack variables s and s2 to the constraints we obtain the initial tableau. Initial Tableau Row - z x x2 s s2 rhs BVs 2-3 - z = 4 s =4 2-6 s2 = 6 ero - z x x2 s s2 rhs 2-3 4 2 2 ero 2 - z x x2 s s2 rhs BVs 5 3 2 - z = 2 4 x2 = 4 2 2 s2 = Métodos Cuantitativos M. En C. Eduardo Bustos Farías 23

The Simplex Algorithm (min LPs) The optimal solution (to the max problem) is -z = 2, x 2 = 4, s 2 =, x = s =. Then the optimal solution to the min problem is z = -2, x 2 =4, s 2 =, x = s 2 =. The min LP objective function confirms this: z = 2x -3x 2 =2() 3 (4) = -2. In summary, multiply the objective function for the min problem by - and solve the problem as a maximization problem with the objective function z. The optimal solution to the max problem will give you the optimal solution for to the min problem. Remember that (optimal z-value for the min problem) = - (optimal z-value for the max problem). Métodos Cuantitativos M. En C. Eduardo Bustos Farías 24

The Simplex Algorithm (min LPs) Method 2 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 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 as the entering variable. This modification of the simplex algorithm works because increasing a nonbasic variable (NBV) with a positive coefficient in row will decrease z. Métodos Cuantitativos M. En C. Eduardo Bustos Farías 25

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 of the optimal tableau, the LP has a unique optimal solution. Even if there is a nonbasic variable with a zero coefficient in row of the optimal tableau, it is possible that the LP may not have alternative optimal solutions. Métodos Cuantitativos M. En C. Eduardo Bustos Farías 26

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 nonbasic variable with a negative coefficient in row 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 has a non positive coefficient in each constraint Métodos Cuantitativos M. En C. Eduardo Bustos Farías 27

The LINDO Computer Package LINDO (Linear Interactive and Discrete Optimizer) is a user friendly computer package that can be used to solve linear, integer, and quadratic programming problems. The Dakota Furniture LP will solved using LINDO as an example. LINDO permits the user to name the variables so they are defined: DESKS = number of desk produced TABLES = number of tables produced CHAIRS = number of chairs produced LINDO assumes all variables are nonnegative, so nonnegative constraints are not necessary. To be consistent with LINDO, the objective function row is labeled row and constraints rows 2-5. View the LINDO Help file for syntax questions Métodos Cuantitativos M. En C. Eduardo Bustos Farías 28

The LINDO Computer Package To enter this problem into LINDO make sure the screen contains a blank window (work area) with the word untitled at the top of the work area. If necessary, a new window can be opened by selecting New from the file menu or by clicking on the File button. The first statement in a LINDO model is always the objective function. MAX or MIN directs LINDO to solve a maximization or minimization problem. Enter the constraints by typing SUBJECT TO (or st) on the next line. Then enter the constraints. LINDO assumes the < symbol means and the > symbol means. There is no need to insert the asterisk symbol between coefficients and variables to indicate multiplication. The Dakota input is shown on the next slide Métodos Cuantitativos M. En C. Eduardo Bustos Farías 29

The LINDO Computer Package Métodos Cuantitativos M. En C. Eduardo Bustos Farías 3

The LINDO Computer Package To save the file (LP formulation) for future use, select SAVE from the File menu and when asked, replace the * symbol with the name of your choice. The file will be saved with the name you select with the suffix.ltx. DO NOT type over the.ltx suffix. Save using any path available. To solve the model, from the Solve menu select the SOLVE command or click the red bulls eye button. When asked if you want to do a range (sensitivity) analysis, choose no. Range or sensitivity analysis will be discussed in Chapter 6. when the solution is complete, a display showing the status of the Solve command will be present. View the displayed information and select CLOSE. The data input window will now be overlaying the Reports Window. Click anywhere in the Reports Window to bring it to the foreground. View the next slide to see this Reports Window. Métodos Cuantitativos M. En C. Eduardo Bustos Farías 3

4.6 The LINDO Computer Package Métodos Cuantitativos M. En C. Eduardo Bustos Farías 32

The LINDO Computer Package The LINDO output shows: LINDO found the optimum solution after 2 iterations (pivots) The optimal z-value = 28 VALUE gives the value of the variable in the optimal LP solution. Thus the optimal solution calls for production of 2 desks, tables, and 8 chairs. SLACK OR SURPLUS gives (by constraint row) the value of slack or excess in the optimal solution. REDUCED COST gives the coefficient in row of the optimal tableau (in a max problem). The reduced cost of each basic variables must be. For NBVs, the reduced cost is the amount by which the optimal z-value will be reduced if the NBV is increased by unit (and all other NBVs remain ). The other LINDO outputs will be discussed in Chapters 5 and 6. Métodos Cuantitativos M. En C. Eduardo Bustos Farías 33

The Big M Method The simplex method algorithm requires a starting bfs. Previous problems have found starting bfs by using the slack variables as our basic variables. If an LP have or = constraints, however, a starting bfs may not be readily apparent. In such a case, the Big M method may be used to solve the problem. Consider the problem below. Bevco manufactures an orange-flavored soft drink called Oranj by combining orange soda and orange juice. Each orange soda contains.5 oz of sugar and mg of vitamin C. Each ounce of orange juice contains.25 oz of sugar and 3 mg of vitamin C. It costs Bevco 2 to produce an ounce of orange soda and 3 to produce an ounce of orange juice. Bevco s marketing department has decided that each - oz bottle of Oranj must contain at least 3 mg of vitamin C and at most 4 oz of sugar. Use linear programming to determine how Bevco can meet the marketing department s requirements at minimum cost. Métodos Cuantitativos M. En C. Eduardo Bustos Farías 34

The Big M Method Letting x = number of ounces of orange soda in a bottle of Oranj x2 = number of ounces of orange juice in a bottle of Oranj The LP is: min z = 2x + 3x 2 st.5x +.25x 2 4 (sugar constraint) x + 3x 2 2 x + x 2 = x, x 2, > (Vitamin C constraint) ( oz in bottle of Oranj) The LP in standard form is shown on the next slide. Métodos Cuantitativos M. En C. Eduardo Bustos Farías 35

The Big M Method The LP in standard form has z and s which could be used for BVs but row 2 would violate sign restrictions and row 3 no readily apparent basic variable. Row : z - 2x - 3x 2 = Row 2:.5x +.25x 2 + s = 4 Row 3: x + 3x 2 -e 2 = 2 Row 4: x + x 2 = In order to use the simplex method, a bfs is needed. To remedy the predicament, artificial variables are created. The variables will be labeled according to the row in which they are used as seen below. Row : z - 2x - 3x 2 = Row 2:.5x +.25x 2 + s = 4 Row 3: x + 3x 2 -e 2 + a 2 = 2 Row 4: x + x 2 + a 3 = Métodos Cuantitativos M. En C. Eduardo Bustos Farías 36

The Big M Method In the optimal solution, all artificial variables must be set equal to zero. To accomplish this, in a min LP, a term Ma i is added to the objective function for each artificial variable a i. For a max LP, the term Ma i is added to the objective function for each a i. M represents some very large number. The modified Bevco LP in standard form then becomes: Row : z - 2x - 3x 2 -Ma 2 -Ma 3 = Row 2:.5x +.25x 2 + s = 4 Row 3: x + 3x 2 -e 2 + a 2 = 2 Row 4: x + x 2 + a 3 = Modifying the objective function this way makes it extremely costly for an artificial variable to be positive. The optimal solution should force a 2 = a 3 =. Métodos Cuantitativos M. En C. Eduardo Bustos Farías 37

The Big M Method Description of the Big M Method. Modify the constraints so that the rhs of each constraint is nonnegative. Identify each constraint that is now an = or constraint. 2. Convert each inequality constraint to standard form (add a slack variable for constraints, add an excess variable for constraints). 3. For each or = constraint, add artificial variables. Add sign restriction a i. 4. Let M denote a very large positive number. Add (for each artificial variable) Ma i to min problem objective functions or -Ma i to max problem objective functions. 5. Since each artificial variable will be in the starting basis, all artificial variables must be eliminated from row before beginning the simplex. Remembering M represents a very large number, solve the transformed problem by the simplex. Métodos Cuantitativos M. En C. Eduardo Bustos Farías 38

The Big M Method If all artificial variables in the optimal solution equal zero, the solution is optimal. If any artificial variables are positive in the optimal solution, the problem is infeasible. The Bevco example continued: Initial Tableau Row z x x2 s e2 a2 a3 rhs. -2. -3. -M -M..5.25. 4. 2. 3. -.. 2. 3.... Métodos Cuantitativos M. En C. Eduardo Bustos Farías 39

The Big M Method Pivot z x x2 s e2 a2 a3 rhs ratio ero. 2m - 2 4M -3 -M 3M Row + M(Row 2) + M(Row 3).5.25. 4. 6 2. 3 -.. 2. 6.67 3.... ero z x x2 s e2 a2 a3 rhs ero. 2m - 2 4M -3 -M 3M.5.25. 4. 2.33 -.33.33 6.67 Row 2 divided by 3 3.... ero 2 z x x2 s e2 a2 a3 rhs ero. (2M-3)/3 (M-3)/3 (3-4M)/3 (6+M)/3 Row - (4M-3)*(Row 2).5.25. 4. 2.33 -.33.33 6.67 3.... ero 3 z x x2 s e2 a2 a3 rhs ero. (2M-3)/3 (M-3)/3 (3-4M)/3 (6+M)/3.42..8 -.8 2.33 Row -.25*(Row 2) 2.33 -.33.33 6.67 3.... ero 4 z x x2 s e2 a2 a3 rhs ero. (2M-3)/3 (M-3)/3 (3-4M)/3 (6+M)/3.42..8 -.8 2.33 2.33 -.33.33 6.67 3.67.33 -.33. 3.33 Row 3 - Row 2 Métodos Cuantitativos M. En C. Eduardo Bustos Farías 4

The Big M Method Pivot 2 z x x2 s e2 a2 a3 rhs ratio. (2M-3)/3 (M-3)/3 (3-4M)/3 (6+M)/3.42..8 -.8 2.33 5.6 2.33 -.33.33 6.67 2. 3.67.33 -.33. 3.33 5. ero z x x2 s e2 a2 a3 rhs ero. (2M-3)/3 (M-3)/3 (3-4M)/3 (6+M)/3.42..8 -.8 2.33 2.33 -.33.33 6.67 3..5 -.5.5 5. (Row 3)*(3/2) ero 2 z x x2 s e2 a2 a3 rhs ero. -.5 (-2M)/2 (3-2M)/2 25. Row + (3-2M)*(Row 3)/3.42..8 -.8 2.33 2.33. -.33.33 6.67 3..5 -.5.5 5. ero 3 z x x2 s e2 a2 a3 rhs ero. -.5 (-2M)/2 (3-2M)/2 25.. -.3.3 -.63.25 Row - (5/2)*Row 3) 2.33. -.33.33 6.67 3..5 -.5.5 5. ero 4 z x x2 s e2 a2 a3 rhs ero. -.5 (-2M)/2 (3-2M)/2 25.. -.3.3 -.63.25 Optimal Solution 2. -.5.5 -.5 5. Row 2 -(/3)*Row 3 3..5 -.5.5 5. Métodos Cuantitativos M. En C. Eduardo Bustos Farías 4

Literature books: George B. Dantzig, Mukund N. Thapa "Linear Programming I: Introduction" Springer Verlag Kim Marriott & Peter J. Stuckey "Programming with Constraints: An Introduction" MIT Press Métodos Cuantitativos M. En C. Eduardo Bustos Farías 42