Math 438 ACTIVITY 12: WHY: Algebraic Solutions to LP Problems This activity develops a search process for the basic feasible solution [extreme point] that minimizes our objective function [That is, for our optimal solution]. It is an “improvement” method – we start from some basic feasible solution and look for an adjacent [only one change in basic variables] better [smaller objective value] basic feasible solution. The method also will tell us if the objective is not bounded below on the feasible region. This iterative “keep improving until no more improvement is possible” approach is often referred to as “the optimization cycle” and is, itself, and important idea in applied mathematics (especially algorithmic mathematics). The techniques developed here will be coded into the “Simplex algorithm” – the standard solution method for linear programming problems. VOCABULARY: Basis Matrix, basic variable, nonbasic variable, basic feasible solution A Basis Matrix B is a nonsingular submatrix of the matrix A of coefficients (of the constraints) in a linear programming problem in standard form. The variables corresponding to the columns of B are called basic variables. The variables corresponding to the other columns of A (those not in B ) are called nonbasic variables. A vector whose entries corresponding to nonbasic variables are zero and whose entries corresponding to the basic variables are obtained from the solution to BX = b is called a basic solution and represents a point defined by the intersection of the hyperplanes corresponding to some (k = number of rows in matrix) of the constraints (total set of constraints includes the “nonnegativity” constraints). A basic feasible solution (BFS) is such a solution in which no variables take on negative values (so the point is in the feasible region – and is an extreme point) The set of basic feasible solutions is the same as the set of extreme points of the feasible region for the standard form of the problem. Entering variable When we try to improve our current solution (get a smaller value of the objective) we look at a new basis matrix obtained by replacing one (current) basic variable with a (current) non-basic variable. The new variable that comes into the basis is the entering variable - it is the variable whose increase (from 0) will produce the greatest rate of decrease in the objective. [It has most negative coefficient in the objective] Departing variable The departing variable is the variable that will be removed from the set of basic variables. It is the first variable pushed to 0 as the entering variable increases. The departing variable is identified by the minimum ratio rule Minimum ratio rule When xi enters the basis (is increased from 0) the first basic variable whose value is forced down to 0 (the departing variable) is the variable that gives the smallest positive ratio when we 1. Solve for the each basic variable (using equation whose row holds the pivot for that variable) 2. In each equation, replace each basic variable on the right with its expression from its own equation 3. Take the ratio (constant term/(negative of coefficient of xi) [This ratio tells what increase in xi will force the variable to 0 – the first variable forced to 0 must leave the basis, since negative values for basic variables identify infeasible basic solutions] LEARNING OBJECTIVES: 1. 2. 3. Discover how to determine basic feasible solutions to a linear programming problem. Discover how to use the minimum ratio rule to determine the closest improved basic feasible solution. Practice working quickly as a team to solve a problem. CRITERIA: 1. 2. Proficiency in moving from the statement of an LP problem to an optimal solution by applying the minimum ratio rule to each basic feasible solution. Speed with which the team solves the problem. PLAN: Work through the Models and the Exercise and answer the Critical Thinking Questions METHODOLOGY: Summary: We find an initial basic feasible solution and then, iteratively, find an adjacent (one basic variable replaced by one other basic variable – corresponding to adjacent extreme points) basic feasible solution that improves the value of our objective. 1. Put in Standard Form Add slack or subtract surplus variables to put the problem in the form: Minimize CTX subject to AX = b, X ≥ 0. 2. Find Identity Basis [possibly “scrambled”] Check that there is a pivot with value 1 in each row of A. If not, stop! You cannot use this process. [Note: If the columns of the Identity are not in order we can still proceed] 3. Choose ”entering variable ” [non-basic variable to put into Basis] Find the non-basic variable whose increase will cause the greatest decrease in the objective function [most negative coefficient in the objective] 4. Solve constraints for Basic Variables Solve each of the constraints for its basic variable. Leave entering variable as a variable, substitute 0 for other non-basic variables, expressions from other equations for basic variables 5. Apply Minimum Ratio Rule to find “departing variable” [variable forced out of basis] Divide the negative of the coefficient of the entering variable into the constant term in each step 4 equation. The minimum positive quotient identifies the variable to remove from the basis. [If all quotients are negative, stop - the function is not bounded below on the feasible region.] 6. Write new Basis Matrix and reduce to find BFS . 7. Repeat Steps 3-6 Replace the column corresponding to the departing variable with the column of A corresponding to the entering variable to form a new basis matrix. Augment and reduce to find its BFS Check objective function to find another variable to bring into the basis and repeat process. When there are no more variables that can be increased you are finished and the final basic feasible solution is optimal. RESOURCES: 1. 2. Section 3.2: Strategic Mathematics, especially example 3.2.6. 30 minutes MODEL 1: We will solve exercise 1.6 algebraically. This problem can be written as follows: maximize subject to: 1. Put in Standard Form 10y1 + 300y2 0.2y1 + 30y2 ≤ 0.05 1.5y1 + 35y2 ≤ 0.07 y1 ≥ 0, y2 ≥ 0 Add slack or subtract surplus variables to put the problem in the form: Minimize CTX subject to AX = b, X ≥ 0. The standard form is as follows: [ y3 and y4 are slack variables]. ^ ^ ^ NOTATION: We will use the names A , X , C (rather than A, X, C) for the coefficient matrix (of constraints), variable vector, and coefficient vector (of the objective) of this version of the problem (the standard form) since the discussion applies to any LP program in this standard form and this is the usual notation. In solving for the BFS we need to remember what variable is represented by each column of B. - minimize -10y1 - 300y2 subject to 0.2y1 + 30y2 + y3 = 0.05 1.5y1 + 35y2 + y4 = 0.07 y1 ≥ 0, y2 ≥ 0, y3 ≥ 0, y4 ≥ 0 y1 -10 y2 -300 0.2 30 1 0 0.05 0.2 30 1 0 C = 0 X = y A = 1.5 35 0 1 b = 0.07 1.5 35 0 1 3 0 y4 2. Find Identity Basis Check that there is a pivot with value 1 in each column of A. [They need not be in echelon-form order] If not, stop! You cannot use this process. The last two columns of A, form an Identity matrix. Thus the basic variables are y3 and y4 (values 0.05 and 0.07, respectively). The nonbasic variables are y1 and y2. The basic feasible solution is [0 0 0.05 0.07] T. 3. Choose ”entering variable ” [non-basic Variable to put into Basis] Find the non-basic variable whose increase will cause the greatest decrease in the objective function [most negative coefficient in the objective] Increasing either y1 or y2 in the objective function will decrease this function. Since y2 has a more negative coefficient in the objective (-300 vs. -10) we choose to bring it into the basis. 4. Solve constraints for Basic Variables The constraint equations become: 5. Apply Minimum Ratio Rule to find “departing variable” [variable forced out of basis] Solve each of the constraints for its basic variable. Leave entering variable as a variable, substitute 0 for other non-basic variables, expressions from other equations for basic variables y3 = 0.05 - 0.2(0) - 30y2 = 0.05 - 30y2 y4 = 0.07 - 1.5(0) - 35y2 = 0.07 - 35y2 Divide the negative of the coefficient of the variable chosen in step 3 into the constant term in each step 4 equations and use the minimum positive quotient to find the variable to remove from the basis. [If all quotients are negative, stop - the function is not bounded below on the feasible region.] The ratios are 0.05/30 and 0.07/35. (If we increase y2 to .05/30, we will push y3 down to 0. Any increase beyond that will make y3 negative -which would give an infeasible solution. Similarly, the second ratio tells us that if we push y2 beyond .07/35 we will make y4 negative - Here is our "all variables nonnegative" requirement working to make sure we get feasible basic solutions ) The smallest of these is 0.05/30, the ratio from the first equation, and y3 is the basic variable in this equation [the one that is pushed down to 0 by this increase in y2.] Thus y3 is the first variable forced out of the basis by increasing values of y2 and is the "departing variable". If all the ratios were negative, there would be no lower bound on the values of the objective because increasing y2 (which decreases the objective) would not force any variable out of the basis – there would be no bound on values of y2 . 6. Write new Basis Matrix Replace the column (of B) corresponding to the departing variable with the column of A corresponding to the entering variable to form a new basis matrix. Reduce to find its BFS 30 0 The new basis matrix is (column from y2 in place of column from y3). Augmenting this matrix and reducing it to Row 35 1 Echelon Form we obtain the following basic feasible solution. 30 0 0.05 1 0 0. 00167 1 0 0. 00167 35 1 0. 07 35 1 [First value is for y2 - because it matches the 1 in the y2 column, 0.07 0 1 0.01155 second is for y4. [Notice the value for y2 is .00167 - that is, .05/30, - the value which forced y3 to become 0, as predicted in our minimum ratio rule]. The basic feasible solution is [ 0 0.00167 0 0.01155] T 7. Repeat Steps 3-6 Check objective function to find another variable to bring into the basis and repeat process. When there are no more variables that can be increased you are finished. The final basic feasible solution is optimal. Since the coefficient of y1 is also negative in the objective function, we should try to bring it into the basis. The constraint equations become: y2 = -0.0067y1 + 0.00167 y4 = -1.5y1 - 35(-0.0067y1 + 0.00167) + 0.07 = -1.266 y1 +.01155 Note that we substitute the expression for the basic variable y2 in the second equation so everything is expressed in terms of y1 . The ratios are: 0.00167/0.0067 (about .249) for y2 and .01155/1.266 (about .091) for y4 The second ratio is smaller, so y4 will be forced out of the basis by the increase in y1 . 30 0.2 ( Columns for y2 and then y1 - the y1 column replaces the y4 column in the previous basis The new basis matrix is . 35 1.5 matrix.) Augmenting this matrix and reducing it to Row Echelon Form we obtain the following basic feasible solution. 30 35 1 0 0.0016 0.2 0.05 . (y2 = .0016, y1 = .0092) The basic feasible solution is [ 0.092 0.0016 0 0] T. 1.5 0.07 0 1 0.0092 [As predicted, y1 ends up at about .091 (difference is from rounding) when y4 is forced to 0.] Since there are no more variables with negative coefficients in the objective function we are finished. Compare this solution to the one we obtained in Activity 9 Model 1. Our objective (which is being minimized) ends up at -1.4. For our original problem, we say the optimal solution is y1 = .092, y2= .0016 for maximum value 1.40 DISCUSSION: Step 1. Put in Standard Form In order to solve a problem algebraically we must replace the constraint inequalities by equalities so that we can readily find and represent the extreme points of the feasible region. This is what is done by converting the problem to standard form. Doing this increases the number of variables, but not the dimension of the feasible region, and there is a 1-1 correspondence between the extreme points of the original feasible region and those of the new feasible region. Step 2. Find Identity Basis To get started, we need a basic feasible solution. If every row of the matix has a pivot element (1 with 0’s above & below) we can use the corresponding columns for a basis. Since the right-hand sides of the constraints are non-negative, we are assured that this basic solution is feasible, so it will serve as an initial basic feasible solution. If the coefficient matrix has no (possibly scrambled) Identity submatrix, we cannot find this initial basis matrix and other solution methods must be found. Step 3. Choose ”entering variable ” Our goal is to minimize the objective function, so we try to increase variables which have negative coefficients. Note: we will be increasing a non-basic varable – so it starts with value 0. The variable with the most negative coefficient (in the objective) is usually chosen because increasing its value will decrease the objective function the fastest. Step 4. Solve constraints for Basic Variables. This step matches the work done in reading the solutions to a system from the reduced form of the augmented matrix. We represent each variable in the existing (about-to-be-changed) basis in terms of the entering variable and the current values of the other variables, so that we can see how the change in value (this “entering’ variable will become larger) forces the existing basic variables to change – in particular, we want to see at what stage the basic variable will be decreased to 0 (and pushed out of the basis). Step 5. Apply Minimum Ratio Rule to find “departing variable” In each equation, the ratio (constant term/negative of coefficient) tells us how much we can increase the value of the entering variable before making the left-side variable negative. Each of these ratios gives a limit on how much we can increase the entering variable without leaving the feasible region - so we must take the smallest of the ratios. The variable on the left of the corresponding equation is the one that will be forced to 0 (and become non-basic) - so it is the "departing variable". If the ratios are all negative, that says that no constraint limits the increase in value of the entering variable - since the entering variable is chosen to decrease the objective (linearly) this situation corresponds to the objective being unbounded - so there is no minimum solution. Step 6. Write the New Basis Matrix and reduce to find BFS We form a new Basis matrix by replacing the column (from A) corresponding to the departing variable with the column corresponding to the entering variable. Augmenting this matrix and reducing gives us the values of the basic variables in our new BFS. We have to remember (write labels above the columns) which variable is represented by which column so that we can write the resulting basic feasible solution. [correct values in correct place, 0’s for non-basics] Step 7. Repeat Steps 3 - 6 This new basic feasible solution represents an extreme point in the feasible region with an improved (decreased) value for the objective, but it is not usually the optimal solution. If other nonbasic variables have negative coefficients in the objective function, we should bring one of these into the basis. The procedure we used above should be repeated until all possible variables with negative objective function coefficients are in the basis [We may not be able to use all variables with negative coefficients - if the basis size is not large enough, for example - but we will get the most effective set - the set that makes the objective as small as possible with the constraints.] MODEL 2: minimize subject to x1 – 3x2 – 2x3 3x1 + x2 ≤ 8 x1 + 2x2 + 3x3 ≤ 7 x1 + 2x3 ≤ 5 x1 ≥ 0, x2 ≥ 0, x3 ≥ 0 1 C = -3 -2 x1 3 1 0 8 1 2 3 A= , X = x2 , b = 7 1 0 2 5 x3 Put in Standard Form x1 – 3x2 – 2x3 Note that the matrix forms for the standard form are given 2x1 + x2 + x4 = 8 below, and these are used throughout the solution process x1 + 2x2 + 3x3 + x5 =7 x1 + 2x3 + x6 = 5 x1 ≥ 0, x2 ≥ 0, x3 ≥ 0, x4 ≥ 0 x1 1 x2 -3 3 1 0 1 0 0 x3 1 0 0 -2 ^ ^ ^ Initial B = 0 1 0 A= 1 2 3 0 1 0 X= x C= 0 4 0 0 1 1 0 2 0 0 1 0 x5 0 x6 minimize subject to Find Identity Basis The basic variables are x4, x5 and x6 since the Identity submatrix of the coefficient matrix corresponds to these variables. The nonbasic variables are x1, x2 and x3. The initial basic feasible solution is [0 0 0 8 7 5] T. The objective function value is 0 for this solution. Choose “entering variable” The coefficient of x2 is the most negative, so we will try to bring x2 into the basis. Solve constraints for Basic Variables [in terms of x2] x4 = 8 – 2x1 - x2 = 8 – x2 x5 = 7 - x1 – 2x2 – 3x3 = 7 - 2x2 x6 = 5 - x1 – 2x3 = 5 Because x1 and x3 are nonbasic (so have value 0) , the x1 and x3 terms do not enter into the computation when we attempt to increase x2. Apply Minimum Ratio Rule to find the “departing variable” We see that x2 can get no bigger than 3,5 without making one of the variables (x5) negative. The ratios are 8/1 and 7/2; The minimum ratio 7/2 = 3.5 implies that increasing x2 as much as possible will make x5 nonbasic before x4 is pushed down to 0 (x5 will become 0 when x1 reaches 3.5, x4 wouldn’t become 0 until reached 8 ) Write the New Basis Matrix 1 1 0 0 2 0 (uses x4, x2, x6 –in that order) because the x2 is replacing x5. 0 0 1 1 1 0 8 1 0 0 4.5 Reducing the augmented matrix 0 2 0 7 to 0 1 0 3.5 we get the new basic feasible solution [0 3.5 0 4.5 0 5] T with 0 0 1 5 0 0 1 5 Thus the next B matrix becomes an objective function value –10.5. Repeat Steps 3 - 6 It would appear that we might further decrease the value of z by increasing the value of . to determine whether this is trur, we represent z in terms of the non-basic variables by solving the constraint equations for the basic variables in terms the nonbasic variables and substituting in to the expression for z: x4 = 8 - 2x1 - x2 = 8 – 2x1 – (3.5 – 1.5 x1 – 1.5x3 – .5 x5 ) = 4.5 + 1.5x3 x2 = 3.5 – .5x1 – 1.5 x3 – .5x5 x6 = 5 – x1 – 2x3 = 5 –2x3 - 0 so z = x1 – 3x2 – 2x3 = x1 – 3(3.5 – .5x1 – 1.5 x3 – .5x5) – 2x3 = – 10.5 +2.5x1 + 1.5 x3 + 1.5x5. Increasing any of the non-basic variables will increase the value of z, so we are at the optimal solution. Our optimal solution is x1 = x3 = 0, x2 = 3.5 and the optimal value is z = –10.5 SKILL EXERCISE: 1. ^ ^ Take the problem below and write the values of C, A, b, X, A , X , so that the problem becomes: ^ ^ Minimize CT X where AX b or A X = b Plot the feasible region. Also find the initial basis matrix B, identify the basic and nonbasic variables associated with B and write the initial basic feasible solution. minimize x1 - 2x2 subject to x1 + 5x2 ≤ 5 2x1 + x2 ≤ 4 x1 ≥ 0, x2 ≥ 0 2. Determine which of the nonbasic variables should become basic and which of the basic variables should become nonbasic using the minimum ratio rule. 3. Find the next basis matrix and identify the basic feasible solution associated with it. 4. Repeat steps 2 and 3 until an optimal solution is reached. CRITICAL THINKING QUESTIONS: 1. ^ How many basis matrices are possible in Model 2? How many extreme points will the feasible region F have? How many potential basis matrices will yield feasible solutions? 2. What criteria do you use to determine which of the nonbasic variables will become basic? 3. What criteria do you use to determine which of the current basic variables will become nonbasic? 4. How do you know you have reached an optimal solution to the problem? 5. Which was the most difficult step in the methodology to understand? Can you reword it and its discussion to make it clearer?