1、Chapter 4 The Simplex Algorithm and Goal Programming,to accompany Operations Research: Applications and Algorithms 4th edition by Wayne L. Winston,Copyright (c) 2004 Brooks/Cole, a division of Thomson Learning, Inc.,4.1 How to Convert an LP to Standard Form,Before the simplex algorithm can be used t
2、o 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.,Example 1: Leather Limited,Leather Limited manufactures two types of leather belts: the deluxe model and the regular mo
3、del. Each type requires 1 square yard of leather. A regular belt requires 1 hour of skilled labor and a deluxe belt requires 2 hours of skilled labor. Each week, 40 square yards of leather and 60 hours of skilled labor are available. Each regular belt contributes $3 profit and each deluxe belt $4. W
4、rite an LP to maximize profit.,Example 1: Solution,The decision variables are: x1 = number of deluxe belts produced weekly x2 = number of regular belts produced weekly The appropriate LP is:max z = 4x1 + 3x2 s.t. x1 + x2 40 (leather constraint)2x1 +x2 60 (labor constraint)x1, x2 0,To convert a const
5、raint to an equality, define for each constraint a slack variable si (si = slack variable for the ith constraint). A slack variable is the amount of the resource unused in the ith constraint. If a constraint i of an LP is a constraint, convert it to an equality constraint by adding a slack variable
6、si to the ith constraint and adding the sign restriction si 0.,To convert the ith constraint to an equality constraint, define an excess variable (sometimes called a surplus variable) ei (ei will always be the excess variable for the ith constraint. We define ei to be the amount by which ith constra
7、int is over satisfied. Subtracting the excess variable ei from the ith constraint and adding the sign restriction ei 0 will convert the constraint. If an LP has both and constraints, apply the previous procedures to the individual constraints.,4.2 Preview of the Simplex Algorithm,Consider a system A
8、x = b of m linear equations in n variables (where n m). A basic solution to Ax = b is obtained by setting n m variables equal to 0 and solving for the remaining m variables. This assumes that setting the n m variables equal to 0 yields a unique value for the remaining m variables, or equivalently, t
9、he columns for the remaining m variables are linearly independent. Any basic solution in which all variables are nonnegative is called a basic feasible solution (or bfs).,The following theorem explains why the concept of a basic feasible solution is of great importance in linear programming. Theorem
10、 1 The feasible region for any linear programming problem is a convex set. Also, if an LP has an optimal solution, there must be an extreme point of the feasible region that is optimal.,4.3 Direction of Unboundedness,Consider an LP in standard form with feasible region S and constraints Ax=b and x 0
11、. Assuming that our LP has n variables, 0 represents an n-dimensional column vector consisting of all 0s. A non-zero vector d is a direction of unboundedness if for all xS and any c0, x +cdS,Theorem 2 Consider an LP in standard form, having bfs b1, b2,bk. Any point x in the LPs feasible region may b
12、e written in the form where d is 0 or a direction of unboundedness and =1 and i 0. Any feasible x may be written as a convex combination of the LPs bfs.,4.4 Why Does LP Have an Optimal bfs?,Theorem 3 If an LP has an optimal solution, then it has an optimal bfs. For any LP with m constraints, two bas
13、ic feasible solutions are said to be adjacent if their sets of basic variables have m 1 basic variables in common. The set of points satisfying a linear inequality in three (or any number of) dimensions is a half-space. The intersection of half-space is called a polyhedron.,4.5 The Simplex Algorithm
14、,The simplex algorithm can be used to solve LPs in which the goal is to maximize the objective function. Step 1 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, deter
15、mine which nonbasic variable should become 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 EROs to find a new bfs with a better objective function value. Go back to Step 3.,Example 2: Dakota Furniture Compan
16、y,The Dakota Furniture company manufactures desk, tables, and chairs. The manufacture of each type of furniture requires lumber and two types of skilled labor: finishing and carpentry. The amount of each resource needed to make each type of furniture is given in the table below.,Ex. 2 - continued,At
17、 present, 48 board feet of lumber, 20 finishing hours, 8 carpentry hours are available. A desk sells for $60, a table for $30, and a chair for $ 20. Dakota believes that demand for desks and chairs is unlimited, but at most 5 tables can be sold. Since the available resources have already been purcha
18、sed, Dakota wants to maximize total revenue.,Example 2: Solution,Define: x1 = number of desks produced x2 = number of tables produced x3 = number of chairs produced The LP is: max z = 60x1 + 30x2 + 20x3s.t. 8x1 + 6x2 + x3 48 (lumber constraint)4x1 + 2x2 + 1.5x3 20 (finishing constraint)2x1 + 1.5x2 +
19、 0.5x3 8 (carpentry constraint)x2 5 (table demand constraint)x1, x2, x3 0,Ex. 2: Solution continued,Begin the simplex algorithm by converting the constraints of the LP to the standard form. Then convert the LPs objective function to the row 0 format. To put the constraints in standard form, simply a
20、dd slack variables s1, s2, s3, s4, respectively to the four constraints. Label the constraints row 1, row 2, row 3, row 4, and add the sign restrictions si 0.,Ex. 2: Solution continued,Putting rows 1-4 together in row 0 and the sign restrictions yields these equations and basic variables.,Ex. 2: Sol
21、ution continued,To perform the simplex algorithm, we need a basic (although not necessarily nonnegative) variable for row 0. Since z appears in row 0 with a coefficient of 1, and z does not appear in any other row, we use z as the basic variable. With this convention, the basic feasible solution for
22、 our initial canonical form has BV = z, s1, s2, s3, s4 NBV = x1, x2, x3. For this initial bfs, z=0, s1=48, s2= 20, s3=8, s4=5, x1=x2=x3=0. A slack variable can be used as a basic variable if the rhs of the constraint is nonnegative.,Ex. 2: Solution continued,Once we have obtained a bfs, we need to d
23、etermine whether it is optimal. To do this, we try to determine if there is any way z can be increased by increasing some nonbasic variable from its current value of zero while holding all other nonbasic variables at their current values of zero. Solving for z in row 0 yields: Z = 60x1 + 30x2 + 20x3
24、,Ex. 2: Solution continued,For each nonbasic variable, we can use this equation to determine if increasing a nonbasic variable will increase z. Increasing any of the nonbasic variables will cause an increase in z. However increasing x1 causes the greatest rate of increase in z. If x1 increases from
25、its current value of zero, it will have to become a basic variable. For this reason, x1 is called the entering variable. Observe x1 has the most negative coefficient in row 0.,Ex. 2: Solution continued,Next choose the entering variable to be the nonbasic variable with the most negative coefficient i
26、n row 0. Goal is to make x1 as large as possible but as it increases, the current basic variables will change value. Thus, increasing x1 may cause a basic variable to become negative. This means to keep all the basic variables nonnegative, the largest we can make x1 is min 6, 5, 4 = 4.,Ex. 2: Soluti
27、on continued,Rule for determining how large an entering variable can be. When entering a variable into the basis, compute the ratio 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 small
28、est ratio is the largest value of the entering variable that will keep all the current basic variables nonnegative.,Ex. 2: Solution continued,Always make the entering variable a basic variable in a row that wins the ratio test. To make x1 a basic variable in row 3, we use elementary row operations (
29、EROs) to make x1 have a coefficient of 1 in row 3 and a coefficient of 0 in all other rows. This procedure is called pivoting on row 3; and row 3 is called the pivot row. The final result is that x1 replaces s3 as the basic variable for row 3. The term in the pivot row that involves the entering bas
30、ic variable is called the pivot term.,Ex. 2: Solution continued,The result isThe procedure used to go from one bfs to a better adjacent bfs is called an iteration of the simplex algorithm.,Ex. 2: Solution continued,Attempt to determine if the current bfs is optimal. Rearranging row 0 from Canonical
31、Form 1, and solving for z yields z = 240 15x2 +5x3 -30s3 The current bfs is NOT optimal because increasing x3 to 1 (while holding the other nonbasic variable to zero) will increase the value of z. Making either x2 or s3 basic will cause the value of z to decrease.,Ex. 2: Solution continued,Recall th
32、e rule for determining the entering variable is the row 0 coefficient with the greatest negative value. Since x3 is the only variable with a negative coefficient, x3 should be entered into the basis. Performing the ratio test using x3 as the entering variable yields the following results (holding ot
33、her NBVs to zero): From row 1, s1 0 for all values of x3 since s1 = 16 + x3 From row 2, s2 0 if x3 4 / 0.5 = 8 From row 3, x1 0 if x3 4 / 0.25 = 16 From row 4, s4 0 for all values of x3 since s4 = 5,Ex. 2: Solution continued,This means to keep all the basic variables nonnegative, the largest we can
34、make x1 is min 8,16 = 8. So, row 2 becomes the pivot row. The result of using EROs, to make x3 a basic variable in row 2.,Ex. 2: Solution continued,In Canonical Form 2 BV = z, s1, x3, x1, s4 NBV = s3, s2, x2 Yielding the bfs z = 280, s1=24, x3=8, x1=2, s4=5, s2=s3=x2=0 Solving for z in row 0 yields
35、z = 280 - 5x2 - 10s2 -10s3 We can see that increasing x2, s2, or s3 (while holding the other NBVs to zero) will not cause the value of z to increase.,Ex. 2: Solution continued,The solution at the end of iteration 2 is therefore optimal. The following rule can be applied to determine whether a canoni
36、cal forms bfs is optimal. A canonical form is optimal (for a max problem) if each nonbasic variable has a nonnegative coefficient in the canonical forms row 0.,4.6 Using the Simplex Algorithm to solve Minimization Problems,Two different ways the simplex method can be used to solve minimization probl
37、ems. Method 1 - Consider this LPThe optimal solution is the point (x1,x2) that makes z = 2x1 3x2 the smallest. Equivalently, this point makes max -z = - 2x1 + 3x2 the largest.,min z = 2x1 3x2 s.t. x1 + x2 4x1 x2 6x1, x2 0,This means we can find the optimal solution to the LP by solving this modified
38、 LP.In solving this modified LP, use z as the basic variable in row 0. After adding slack variables, s1 and s2 to the constraints the initial tableau s obtained.,max -z = -2x1 + 3x2 s.t. x1 + x2 4x1 x2 6x1, x2 0,The optimal solution (to the max problem) is -z = 12, x2=4, s2=10, x1=s2=0. Then the opt
39、imal solution to the min problem is z = -12, x2=4, s2 = 10, x1=s2=0. The min LP objective function confirms this: z =2x1-3x2=2(0)3(4)= -12.,In summary, multiply the objective function for the min problem by -1 and solve the problem as a maximization problem with the objective function z. The optimal
40、 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).,Method 2 - A simple modification of the simplex algorithm can be used to solve min problems directly. Modify step 3 o
41、f the simplex algorithm If all nonbasic variables (NBV) in row 0 have nonpositive coefficients, the current bfs is optimal. If any nonbasic variable has a positive coefficient, choose the variable with the “most positive” coefficient in row 0 as the entering variable. This modification of the simple
42、x algorithm works because increasing a nonbasic variable (NBV) with a positive coefficient in row 0 will decrease z.,4.7 Alternate Optimal Solutions,For some LPs, more than one extreme point is optimal. If an LP has more than one optimal solution, it has multiple optimal solutions or alternative opt
43、imal solutions. If there is no nonbasic variable (NBV) with a zero coefficient in row 0 of the optimal tableau, the LP has a unique optimal solution.Even if there is a nonbasic variable with a zero coefficient in row 0 of the optimal tableau, it is possible that the LP may not have alternative optim
44、al solutions.,4.8 Unbounded LPs,For some LPs, there exist points in the feasible region for which z assumes arbitrarily large (in max problems) or arbitrarily small (in min problems) values. When this occurs, we say the LP is unbounded. An unbounded LP occurs in a max problem if there is a nonbasic
45、variable with a negative coefficient in row 0 and there is no constraint that limits how large we can make this NBV. Specifically, an unbounded LP for a max problem occurs when a variable with a negative coefficient in row 0 has a non positive coefficient in each constraint.,4.14 Unrestricted-in-Sig
46、n Variables,If some variables are allowed to be unrestricted in sign (urs), the ratio test and therefore the simplex algorithm are no longer valid. An LP with an unrestricted-in-sign variable can be transformed into an LP in which all variables are required to be non-negative. For each urs variable,
47、 define two new variables xi and xni. Then substitute xi - xni for xi in each constraint and in the objective function. Also add the sign restrictions.,The effect of this substitution is to express xi as the difference of the two nonnegative variables xi and xni. No basic feasible solution can have
48、both xi 0 and xni 0. For any basic feasible solution, each urs variable xi must fall into one of the following three cases. xi 0 and xni = 0 xi = 0 and xni 0 xi = xni = 0,4.15 Karmarkars Method for Solving LPs,Karmarkars method requires that the LP be placed in the following form and that The point
49、be feasible for this LP. The optimal z-value for the LP equals 0. Karmarkars method has been shown to be a polynomial time algorithm. This implies that if an LP of size n is solved by Karmarkars method, then there exist positive numbers a and b such that for any n can be solved in a time of at most anb.,min z = cx s.t. Kx = 0x1 + x2+ xn = 1xi 0,4.16 Multiattribute Decision Making in the Absence of Uncertainty: Goal Programming,