4.3 The Simplex Method and the Standard Maximization Problem Question 1: What is a standard maximization problem? Question 2: What are slack variables? Question 3: How do you find a basic feasible solution? Question 4: How do you get the optimal solution to a standard maximization problem with the Simplex Method? In Section 4.2, we examined several linear programming problems. The common theme to these problems is the number of decision variables. To be able to solve these linear programming problems graphically, they must have exactly two decision variables. In this section you will learn how to solve linear programming problems with two or more decision variables. This strategy, called the Simplex Method, will allow us to solve the problems from section 4.2 as well as other maximization problems with more than 2 variables. Since large numbers of decision variables are common in business and industry, the Simplex Method and similar variations are standard tools used to analyze linear optimization problems with hundreds of decision variables and hundreds of constraints. 1 Question 1: What is a standard maximization problem? The Simplex Method is easiest to apply to a type of linear programming problem called the standard maximization problem. A standard maximization problem is a type of linear programming problem in which the objective function is to be maximized and has the form z a1 x1 a2 x2 an xn where a1 , , an are real numbers and x1 , , xn are decision variables. The decision variables must represent nonnegative values. The other constraints for the standard maximization problem have the form b1 x1 b2 x2 bn xn c where b1 , , bn and c are real numbers and c 0 . There are other types of linear programming problems (we’ll examine some of these in the next section), but in this section all of the problems are standard maximization problems. For instance, the craft brewery problem is a standard maximization problem. Even though the letter describing the variable P is not the same as z, it still fits the standard maximization form: 2 The objective function is maximized Maximize P 100 x1 80 x2 The objective function has the form z a1 x1 a2 x2 subject to x1 x2 50, 000 69.75 x1 85.25 x2 4, 000, 000 23.8 x1 10.85 x2 1, 000, 000 x1 0, x2 0 All constraints have the form b1 x1 b2 x2 c where c is nonnegative. Decision variables are nonnegative Since this example has only two decision variables x1 and x2 , this example does not exploit the full power of the Simplex Method. However this problem and similar problems are useful for demonstrating the Simplex Method and we’ll focus on them to begin with. Once the strategy for solving the standard maximization problem has been established, we’ll extend the strategy to more complex problems. 3 Question 2: What are slack variables? The graphical strategy for solving linear programming problems relies on the idea that the maximum value of the objective function will occur at a corner point of a bounded feasible region. The Simplex Method is no different, but we need to work with equations for the border of the feasible region in matrix form. The trouble is that augmented matrices are designed to solve equations and we have inequalities. For the graphical strategy, we simply converted each inequality to an equation. For the Simplex Method, we’ll introduce slack variables to change the inequalities to equalities. Let’s start from one of the linear programming problems from section 4.2: Maximize z 5 x 6 y subject to 2x y 4 x 2y 4 x 0, y 0 This problem is a standard maximization problem with the decision variables x and y. The goal of utilizing slack variables is to change the two inequalities to equalities. We do this by adding some unknown amount to the left hand side of each inequality. For instance, let’s look at the first inequality 2 x y 4 . This inequality corresponds to an infinite number of ordered pairs in the xy-plane. However, we can also think of this inequality as an equation. To do this you need to realize that the left hand side is less than or equal to 4. If we were to add a non-negative amount to the left side, we could increase it enough to guarantee that the left side is equal to 4. We’ll call this positive amount s1 and refer to it as the slack variable for the first inequality. The value for s1 is such that 2 x y s1 4 . In effect, the variable s1 takes up the slack in the two sides of the inequality. 4 We can apply the same reasoning to the second inequality x 2 y 4 . If we add a different nonnegative amount s2 to the left side, the inequality changes to the equality x 2 y s2 4 . Written in this format, each inequality is now an equality with the variables (including the slack variables) on the left side and the constant on the right side. The objective function z 5 x 6 y already includes an equal sign, but not in the same format as the equations derived from the constraints. Subtract 5x and 6y from both sides of the objective function to put all of the variables on the left side of the equal sign. This leaves us with the equation 5 x 6 y z 0 . If we put these three equations together, we get a system of three equations in five variables. Write the constraint equations on top of the equation corresponding to the objective function to give 2 x y s1 x 2y 5 x 6 y 4 s2 4 z0 This system can be written as an augmented matrix with three rows and six columns: x y s1 s2 z 2 1 1 0 0 4 2 0 1 0 4 1 5 6 0 0 1 0 The vertical line corresponds to the equal sign in the equations and the horizontal line helps to distinguish the constraints from the objective function. This matrix, 5 x y s1 s2 z 2 1 1 0 0 4 2 0 1 0 4 1 5 6 0 0 1 0 is called the initial simplex tableau and is the starting point for the Simplex Method. The term tableau is used when dealing with matrices in the context of the Simplex Method. The bottom row obtained from the objective function is called the indicator row. The variables above each column are not always shown, but we do so here to clarify how the variables match up with the coefficients in the augmented matrix. Example 1 Find the Initial Simplex Tableau Find the initial simplex tableau for the craft brewery linear programming problem: Maximize P 100 x1 80 x2 subject to x1 x2 50, 000 69.75 x1 85.25 x2 4, 000, 000 23.8 x1 10.85 x2 1, 000, 000 x1 0, x2 0 Solution This problem is a standard maximization problem. To convert it to a system of equations, we need to add three different slack variables to the three different inequalities. Using the slack variables s1 , s2 , and s3 , we get three equations, x1 x2 s1 69.75 x1 85.25 x2 23.8 x1 10.85 x2 50, 000 s2 4, 000, 000 s3 1, 000, 000 6 To these equations, we need to add the objective function. If we move all of the variables in P 100 x1 80 x2 to the left side of the equal sign, we are left with 100 x1 80 x2 P 0 . Combine all of the equations together with the objective function on the bottom and we get x1 x2 s1 69.75 x1 85.25 x2 50, 000 s2 23.8 x1 10.85 x2 100 x1 4, 000, 000 s3 1, 000, 000 P 80 x2 0 A 4 x 7 augmented matrix for this system of equations is x1 x2 s1 s2 s3 z 1 1 0 1 69.75 85.25 0 1 23.8 10.85 0 0 100 80 0 0 50, 000 0 0 4, 000, 000 1 0 1, 000, 000 0 1 0 0 0 This is the initial simplex tableau for the craft brewery linear programming problem. 7 Question 3: How do you find a basic feasible solution? The initial simplex tableau allows us to calculate the locations of the corner points as well as any other points where the lines corresponding to the equations cross or cross the axes. Let’s start with the initial simplex tableau x y s1 s2 z 2 1 1 0 0 4 . 1 2 0 1 0 4 5 6 0 0 1 0 Since there are more variables than equations, there is not a unique solution to the system of equations represented by the tableau. There are five variables and three equations so we need 5 3 or 2 parameters to write the solution. Any two of the variables may be parameters, but in the case of the initial simplex tableau it is convenient to choose the parameters as x and y. To see why, rewrite the augmented matrix as a system of equations, 2 x y s1 x 2y 5 x 6 y 4 s2 4. z0 The variables s1 , s2 , and z each have a coefficient of 1 and appear nowhere else in the system. In the matrix, this corresponds to the columns consisting of all zeros except for a single entry of 1. These variables are the basic variables for the initial simplex tableau. The other variables, x and y, are the nonbasic variables for the initial simplex tableau. To find possible corner points, we’ll solve for the basic variables in term of the nonbasic variables. Solve for the basic variables variables in terms of x and y: 8 s1 4 2 x y s2 4 x 2 y z 5x 6 y One possible solution to this system is found by setting the nonbasic variables x and y equal to zero. In this situation, s1 4 2 0 0 4 s2 4 0 2 0 4 . z 5 0 6 0 0 This situation corresponds to the corner point of the feasible region at x, y 0, 0 with an objective function value of z 0 . At this corner point, the slack variables take on the values s1 4 and s2 4 . Figure 1 - The corner point corresponding to a solution of the initial simplex tableau with s1 = 4, s2 = 4 and z = 0. Other corner points can be obtained by using row operations to make other variables basic instead of s1 , s2 , and z. In general, z should always be a basic variable so that it is easy to determine the value of the objective function. 9 Suppose we start from the initial simplex tableau x y s1 s2 z 2 1 1 0 0 4 2 0 1 0 4 1 5 6 0 0 1 0 and multiply the second row by 1 2 and place the result in the second row 12 R2 becomes R2 . This gives us a 1 in the second row, second column: x y s1 s2 z 2 1 1 0 0 4 1 . 1 0 12 0 2 2 5 6 0 0 1 0 If we make the rest of the second column zeros, the variable y will become a basic variable. To do this, we’ll use two row operations. First, multiply the second row by -1 and add it to the first row: 1R2 : R1 : 12 2 3 2 1 0 12 1 1 0 0 1 12 0 2 0 4 0 2 This sum will be placed in the first row. Second, multiply the second row by 6 and add it to the third row: 6 R2 : R3 : 3 6 0 3 0 12 5 6 0 0 1 0 . 2 0 0 3 1 12 This sum is placed in the third row. Putting these rows into the tableau yields 10 x y s1 s2 z 32 0 1 12 1 1 2 1 0 2 2 0 0 3 In this tableau, the variables y, 0 2 . 0 2 1 12 s1 , and z are basic, and x and s2 are nonbasic variables. Notice that by placing the 1 in the second column in the second row, the second slack variable s2 (which originally was in the second row) became nonbasic. In general, when a 1 is placed in a column to make a variable basic, the slack variable corresponding to the row it was placed in becomes nonbasic. As with the initial simplex tableau, we’ll write this matrix as a system of equations and set the nonbasic variables equal to zero. The corresponding system of equations is 3 2 x s1 12 s2 2 1 2 x y 12 s2 2 . 2 x 3s2 z 12 If we solve each equation for a different basic variable we get s1 2 32 x 12 s2 y 2 12 x 12 s2 . z 12 2 x 3s2 If we set the nonbasic variables x and s2 equal to zero, we find that s1 2 , y 2 , and z 12 . This corresponds to the corner point at x, y 0, 2 with an objective function value of z 12 . 11 Figure 2 - The corner point at (0,2) corresponding to s1 = 2, y = 2, and z = 12. It is easier to find this corner point using the tableau without transforming it to a system of equations. The key is to realize that when nonbasic variables are set equal to zero, their coefficients in the matrix disappear. For instance, if we take the tableau we transformed with row operations and cross out the columns of the nonbasic variables we get: x y s1 s2 z 0 1 12 1 1 2 1 0 2 2 0 0 3 3 2 0 2 0 2 1 12 By ignoring these columns, we can see that s1 2 , y 2 , and z 12 . Combining this observation with our knowledge of setting the nonbasic variables equal to zero gives us the corner point at 0, 2 and objective function value z 12 . We cannot arbitrarily make a variable into a basic variable. For instance, we might make x a basic variable by putting a 1 in the second row and first column and zeros in the rest of the column. Starting from the original simplex tableau, we must carry out two row operations: 12 x y 2 R2 R1 becomes R1 s1 s2 z 2 1 1 0 0 4 1 2 0 1 0 4 5 6 0 0 1 0 x y s1 s2 z 0 3 1 2 0 4 1 2 0 1 0 4 0 4 0 5 1 20 5 R2 R3 becomes R3 To find the corner point corresponding to this matrix, cover the nonbasic variables and read off the values of the basic variables: x y s1 s2 z 0 3 1 2 0 4 s1 4 1 2 0 1 0 4 x 4 0 4 0 5 1 20 z 20 Figure 3 - A solution to the tableau that is not a corner point of the feasible region. On the surface this might not seem all that different from earlier tableaus, but this one violates one of the assumptions for slack variables. In a standard maximization problem, the slack variables are assumed to be non-negative. In the solution we found from this 13 tableau, the value for s1 is negative. This tells us that this solution does not correspond to a corner point of the feasible region. The solution we have just found, 4, 0 , matches a point on a line, but is not along the border of the feasible region. If we are not careful about picking the basic and nonbasic variables, we may obtain a point that is not related to the solution. If we want to make the variable x a basic variable, it is better to use row operations to transform the original matrix x y s1 s2 z x 2 1 1 0 0 4 1 2 0 1 0 4 5 6 0 0 1 0 y 1 0 0 7 2 1 2 3 2 to s1 1 2 12 5 2 s2 z 0 0 2 1 0 1 0 1 10 By covering the columns under y and s1 , we observe that this new tableau corresponds to the solution x 2 and y 0 and the objective function value z 10 . This does match the corner point (2, 0) on the feasible region. Example 2 Change Basic Variables The basic variables for the initial simplex tableau x y s1 s2 z 2 1 1 0 0 4 2 0 1 0 4 1 5 6 0 0 1 0 are s1 , s2 , and z. Use row operations to change the tableau so that the basic variables are y, s1 , and z. What corner point of the basic feasible solution does this new tableau correspond to? 14 Solution We want to change the basic variables from s1 , s2 , and z to y, s1 , and z. This means we need to make s2 nonbasic and y basic. The other two variables, s1 and z, should remain basic variables. To make y a basic variable, we need to place two 0’s and a 1 in the column corresponding to y. The only question is where should we put the one? The first row of the second column already has a one so all we need to do is to use row operations to place zeros in the rest of the column. 2 R1 : R2 : 6 R1 : R3 : 4 2 2 0 0 8 1 2 0 3 0 2 1 0 4 1 0 4 12 6 6 0 0 24 5 6 0 0 1 0 7 0 6 0 1 24 2 R1 R2 becomes R2 6 R1 R3 becomes R3 x y s1 s2 z 2 1 1 0 0 4 3 0 2 1 0 4 7 0 6 0 1 24 If you examine the new matrix, you’ll notice that y is a basic variable, but s1 is not. Instead, s2 is a basic variable. If we place the one in the first row, the slack variable corresponding to that row, s1 , becomes a nonbasic variable. Since we want s1 to remain basic and s2 to become nonbasic, the one should be placed in the second row of the first column. Start from the original tableau 15 x y s1 s2 z 2 1 1 0 0 4 1 2 0 1 0 4 5 6 0 0 1 0 In general, we get the one by multiplying the row by a constant: x 1 2 0 1 0 4 1 2 1 0 1 2 1 2 s1 s2 z 2 1 1 0 0 4 1 1 0 12 0 2 2 5 6 0 0 1 0 1 2 R2 becomes R2 0 2 y Now we can add multiples of rows to put zeros in the rest of the second column. 1R2 : R1 : 12 2 3 2 6 R2 : R3 : 1 0 12 1 1 0 0 1 12 0 2 0 4 0 2 3 6 0 3 0 12 5 6 0 0 1 0 2 0 1R2 R1 becomes R1 x y s1 s2 0 1 1 1 2 1 0 2 2 0 0 3 3 2 1 2 z 0 2 0 2 1 12 6 R2 R3 becomes R3 0 3 1 12 Since the second, third, and fifth columns contains two zeros and a one, the basic variables are now y, s1 , and z. The point in the feasible region corresponding to this tableau is found by covering the nonbasic variable columns x and s2 . This shows the corner point to be at 0, 2 with an objective function value of z 12 . 16 Question 4: How do you get the optimal solution to a standard maximization problem with the Simplex Method? In the previous question, we learned how to make different variables into basic and nonbasic variables. This allowed us to calculate the locations of corner points on the feasible region and other points of intersection. For simple linear programming problems, there can be many such points. If we naively make different variables into basic variables, it may take a very long time to find the corner point that optimizes the objective function. The Simplex Method is an algorithm for solving standard maximization problems. By following the steps below, you ensure that the points you find by changing basic variables are corner points of the feasible region. In addition, the algorithm is iterative. In other words, it is carried out several times with the result of each iteration providing the starting point to the next iteration. The beauty of the Simplex Method is that each iteration yields a larger value for the objective function and eventually leads to the largest possible value for the objective function. To get a feel for how the Simplex Method works, let’s solve the standard maximization problem z 5x 6 y Maximize subject to 2x y 4 x 2y 4 x 0, y 0 We’ll start by converting this problem to an appropriate system of linear equations. Add a different slack variable to each constraint to yield 2 x y s1 x 2y 4 s2 4 17 To convert the objective function to an appropriate form, move all of the terms with variables to the left side of the equation. This is done by subtracting 5x and 6 y from both sides. This yields the equation 5 x 6 y z 0 . These equations form the system of linear equations 2 x y s1 x 2y 5 x 6 y 4 s2 4. z0 The augmented matrix for this system, x y s1 s2 z 2 1 1 0 0 4 , 1 2 0 1 0 4 5 6 0 0 1 0 is the initial simplex tableau. It is the starting point for carrying out the Simplex Method algorithm. The bottom row of the tableau is called the indicator row. The algorithm starts by determining which variable will become a basic variable in the first iteration of the algorithm. The variable that corresponds to the most negative entry in the indicator row will become a basic variable. For this matrix, the most negative entry is -6 in the second column. The variable y that corresponds to the column will become the basic variable. This column is the pivot column. If we pick the column with the most negative entry in the indicator row to be the pivot column, the objective function will increase by the largest amount. Remember, those negative entries correspond to positive coefficients in the original objective function. For the objective function z 5 x 6 y , the most negative entry in the indicator row, -6, corresponds to the largest positive coefficient, 6, in the objective function. Increasing the value of y in the potential solution from 0 to some positive value leads to a larger increase in the objective function value z than increasing the value of x from 0 to the 18 same positive value. This is due to the fact that the coefficient on y is larger than the coefficient of x. In effect, it is more efficient to change y values than x values in the solution. We know that we’ll need to make all of the entries but one in that column equal to zero via row operations. The other entry will be a one. The row where we will put the one is called the pivot row, and the entry that becomes a one is called the pivot. To find which row will become the pivot row, we form quotients from the entries in the pivot column and the last column: x y s1 s2 z 2 1 1 0 0 4 1 2 0 1 0 4 5 6 0 0 1 0 pivot column 4 1 4 2 4 2 The row whose quotient is positive and smallest is the pivot row. In this case, the second row is the pivot row so the pivot is the number 2 in this row. As we saw earlier, picking the pivot row carefully guarantees that the potential solution stays in the feasible region and all variables are non-negative. The variables must remain non-negative for a standard linear programming problem. Let’s look at this idea more closely. Look at the initial tableau from the standard linear programming problem: x y s1 s2 z 2 1 1 0 0 4 1 2 0 1 0 4 5 6 0 0 1 0 4 1 4 2 4 2 We already know that y will become a basic variable based on the numbers in the indicator row. By making y a basic variable, either s1 or s2 will join x as a nonbasic variable. The question is, which will it be? 19 Suppose that s1 and x will be the nonbasic variables in the next tableau, and will be set equal to zero. In this case, we can use the first row of the tableau to determine the corresponding value of y: 2 x 1y 1s1 4 2 0 1 y 1 0 4 1y 4 y Write the first row of the tableau as an equation Set x 0 and s1 0 Solve for y 4 4 1 The value of s2 is found from the second row of the tableau by setting the nonbasic variables equal to zero and y 4 : 1x 2 y s2 4 1 0 2 4 s2 4 s2 4 Write the second row of the tableau as an equation Set x 0 and y 4 Solve for s2 This is not a reasonable solution since the slack variable s2 is negative. Let’s look at making s2 and x the nonbasic variables. In this case, we can use the second row of the tableau to determine the corresponding value of y: 1x 2 y 1s2 4 2 0 2 y 1 0 4 y 4 2 2 Write the second row of the tableau as an equation Set x 0 and s2 0 Solve for y The value of s1 is found from the first row of the tableau, 2 x 1 y s1 4 2 0 1 2 s1 4 s1 2 Write the first row of the tableau as an equation Set x 0 and y 2 Solve for s1 20 All variables in this case are non-negative. Note that the values for y in each case are precisely the quotients we use to choose which row becomes the pivot row. By choosing a value for y that is smaller (the smaller quotient), we get a situation in which all variables are non-negative. Now that we know that the pivot is the 2 in the second row, second column of x y s1 s2 z 2 1 1 0 0 4 2 0 1 0 4 1 5 6 0 0 1 0 we’ll use row operations to change it to a one. The rest of the pivot column will be changed to zeros using row operations. This change in basic variables will lead to the largest increase in the value of the objective function and keep all variables nonnegative. As shown in Question 3, change the pivot to a one by multiplying the second row by x 1 2 0 1 0 4 1 2 1 0 1 2 1 2 0 2 1 2 R2 becomes R2 y 1 2 : s1 s2 z 2 1 1 0 0 4 1 1 0 12 0 2 2 5 6 0 0 1 0 Once the pivot is in place, use row operations to place zeros in the rest of the column: 21 1R2 : R1 : 12 2 3 2 6 R2 : R3 : 1 0 12 1 1 0 0 1 12 0 2 0 4 1R2 R1 becomes R1 0 2 0 0 3 1 12 y s1 s2 0 1 1 1 2 1 0 2 2 0 0 3 3 2 6 R2 R3 becomes R3 3 6 0 3 0 12 5 6 0 0 1 0 2 x 1 2 z 0 2 0 2 1 12 In the Simplex Method, the optimal solution is obtained when there are no negative numbers in the indicator row. Since the transformed matrix has a negative number in the indicator row, the solution x, y 0, 2 is not optimal. The value of the objective function, z 12 , can be made greater by picking the first column to be the pivot column. To find the pivot row, examine the quotients formed from dividing entries in the last column by corresponding entries in the pivot column: x y s1 s2 32 0 1 12 1 1 2 1 0 2 2 0 0 3 pivot column The smallest quotient is 4 3 z 2 0 2 1 12 2 0 in the first row. The pivot, 3 2 2 1 2 3 2 4 3 4 , is in the first row, first column. As in the first iteration, we must use row operations to change the pivot to a one and change the rest of the pivot column to zeros. To change the pivot to a one, multiply the first row by 2 3 : 22 3 2 0 1 12 2 3 1 0 x 0 2 2 3 13 0 4 3 y s1 s2 z 1 0 23 13 0 34 1 1 2 1 0 2 0 2 2 0 0 3 1 12 2 3 R1 becomes R1 To complete the transformation of the pivot column, we must use row operations to put zeros in the rest of the pivot column: 12 R1 : R2 : 2 R1 : R3 : 12 1 2 0 13 1 0 1 2 0 23 0 2 0 1 13 2 3 0 1 6 2 0 43 23 2 0 0 3 0 0 4 3 7 3 0 12 R1 R2 becomes R2 4 3 8 3 44 3 y s1 1 0 23 1 0 1 3 0 0 4 3 2 R1 R3 becomes R3 1 12 1 x s2 z 13 0 2 0 3 7 1 3 4 3 44 3 4 3 For this tableau, the basic variables are x, y, and z. The nonbasic variables are s1 and s2 . The indicator row has no negative entries so this tableau is the final tableau. The optimal solution is read from this tableau by setting the nonbasic variables equal to zero. If we cover the nonbasic variables, x y s1 s2 z 1 0 23 1 0 1 3 0 0 4 3 13 0 0 1 2 3 7 3 , 4 3 44 3 4 3 we see that this tableau corresponds to x, y 43 , 43 and an optimal value of z 44 3 . This is the same value we found graphically in Section 4.2 The process outlined here is summarized in the steps shown here. 23 The Simplex Method 1. Make sure the linear programming problem is a standard maximization problem. 2. Convert each inequality to an equality by adding a slack variable. Each inequality must have a different slack variable. Each constraint will now be an equality of the form b1 x1 b2 x2 bn xn s c where s is the slack variable for the constraint. If more than one slack variable is needed, use subscripts like s1 , s2 , 3. Rewrite the objective function z a1 x1 a2 x2 an xn by moving all of the variables to the left side. After rewriting the equation, the function will have the form a1 x1 a2 x2 an xn z 0 . 4. Convert the equations from steps 2 and 3 to an initial simplex tableau. Put the equation from step 3 in the bottom row of the tableau and all other equations above it. The bottom row is called the indicator row. 5. Find the entry in the indicator row that is most negative. If two of the entries are most negative and equal, pick the entry that is farthest to the left. The column with this entry is called the pivot column. 24 6. For each row except the last row, divide the entry in the last column by the entry in the pivot column. The row with the smallest positive quotient is the pivot row. If more than one row has the same smallest quotient, the higher of the rows is the pivot row. 7. The pivot is the entry where the pivot row and pivot column intersect. Multiply the pivot row by the reciprocal of the pivot to change it to a one. 8. To change the rest of the pivot column to zeros, multiply the pivot row by constants and add them to the other rows in the tableau. Replace those rows with the appropriate sums. When complete, the pivot should be a one, and the rest of the pivot column should be zeros. 9. If the indicator does not contain any negative entries, this tableau corresponds to the optimum solution. In this case, cover the nonbasic variables (set the nonbasic variables equal to zero), and read off the solution for the basic variables. Otherwise, repeat steps 5 through 9 until the indicator row contains no negative numbers. The Simplex Method will reach an optimal solution for a standard maximization problem with any number of variables and any number of inequalities. However, problems with large numbers of variables and inequalities may require many iterations of steps 5 through 9 to reach the optimal solution. Take special care to avoid arithmetic errors when carrying out the row operations. A graphing calculator can make the task of carrying out the row operations fairly painless. 25 Example 3 Find the Optimal Solution Find the optimal solution to the linear programming problem Maximize z 2 x1 5 x2 subject to 2 x1 3 x2 15 7 x1 6 x2 63 x1 5 x2 3 x1 0, x2 0 Solution Although this example has three constraints (in addition to the non-negativity constraints), it still has two decision variables. Each constraint needs a slack variable to convert it to an equation. Using the slack variables s1 , s2 , and s3 , the constraints become 2 x1 3 x2 s1 7 x1 6 x2 15 s2 x1 5 x2 63 s3 3 Move all of the variable terms in the objective function to the left side of the equation to yield 2 x1 5 x2 z 0 These equations become the initial simplex tableau x 1 x 2 2 3 7 6 1 5 2 5 s 1 s 2 s 3 z 1 0 0 0 15 0 1 0 0 63 0 0 1 0 3 0 0 0 1 0 26 The bottom row of the initial simplex tableau is the indicator row. The most negative entry of the indicator row is -5. This means the pivot column is the second column in the tableau. To determine the pivot row, compute the quotients formed by dividing entries in the last column by entries in the pivot column, x 1 x 2 2 3 7 6 1 5 2 5 s s 1 2 s 3 z 1 0 0 0 15 0 1 0 0 63 0 0 1 0 3 0 0 0 1 0 15 3 63 6 5 10.5 Any negative quotients, such as 53 in the third row, are discarded. The quotient formed in the first row, 15 3 , is the smallest quotient so the pivot is the 3 in the first row, second column. In the first iteration of the simplex method, we must use row operations to change the pivot to a one and all other entries in the pivot column to zero. The pivot is changed to a one by multiplying the first row by 1 3. Carrying out the row operation yields x x 1 2 3 1 0 0 0 15 23 1 1 3 1 3 0 0 0 5 1 3 R1 becomes R1 7 1 2 2 3 2 s 1 1 3 s 2 s 3 1 0 0 6 0 1 0 5 0 0 1 5 0 0 0 z 0 5 0 63 0 3 1 0 Three row operations are necessary to put the zeros in the rest of the pivot column: 27 6 R1 : R2 : 4 6 2 0 0 0 30 7 6 0 1 0 0 63 11 5R1 : R3 : 103 1 73 5R1 : R4 : 2 1 0 0 33 0 6 R1 R2 becomes R2 5 53 0 0 0 25 5 0 0 1 0 3 0 5 3 5 53 0 0 0 25 5 0 0 0 1 0 43 0 5 3 0 0 1 1 11 73 4 3 2 3 5 R1 R3 becomes R3 0 1 0 28 103 2 x x s 2 1 s 2 s 3 z 5 0 2 1 0 0 33 0 53 0 1 0 28 0 53 0 0 1 25 1 1 3 0 0 0 5 R1 R4 becomes R4 25 The new tableau corresponds to the solution x1 , x2 0,5 and is not optimal since there is a negative entry in the indicator row. The new pivot column is the first column due to the negative number in the indicator row. To find the new pivot row, compute the quotient formed from dividing the entries in the last column by the entries in the new pivot column: x 1 23 11 73 4 3 x 2 s 1 s 2 s 3 z 1 13 0 0 0 5 0 2 1 0 0 33 0 53 0 1 0 28 0 53 0 0 1 25 33 11 3 The second row is the only row with a valid quotient so it is the pivot row. The pivot is the 11 in the second row, first column of the tableau. 28 Multiply the pivot row by 1 11 to change the pivot to a one: x x 1 11 0 2 1 0 0 33 0 112 1 1 11 1 73 4 3 2 3 0 0 1 11 R2 becomes R2 1 11 3 s 2 s 1 1 0 0 112 0 53 5 3 0 2 s 3 z 5 1 0 0 3 11 0 1 0 28 0 0 1 25 1 3 0 0 To complete this Simplex Method iteration, we must place zero above and below the pivot using row operations. Three row operations are required to place the zeros above and below the pivot. 23 0 334 1 13 0 1 7 3 0 0 2 3 2 3 R2 : R1 : 7 3 R2 : R3 : 4 3 R2 : R4 : 7 3 7 33 14 33 5 3 41 33 0 0 4 3 43 0 338 0 53 0 0 47 33 2 33 0 2 33 7 33 0 0 2 0 0 5 0 0 7 0 0 0 7 1 0 28 7 33 1 0 35 4 33 0 0 0 4 0 1 25 4 33 0 1 R2 R1 becomes R1 2 3 R2 R3 becomes R3 7 3 x 1 0 1 0 0 x 2 s 1 7 33 1 0 112 41 0 33 0 47 33 s 2 2 33 1 11 7 33 4 33 s 3 z 7 3 1 0 35 0 1 29 0 0 0 0 R2 R4 becomes R4 4 3 29 The indicator row does not contain any negative numbers so the optimal solution has been reached. The solution to the linear programming problem is easily observed by covering the columns corresponding to the nonbasic variables s1 and s2 : 29 x x 0 1 0 0 1 1 2 s 7 33 0 0 0 1 2 11 41 33 47 33 s 2 s 2 33 1 11 7 33 4 33 3 z 7 0 0 3 1 0 35 0 1 29 0 0 The optimal solution to the linear programming problem is z 29 and occurs at x1 , x2 3, 7 . Example 4 Find the Optimal Production Level The linear programming problem for the craft brewery is Maximize P 100 x1 80 x2 subject to x1 x2 50, 000 69.75 x1 85.25 x2 4, 000, 000 23.8 x1 10.85 x2 1, 000, 000 x1 0, x2 0 where x1 is the number of barrels of pale ale, and x2 is the number of barrels of porter. Use the Simplex Method to find the production level that maximizes profit. Solution In Example 1, we added slack variables and found the initial simplex tableau for this standard maximization problem. 30 The initial simplex tableau is a 4 x 7 matrix, x x 1 s 2 s 1 s 2 1 1 0 1 69.75 85.25 0 1 23.8 10.85 0 0 100 80 0 0 P 3 0 0 50, 000 0 0 4, 000, 000 1 0 1, 000, 000 0 1 0 The most negative entry in the indictor row is -100. This entry means the pivot column is the first column in the tableau. The quotients formed from the last column and the pivot column, x x 1 2 s 1 s 2 1 1 0 1 69.75 85.25 0 1 23.8 10.85 0 0 100 80 0 0 s 3 0 0 1 0 P 50, 000 0 0 4, 000, 000 0 1, 000, 000 1 0 50, 000 57,348 42, 017 50,000 1 4,000,000 69.75 1,000,000 23.8 indicate that the third row is the pivot row. The third row must be multiplied by 1 23.8 to change the pivot to a one. x 1 23.8 10.85 0 0 1 0 1, 000, 000 1 0.456 0 0 0.042 0 1 23.8 42, 016.8 1 23.8 R3 becomes R3 x 2 s 1 s 2 s 3 P 1 1 0 0 0 50, 000 1 69.75 85.25 0 1 0 0 4, 000, 000 1 0.456 0 0 0.042 0 42, 016.8 0 1 0 100 80 0 0 The entries in the first six columns are shown rounded to three decimal places when necessary, and the entries in the last column are rounded to the nearest tenth. 31 Now we need to use three row operations to place zeros in the rest of the pivot column. 1R3 : R1 : 1 0.456 0 0 0.042 0 42, 016.8 1 1 1 0 0 0 50, 000 0 0.544 1 0 0.042 0 7983.2 1R3 R1 becomes R1 x x 1 69.75 R3 : 69.75 31.798 0 0 2.931 0 2,930, 672.3 R2 : 69.75 85.25 0 1 0 0 4, 000, 000.0 0 100 R3 : R4 : 53.452 0 100 45.588 100 80 0 1 2.931 0 1, 069,327.7 4.202 1 69.75R3 R2 becomes R2 s 1 1 0 0 0 s 2 P 3 0 0.042 0 7983.2 1 2.931 0 1, 069,327.7 0 0.042 0 42, 016.8 0 4.202 1 4, 201, 680.7 100 R3 R4 becomes R4 0 0 4.202 0 4, 201, 680.7 0 0 0 1 0 34.412 0 0 s 2 0 0.544 0 53.452 1 0.456 0 34.412 4, 201, 680.7 The negative number in the indicator row tells us that the second column will be the new pivot column. To locate the new pivot, form the quotients with the last column and second column. The quotients for the individual rows are x 1 x 2 0 0.544 0 53.452 1 0.456 0 34.412 s 1 s 2 s 3 P 1 0 0.042 0 0 1 2.931 0 1, 069,327.7 0 0 0.042 0 42, 016.8 0 0 4.202 1 4, 201, 680.7 7983.2 14, 675 7983.2 0.544 1,069,327.7 53.452 42,016.8 0.456 20, 005 92,142 The numbers shown in the quotient are rounded numbers, and the amount calculated is rounded to the nearest integer. This does not affect our choice of the pivot row. If the quotients are close to each other, carry more decimals so you do not choose the wrong pivot row due to rounding. The new pivot is 0.544 in the first row, second column. 32 The new pivot is changed to a one by multiplying the first row of the tableau by 1 0.544 : x 1 0 0.544 0 1 0 0.042 0 1 7983.2 R1 becomes R1 1.838 0 0.077 0 14, 671.8 2 s s 1 s 2 P 3 1 1.838 0 0.077 0 14, 671.8 0 0 53.452 0 1 2.931 0 1, 069,327.7 1 0.456 0 0 0.042 0 42, 016.8 0 0 4.202 1 4, 201, 680.7 0 34.412 1 0.544 1 0.544 x We use three row operations to put zeros in the rest of the pivot column: 53.452 R1 : R2 : 0 53.452 98.236 0 4.128 0 784, 240.8 0 53.452 0 1 2.931 0 1, 069,327.7 0 0 98.236 1 1.197 0 285, 086.9 53.425 R1 R2 becomes R2 0.456 R1 : R3 : 0 0.456 0.838 0 0.035 0 6688.6 1 0.456 0 0 0.042 0 42, 016.8 1 34.412 R1 : R4 : 0 0.838 1 0.077 0 35,328.2 504,883.0 0 34.412 63.243 0 2.658 0 0 34.412 0 0 4.202 1 4, 201, 680.7 0 0 63.243 0 1.544 1 x x 1 0.456 R1 R3 becomes R3 0 0 1 0 s 2 s 1 s 2 P 3 1 1.838 0 0.077 0 0 98.236 1 1.197 0 0 0 0.838 63.243 1 0 0.077 1.544 14, 671.8 285, 086.9 0 35,328.2 1 4, 706,563.7 34.412 R1 R4 becomes R4 4, 706,563.7 Since there are no negative numbers in the indicator row, we can read the solution from this tableau. If we cover the nonbasic variables s1 and s3 ,we see that the solution corresponding to this tableau is x1 , x2 35,328.2, 14, 671.8 and P 4, 706, 563.7 or approximately 35,328 barrels of pale ale and 14,672 barrels of porter for a maximum profit of about $4,706,564. 33 Example 3 and Example 4 both have two decision variables and were also done graphically in Section 4.2. In the next example, we apply the Simplex Method to a problem with three decision variables. Problems with more than two decision variables are impossible to do with the graphical methods introduced in Section 4.2. Example 5 Find the Optimal Investment Portfolio Investing in stocks and mutual funds are a tradeoff. We want to maximize the money we make from investments, but manage the risk of losing money in poor investments. Typically, investments with higher returns are riskier, and investments with lower returns are less risky. Investors use several statistics to quantify the returns on their investments. For instance, websites such as Yahoo Financial calculate measures like average rate of return. This number indicates the investor’s total returns on an investment annualized over some time period. The higher the average rate of return, the more gains you achieve from dividends or the sale of the stock or mutual fund. There are also several measures of risk available to investors. One commonly used indicator is called beta. The beta of a stock or mutual fund is calculated using regression analysis. The details of the analysis are not important for our purposes. However, understanding what the beta tells you is an important investing tool. A stock or mutual fund’s beta measures the volatility of the investment’s price with respect to some benchmark like the S & P 500 or the Dow Jones Industrial Average. A beta of 1 indicates that the investment’s price will change with the benchmark’s changes. A beta less than 1 indicates that the investment’s price is less volatile than the benchmark. In other words, changes in the benchmark will be larger than changes in the investment’s price. A beta greater than 1 indicates that the investment’s price is more volatile than the benchmark. In this case, 34 changes in the benchmark will be smaller than changes in the investment’s price. Suppose an investor is interested in investing in three different mutual funds. The funds, their five year average annual return, and beta values are shown (as of July 31, 2010) in the table below: Fund 5 Year Average Annual Return Beta TIAA-CREF Mid Cap Value Fund (TCMVX) 1.72% 1.16 TIAA-CREF Growth & Income Fund (TIIRX) 2.88% 0.93 TIAA-CREF International Equity Fund (TIERX) 2.67% 1.04 The fund TIIRX has the highest rate of return and the lowest beta. The fund TCMVX has the lowest rate of return and the highest beta. On the surface, it would appear that the investor should put all of their money in TIIRX since that would yield the highest return and the lowest risk. Each investor has their own requirements for their investments and in this case, the investor wants to diversify their holdings. This means the investor wants to lower their overall risk by investing in several broad categories of stocks. TIIRX seeks to invest 80% of its funds in securities which offer long term returns. It invests approximately 20% in smaller companies that offer an opportunity at growth. While this may seem like a good mix, the investor wishes the sum of what is invested in TCMVX and TIERX to be at least 25% of what is invested in TIINX. If the investor has $100,000 to invest and wishes the average weighted beta to be no larger than 1, how much should the investor put in each of the three funds so that their returns are maximized? 35 Solution A good starting point for linear programming problems is the variables. In this problem, we want to find the amount of money to invest in each fund. It makes sense to define the variables as follows: M: amount of money invested in Mid Cap Value Fund. G: amount of money invested in Growth & Income Fund. E: amount of money invested in International Equity Fund We wish to maximize the return on the investment. The return on an investment is found by multiplying the amount invested by the average annual return. Since M, G, and E represent the amounts of money invested, 0.0172 M , 0.0288G , and 0.0267 E represent the return on these amounts. The objective function is the sum of these amounts or R 0.0172 M 0.0288G 0.0267 E , where R is the total return. Three pieces of information can help us to write out constraints. First, the investor has $100,000 to invest. This means the sum of the amounts invested in each fund must be less than or equal to 100,000 or M G E 100, 000 . sum of the amounts invested Second, the investor wishes the sum of what is invested in the Mid Cap Value Fund and International Equity Fund to be at least 25% of what is invested in Growth & Income Fund. Focusing on the word “sum” and the phrase “25% of”, we write M E sum of Mid Cap and International Equity Funds 0.25 G 25% of Growth & Value Fund 36 The word “sum” indicates that we must add the two quantities and the phrase “25% of” indicates that we must multiply the quantity by 0.25. The final piece of information dictates that the investor “wishes the average weighted beta to be no larger than 1”. A weighted average tells us that we need to add up some terms and then divide by a total amount. The weighted sum of the risk is written as 1.16 M 0.93G 1.04 E . The term “weighted” indicates the presence of the variable in each term. If we had simply added up the beta values, they would have each contributed “equally” to the sum since each one appears in their own term. By multiplying the beta value by the amount invested in the corresponding fund, we are weighting the beta by the amount invested. If we do this, then a fund with a large amount in it will contribute more to the sum than a fund with very little invested in it. To average the weighted sum, we divide by the total amount invested or M G E . The constraint 1.16M 0.93G 1.04 E 1 M G E reflects the investor’s wish that the average weighted beta be no more than 1. If we add non-negativity constraints, the linear programming problem becomes Maximize R 0.0172 M 0.0288G 0.0267 E subject to M G E 100, 000 M E 0.25G 1.16M 0.93G 1.04 E 1 M G E M 0, G 0, E 0 37 This linear programming problem is not in standard maximum form since the second and third constraints do not have the form b1 x1 b2 x2 bn xn c where b1 ,, bn and c are real numbers and c 0 . A little algebra changes these constraints to the proper form. If we start with the second constraint and subtract M and E from both sides, we get the inequality 0 0.25G M E . Flip the inequality and rearrange the order of the terms to yield M 0.25G E 0 . This inequality has the proper form. If we start with the third inequality and multiply both sides by M G E we are left with 1.16 M 0.93G 1.04 E M G E . Collect all of the terms on the left side to yield 0.16 M 0.07G 0.04 E 0 With these modifications, we can write out a standard maximization problem: 38 Maximize R 0.0172 M 0.0288G 0.0267 E subject to M G E 100, 000 M 0.25G E 0 0.16 M 0.07G 0.04 E 0 M 0, G 0, E 0 Now that the problem is in standard form, we can add slack variables to the constraints and write out the initial simplex tableau. The objective function must be rewritten with all terms on the left side of the equal sign or 0.0172 M 0.0288G 0.0267 E R 0 Notice that the variables are written in a particular order. Since the terms will match with columns in the tableau, we need to use this order for each equation we write. Add the slack variables s1 , s2 , and s3 to the inequalities M G E 100, 000 M 0.25G E 0 0.16M 0.07G 0.04 E 0 to give the equations M G M 0.25G E s1 E 0.16 M 0.07G 0.04 E 100, 000 s2 0 s3 0 Combine these equations with the equation from the objective function to give 39 M G E s 1 1 1 1 1 0.25 0.16 0.07 0.04 0.0172 0.0288 0.0267 s 1 2 s 3 1 0 0 0 1 0 0 0 1 0 0 0 R 0 100, 000 0 0 . 0 0 1 0 From this initial simplex tableau we need to pick a pivot column and row. To find the pivot column, locate the most negative entry in the indicator row at the bottom. The entry -0.0288 is the most negative entry so the second column is the pivot column. The quotients for picking the pivot row are found by dividing the entries in the last column by the corresponding entries in the pivot column, M G E 1 1 1 1 1 0.25 0.16 0.07 0.04 0.0172 0.0288 0.0267 s 1 s 2 s 3 1 0 0 0 1 0 0 0 1 0 0 0 R 0 100, 000 0 0 0 0 1 0 100, 000 1 0 0.25 100, 000 0 Remember that quotients with a negative numerator or denominator are ignored so the quotient for the third row isn’t even computed. The second row contains the smallest quotient, so the pivot is 0.25 in the second row, second column. To change the pivot to a one, multiply the second row by M 1 0.25 1 0 1 0 0 0 4 4 1 4 0 4 0 0 0 4 R2 becomes R2 G 1 0.25 E 1 1 1 4 4 1 0.16 0.07 0.04 0.0172 0.0288 0.0267 or 4: s 1 1 0 0 0 s 2 0 4 0 0 s R 3 0 100, 000 0 0 0 0 1 0 0 0 1 0 40 With the pivot changed, row operations are needed to change the other numbers in the pivot column to zeros. 1R2 : R1 : 4 1 4 0 4 0 0 0 1 1 1 1 0 0 0 100, 000 5 5 1 4 0 0 100, 000 0 1R2 R1 becomes R1 0.28 0.07 0.28 0 0.28 0 0 0 0.16 0.07 0.04 0 0 1 0 0 0.07 R2 : R3 : 0.12 0.0288 R2 : 0.1152 0.0288 R4 : 0.0172 0.0288 0.1324 0 0.1152 0 0.1152 0 0 0 0.0267 0 0 0 1 0 0.1419 0 0.1152 0 G E s s 1 5 4 0.12 0.1324 0.07 R2 R3 becomes R3 0.24 0 0.28 1 0 0 0 M 0 1 5 4 s 2 4 4 1 0 R 3 0 100, 000 0 0 0 0 1 0 0 0 0 0.24 0 0.28 1 0 0.1419 0 0.1152 0 0.0288 R2 R4 becomes R4 1 0 After the first Simplex Method iteration, there is still a negative number in the indicator row. This tableau does not correspond to an optimal solution so we must select the first column as the pivot column and determine the new pivot row. Only the first row has an admissible quotient. The 5 in the first row, third column will be the new pivot. To change the pivot to a one, multiply the first row by 5 0 5 1 4 0 0 100, 000 1 0 1 1 5 4 5 1 5 0 0 20, 000 1 5 R1 becomes R1 M G 1 4 0.12 0.1324 1 5 : E s 0 1 1 4 1 5 0 0.24 1 s 2 s 3 0 54 4 0 0 0 0.28 1 0 0.1419 0 0.1152 0 R 0 20, 000 0 0 0 0 1 0 41 Row operations are required to change the rest of the column into zeros. 4 R1 : R2 : 4 0 4 54 165 4 1 4 0 4 0 0 80, 000 0 0 0 M G E s s 1 0 1 0 4 5 4 5 0 0 80, 000 4 R1 R2 becomes R2 0.24 R1 : 0.24 0 0.24 0.048 0.192 0 0 4800 R3 : 0.12 0 0.24 0 0.28 1 0 0 0.12 0.1419 R1 : R4 : 0 0.1419 0 0 0.048 0.1419 0.1324 0 0.1419 0.0095 0 0 0.088 0.24 R1 R3 becomes R3 1 0 0.12 0.0095 0 1 1 0 1 5 4 5 s 2 R 3 54 0 0 4 5 0 0 0.048 0.088 1 0 0 0.02838 0.00168 0 1 0 4800 0.02838 0.11352 0 0 2838 0 0.1152 0 1 0.02838 0.00168 0 0.1419 R1 R4 becomes R4 0 1 2838 After the row operations, there are no negative numbers in the indicator row. Covering the first, fourth and fifth columns, we can read off the solution M , G, E 0, 80, 000, 20, 000 and R 2838 . Remember, by covering the first column we are assuming that M 0 . The optimal solution is to invest no money in the Mid Cap Value Fund, $80,000 in the Growth & Income Fund, and $20,000 in the International Equity Fund. This combination of investments results in the largest return of $2838. Even with more variables, the Simplex Method allows the standard maximization problem to be solved. Adding more decision variables or constraints simply adds more columns or rows to the initial simplex tableau. Although this makes for more writing, it does not change how the Simplex Method is applied. 42 0 20, 000 0 80, 000 0 4800 1 2838
© Copyright 2026 Paperzz