Presentation is loading. Please wait.

Presentation is loading. Please wait.

The Simplex Algorithm The Simplex Algorithm LI Xiao-lei.

Similar presentations


Presentation on theme: "The Simplex Algorithm The Simplex Algorithm LI Xiao-lei."— Presentation transcript:

1 The Simplex Algorithm The Simplex Algorithm LI Xiao-lei

2 preface The two-variable LP program can be solved graphically. Most real-life LPs have many variables. In many industrial applications, the simplex algorithm is used to solve LPs with thousands of constraints and variables.

3 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 an equivalent problem in which all constraints are equations and all variables are nonnegative. An LP in this form is said to be in standard form.

4 EXAMPLE 1 Leather limited manufactures two types of belts: the deluxe model and the regular model. Each type requires 1 sq yd of leather. A regular belt requires 1 hour of skilled labor, and a deluxe belt requires 2 hours. Each week, 40 sq yd of leather and 60 hours of skilled labor are available. Each regular belt contributes $3 to profit and each deluxe belt, $4.

5 EXAMPLE 1 Define, X1=number of deluxe belts produced weekly X2=number of regular belts produced weekly The LP is, Max z=4x 1 +3x 2 (LP1) s.t. x 1 + x 2 ≤40 (Leather constraint) 2x 1 + x 2 ≤60 (Labor constraint) x 1,x 2 ≥0

6 Convert inequality constraints to equality constraints Define for each ≤ constraint a slack variable s i (s i =slack variable for ith constraint). We define, s 1 =40- x 1 -x 2 or x 1 + x 2 + s 1 =40 s 2 =60-2x 1 -x 2 or 2x 1 + x 2 + s 2 =60 Note: a point satisfies the ith constraint if and only if si≥0.

7 LP1 in standard form Max z=4x 1 +3x 2 (LP1 ’ ) s.t. x 1 + x 2 +S 1 =40 2x 1 + x 2 +S 2 = 60 x 1,x 2,S 1,S 2 ≥0 Note: if constraint i of an LP is a ≤ constraint, we convert it to an equality constraint by adding a slack variable s i to the ith constraint and adding the sign restriction s i ≥0.

8 Similarly, to convert the ith ≥ constraint to an equality constraint, we define an excess variable (some times called a surplus variable) e i. Note: if the ith constraint of an LP is a ≥ constraint, it can be converted to an equality constraint by subtracting an excess variable e i from the ith constraint and adding the sign restriction e i ≥0.

9 example Original LP, max z=20x 1 + 15x 2 s.t. x 1 ≤100 x 2 ≤100 50x 1 + 35x 2 ≤6000 20x 1 + 15x 2 ≥2000 x 1,x 2 ≥0

10 example Standard form LP, max z=20x 1 + 15x 2 s.t. x 1 + s 1 =100 x 2 +s 2 =100 50x 1 + 35x 2 +s 3 =6000 20x 1 + 15x 2 -e 4 =2000 x i ≥0(i=1,2); s 3 ≥0(i=1,2,3); e 4 ≥0

11 Preview of the simplex algorithm Suppose an LP with m constraints in standard form, max z= c 1 x 1 + c 2 x 2 + … + c n x n (1) s.t. a 11 x 1 +a 12 x 2 + … +a 1n x n =b 1 a 21 x 1 +a 22 x 2 + … +a 2n x n =b 2 … … a m1 x 1 +a m2 x 2 + … +a mn x n =b m x i ≥0(i=1,2, …,n)

12 We define, The constraints may be written as the system of equations Ax=b

13 Basic and nonbasic variables Consider a system Ax=b of m linear equations in n variables (assume n≥m) DEFINATION A basic solution to Ax=b is obtained by setting n- m variables equal to 0 and solving for the values of the remaining m variables. This assumes that setting the n-m variables equal to 0 yields unique values for the remaining m variables or, equivalently, the columns for the remaining m variables are linearly independent.

14 To find a basic solution to Ax=b, we choose a set of n-m variables (the nonbasic variables, or NBV) and set each of these variables equal to 0. Then solve for the values of the remaining n-(n-m)=m variables (the basic variables, or BV) that satisfy Ax=b. Basic and nonbasic variables

15 The different choices of nonbasic variables will lead to different basic solutions. To illustrate, x 1 +x 2 =3 -x 2 +x 3 =-1 We begin by choosing a set of 3-2=1 nonbasic variables. If NBV={x 3 } then BV={x 1,x 2 }. We find that x 1 =2, x2=1, by setting x 3 =0. If NBV={x 2 } then we get x 1 =3, x2=0, x 3 =-1.

16 Basic and nonbasic variables Some sets of m variables do not yield a basic solution. For example, x 1 +2x 2 +x 3 =1 2x 1 +4x 2 +x 3 =3 If we choose NBV={x 3 }, then x 1 +2x 2 =1 2x 1 +4x 2 =3 The system has no solution, there is no basic solution to BV={x 1,x 2 }

17 Feasible solutions DEFINATION Any basic solution to (1) in which all variables are nonnegative is a basic feasible solution(or bfs). THEOREM 1 The feasible region for any linear programming problem is a convex set. Also, if an LP has an optimal solution, there must be an extreme point of the feasible region that is optimal. THEOREM 2 For any LP, there is a unique extreme point of the LP ’ s feasible region corresponding to each basic feasible solution. Also, there is at least one bfs corresponding to each extreme point of the feasible region.

18 Feasible solutions Illustration of Leather Limited example, Max z=4x 1 +3x 2 (LP1 ’ ) s.t. x 1 + x 2 +S 1 =40 2x 1 + x 2 +S 2 = 60 x 1,x 2,S 1,S 2 ≥0

19 Basic variables Nonbasic variables Basic feasible solution Corresponds to corner point x1,x2 s1,s2 s1=s2=0, x1=x2=20E x1,s1 x2,s2 x2=s2=0,x1=30,s1=10C x1,s2 x2,s1 x2=s1=0,x1=40,s2=-20Not a bfs x2,s1 x1,s2 x1=s2=0,s1=-20,x2=60Not a bfs x2,s2 x1,s1 x1=s1=0,x2=40,s2=20B s1,s2 x1,x2 x1=x2=0,s1=40,s2=60F

20 Adjacent basic feasible solutions DEFINATION For any LP with m constraints, two basic feasible solutions are said to be adjacent if their sets of basic variables have m-1 basic variables in common.

21 How the simplex algorithm solves LPs in a max problem Step1 find a bfs to the LP. We call this bfs the initial basic feasible solution. 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. Step2 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. Step3 Return to step2, using the new bfs as the current bfs.

22 How the simplex algorithm solves LPs in a max problem If an LP in standard form has m constraints and n variables, there may be a basic solution for each choice of nonbasic variables. From n variables, a set of n-m nonbasic variables can be chosen in Different ways.

23 How the simplex algorithm solves LPs in a max problem Thus, an LP can have at most basic solutions. If we were proceed from the current bfs to a better bfs, we would surely find the optimal bfs after a finite number of calculations.

24 The Simplex Algorithm Step1 convert the LP to standard form. Step2 obtain a bfs (if possible) from the standard form. Step3 determine whether the current bfs is optimal. Step4 if the current bfs is not optimal, determine which nonbasic variable should become a basic variable and which basic variable should become a nonbasic variable to find a new bfs with a better objective function value. Step5 use ero(elementary row operation) ’ s to find the new bfs with the better objective function value. Go back to step3.

25 example 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. ResourceDeskTableChair Lumber8 board ft6 board ft1 board ft Finishing hours4 hours2 hours1.5hours Carpentry hours2 hours1.5hours0.5 hour 48 board feet of lumber, 20 finishing hours, and 8 carpentry hours are available. A desk sells for $60, a table for $30, and a chair for $20. demand for desks and chairs is unlimited, but at most five table can be sold. Dakota wants to maximize total revenue.

26 example Defining the decision variable as x 1 =number of desks produced x 2 =number of tables produced x 3 =number of chairs produced Dakota is the following LP: max z=60x 1 +30x 2 + 20x 3 s.t. 8x 1 + 6x 2 + x 3 ≤48 (lumber constraint) 4x 1 + 2x 2 +1.5x 3 ≤20 (finishing constraint) 2x 1 +1.5x 2 +0.5x 3 ≤8 (carpentry constraint) x 2 ≤5 (limitation on table demand) x 1,x 2,x 3 ≥0

27 example Convert the LP to standard form max z=60x 1 +30x 2 + 20x 3 s.t. 8x 1 + 6x 2 + x 3 +s 1 =48 4x 1 + 2x 2 +1.5x 3 +s 2 =20 2x 1 +1.5x 2 +0.5x 3 +s 3 =8 x 2 +s 4 =5 x 1,x 2,x 3, s 1, s 2, s 3, s 4 ≥0 Note: the row 0 for the objective function is z -60x 1 -30x 2 -20x 3 =0

28 example Putting rows 1-4 together with row 0 and the sign restrictions yields the equations and basic variables. Canonical form 0 Basic variable Row 0z -60x 1 -30x 2 -20x 3 =0 z=0 Row 1 8x 1 + 6x 2 + x 3 +s 1 =48 s 1 =48 Row 2 4x 1 + 2x 2 +1.5x 3 +s 2 =20 s 2 =20 Row 32x 1 +1.5x 2 +0.5x 3 +s 3 =8 s 3 =8 Row 4 x 2 +s 4 =5 s 4 =5

29 example The feasible solution for the initial canonical form has BV={s 1,s 2,s 3,s 4 } ={0,48,20,8,5} and NBV={x 1,x 2,x 3 }={0,0,0} The feasible solution, z=0,s 1 =48,s 2 =20,s 3 =8,s 4 =5,x 1 =x 2 =x 3 =0 Note: a slack variable can be used as a basic variable for an equation if the right-hand side of the constraint is nonnegative.

30 example Is the current basic feasible solution optimal? To determine whether there is any way that z can be increased by increasing some nonbasic variables at their current values of zero. Note: from z=60x 1 +30x 2 + 20x 3 we can observe that x 1 has the most negative coefficient in row 0. we call x 1 the entering variable.

31 example Determine the entering variable We choose the entering variable (in a max problem) to be the nonbasic variable with the most negative coefficient in row 0(ties may be broken in an arbitrary fashion). Increasing x 1 may cause a basic variable to become negative.

32 example How to increasing x 1 ( holding x 2 =x 3 =0) ? From row 1 s 1 ≥0 for x 1 ≤48/8=6 From row 2 s 2 ≥0 for x 1 ≤20/4=5 From row 3 s 3 ≥0 for x 1 ≤8/2=4 From row 4 s 4 ≥0 for all values of x 1 Note: to keep all the basic variables nonnegative, the largest that we can make x 1 is min{48/8,20/4,8/2}=4. Also for any row in which the entering variable had a positive coefficient, the row’s basic variable became negative when the entering variable exceeded right-hand side of row coefficient of entering variable in row (10)

33 example How to increasing x 1 ( holding x 2 =x 3 =0) ? The ratio test When entering a variable into the basis, compute the ratio in (10) for every constraint in which the entering variable has a positive coefficient. The constraint with the smallest ratio is called the winner of the ratio test. The smallest ratio is the largest value of the entering variable that will keep all the current basic variables nonnegative.

34 example Find a new basic feasible solution: pivot in the entering variable In which row does the entering variable become basic? Always make the entering variable a basic variable in a row that wins the ratio test. In example, to make x 1 a basic variable in row 3, we use elementary row operations to make x 1 have a coefficient of 1 in row 3 and a coefficient of 0 in all other rows. This procedure is called pivoting on row 3; and row 3 is the pivot row. The final result is that x 1 replaces s 3 as the basic variable for row 3. The term in the pivot row that involves the entering basic variable is called the pivot term.

35 example To make x 1 a basic variable in row 3 by performing the following ero ’ s. ero 1 create a coefficient of 1 for x 1 in row 3 by multiplying row 3 by ½. The resulting row is x 1 +0.75x 2 +0.25x 3 +0.5s 3 =4 (row 3 ’ ) ero 2 to create a zero coefficient for x 1 in row 0, replace row 0 with 60(row 3 ’ ) +row 0. z+15x 2 -5x 3 +30s 3 =240 (row 0 ’ ) ero 3 to create a zero coefficient for x1 in row 1, replace row 1 with -8(row 3 ’ )+row 1. -x 3 +s 1 -4s 3 =16 (row 1 ’ ) ero 4 to create a zero coefficient for x1 in row 2, replace row 2 with -4(row 3 ’ )+row 2. -x 2 +0.5x 3 +s 2 -2s 3 =4 (row 2 ’ )

36 example x 1 does not appear in row 4. we don ’ t need to perform an ero to eliminate x 1 from row 4. Canonical form 1 Basic variable Row 0 ’ z +15x 1 - 5x 3 +30s 3 =240 z=240 Row 1 ’ - x 3 +s 1 - 4s 3 =16 s 1 =16 Row 2 ’ - x 2 + 0.5x 3 +s 2 - 2s 3 =4 s 2 =4 Row 3 ’ x 1 +0.75x 2 +0.25x 3 +0.5s 3 =4 x 1 =4 Row 4 ’ x 2 +s 4 =5 s 4 =5

37 example The feasible solution for the canonical form 1 has BV={z,s 1,s 2,x 1,s 4 } and NBV={s 3,x 2,x 3 } The feasible solution, z=240,s 1 =16,s 2 =4,x 1 =4,s 4 =5,x 2 =x 3 =s 3 =0 In obtaining canonical form 1 from the initial canonical form, we have gone from one bfs to a better (larger z- value) bfs. Note: the initial bfs and the improved bfs are adjacent. The procedure used to go from one bfs to a better adjacent bfs is called an iteration (or sometimes, a pivot) of the simplex algorithm.

38 example Try to find a bfs that has a still larger z-value. Rearranging row 0 ’ to solve for z, z=240-15x 2 +5x 3 -30s 3 Increasing x 2 by 1 will decrease z by 15. Increasing s 3 by 1 will decrease z by 30. Increasing x 3 by 1 will increase z by 5. Thus we choose to enter x 3 into the basis. Note: the rule for determining the entering variable is to choose the variable with the most negative coefficient in the current row 0. since x3 is the only variable with a negative coefficient in row 0 ’, it should be entered into the basis.

39 example To determine how large x 3 can be. –From row 1 ’ : s 1 =16+x 3 all values of x 3 –From row 2 ’ : s 2 =4-0.5x 3 x 3 ≤4/0.5=8 –From row 3 ’ : x 1 =4-0.25x 3 x 3 ≤4/0.25=16 –From row 4 ’ : s 4 =5 all values of x 3 The largest we can make x 3 is min{4/0.5,4/0.25}=8

40 example To determine how large x 3 can be. Also can be discovered by using (10) and the ratio test: Row 1 ’ : no ratio (x 3 has negative coefficient in row) Row 2 ’ :4/0.5=8 Row 3 ’ :4/0.25=16 Row 4 ’ :no ratio (x 3 has a nonpositive coefficient in row 4) Thus, the smallest ratio occurs in row 2 ’, and row 2 ’ wins the ratio test.

41 example Use ero ’ s to make x3 a basic variable ero 1 create a coefficient of 1 for x 3 in row 2 ’ by replacing row 2 ’ with 2(row 2 ’ ) -2x 2 +x 3 +2s 2 -4s 3 =8 (row 2 ’’ ) ero 2 to create a zero coefficient for x 3 in row 0 ’, replace row 0 with 5(row 2 ’’ ) +row 0 ’. z+5x 2 +10x 2 +10s 3 =280 (row 0 ’’ ) ero 3 to create a zero coefficient for x 3 in row 1 ’, replace row 1 ’ with row 2 ’’ +row 1 ’. -2x 2 +s 1 +2s2-8s 3 =24 (row 1 ’’ ) ero 4 to create a zero coefficient for x 3 in row 3 ’, replace row 3 ’ with -1/4(row 2 ’’ )+row 3 ’. x 1 +1.25x 2 -0.5s 2 +1.5s 3 =2 (row 3 ’’ )

42 example x 3 already has a zero coefficient in row 4 ’. we don ’ t need to perform an ero to eliminate x 3 from row 4 ’. Canonical form 2 Basic variable Row 0 ’’ z +5x 2 +10s 2 +10s 3 =280 z=280 Row 1 ’’ -2x 2 +s 1 +2s 2 - 8s 3 =24 s 1 =24 Row 2 ’’ -2x 2 +x 3 +2s 2 - 4s 3 =8 x 3 =8 Row 3 ’’ x 1 +1.25x 2 -0.5s 2 +1.5s 3 =4 x 1 =4 Row 4 ’’ x 2 +s 4 =5 s 4 =5

43 example From canonical form 2, we find BV={z,s 1,x 3,x 1,s 4 } and NBV={s 2,s 3,x 2 } It yields the following bfs: z=280,s 1 =24,x 3 =8,x 1 =2,s 4 =5,s 2 =s 3 =x 2 =0 Since the bfs ’ s for canonical forms 1 and 2 have 4-1=3 basic variables in common (s 1,s 4,x 1 ), they are adjacent basic feasible solutions. Now the second iteration (or pivot) has been completed.

44 example If we rearrange row 0 ’’ and solve for z, we obtain z=280-5x 2 -10s 2 -10s 3 We see that increasing any nonbasic variable will cause z to decrease. this might lead us to believe that our current bfs is an optimal solution. Is a canonical form optimal(max problem)? A canonical form is optimal( for a max problem) if each nonbasic variable has a nonnegative coefficient in the canonocal form ’ s row 0.

45 Summary of the simplex algorithm for a max problem Step 1 convert the LP to standard form. Step 2 find a basic feasible solution. Step 3 if all nonbasic variables have nonnegative coefficients in row 0, the current bfs is optimal. If any variables in row 0 have negative coefficients, choose the variable with the most negative coefficient in row 0 to enter the basis. We call this variable the entering variable.

46 Summary of the simplex algorithm for a max problem Step4 use ero ’ s to make the entering variable the basic variable in any row that wins the ratio test. After the ero ’ s have been used to create a new canonical form, return to step 3, using the current canonical form.

47 Representing simplex tableaus Rather than writing each variable in every constraint, we often used a shorthand display called a simplex tableau. For example, z+3x 1 +x 2 =6 x 1 +s 1 =4 2x 1 +x 2 +s 2 =3 z x 1 x2x2 s1s1 s2s2 rhs Basic variable 131006Z=6 010104S 1 =4 021013S 2 =3

48 Representing simplex tableaus This format makes it very easy to spot basic variable: Just look for columns having a single entry of 1 and all other entries equal to 0 (s 1 and s 2 ). In our use of simplex tableaus, we will encircle the pivot term and denote the winner of the ratio test by *.

49 Using the simplex algorithm to solve minimization problems There are two different ways that the simplex algorithm can be used to solve minimization problems. We illustrate these methods by solving the following LP: min z=2x 1 -3x 2 s.t. x 1 + x 2 ≤4 x 1 - x 2 ≤6 (LP2) x 1,x 2 ≥0

50 Method 1 We can find the optimal solution to LP 2 by solving LP 2 ’ : max -z=-2x 1 +3x 2 s.t. x 1 + x 2 ≤4 x 1 - x 2 ≤6 (LP2 ’ ) x 1,x 2 ≥0 Initial tableau: The ratio test indicates that x2 should enter the basis in row 1. -z x 1 x2x2 s1s1 s2s2 rhs Basic variable ratio 12-3000-z=0 01 ① 104S 1 =44/1=4* 01016S 2 =6None

51 Method 1 Thus, the optimal solution to LP 2 ’ is -z=12,x 2 =4,s 2 =10,x 1 =s 1 =0. then the optimal solution to LP 2 is z=-12,x 2 =4,s 2 =10,x 1 =s 1 =0. -z x 1 x2x2 s1s1 s2s2 rhs Basic variable 1503012-z=12 011104x 2 =4 0201110S 2 =10 Optimal tableau

52 Method 1 In summary, multiply the objective function for the min problem by -1 and solve the problem as a maximization problem with objective function – z. Note: (optimal z-value for min problem) = -(optimal objective function value z for max problem)

53 Method 2 A simplex modification of the ximplex algorithm can be used to solve min problem directly. Modify step3 of the simplex as follows: If all nonbasic variables in row 0 have nonpositive coefficients, the current bfs is optimal. If any nonbasic variable in row 0 has a positive coefficient, choose the variable with the most positive coefficient in row 0 to enter the basis. This modification works because increasing a nonbasic variable with a positive coefficient in row 0 will decrease z.

54 Method 2 To solve LP 2 Z x 1 x2x2 s1s1 s2s2 rhs Basic variable ratio 1-230012z=0 01 ① 104s 1 =44/1=4* 010110S 2 =6none Initial tableau Since x 2 has the most positive coefficient in row 0, we enter x 2 into the basis. the ratio test says that x2 should enter the basis in row 1.

55 Method 2 Optimal tableau: z x 1 x2x2 s1s1 s2s2 rhs Basic variable 1-50-30-12z=-12 011104x 2 =4 0201110S 2 =10 Thus, the optimal solution to LP 2 is z=-12,x 2 =4,s 2 =10,x 1 =s 1 =0.

56 Alternative optimal solutions If an LP has more than one optimal solution, we say that it has multiple or alternative optimal solutions. Reconsider the Dakota furniture example, with the modification that the tables sell for $35 instead of $30.Dakota furniture example

57 Alternative optimal solutions zx1x1 x2x2 x3x3 s1s1 s2s2 s3s3 s4s4 rhs Basic variable ratio 1-60-35-2000000Z=0 0861100048S 1 =4848/8=6 0421.5010020S 2 =2020/4=5 0 ② 1.50.500108S 3 =88/2=4* 001000015S 4 =5None Initial tableau for Dakota furniture($35/table) The ratio test indicates that x1 should be entered in row 3

58 Alternative optimal solutions zx1x1 x2x2 x3x3 s1s1 s2s2 s3s3 s4s4 rhs Basic variable ratio 1010-500300 240 Z=240 00010-4016S 1 =16None 000.501-204S 2 =4 4/0.5=8* 01 0.750.25 000.504x 1 =4 4/0.25=16 001000015S 4 =5None first tableau for Dakota furniture($35/table) The ratio test indicates that x3 should be entered in row 2

59 Alternative optimal solutions zx1x1 x2x2 x3x3 s1s1 s2s2 s3s3 s4s4 rhs Basic variable 1000010 0 280 Z=280 00-2012-8024S 1 =24 00-2102-408x 3 =8 01 1.250 0-0.51.502x 1 =2* 001000015S 4 =5 Second (optimal) tableau for Dakota furniture($35/table) The optimal solution is s 1 =24,x 3 =8 x 1 =2 s 4 =5 x 2 =s 2 =s 3 =0

60 Alternative optimal solutions In the optimal tableau, there is a nonbasic variable, x 2, has a zero coefficient in row 0. What happens if we enter x 2 into the basis?

61 Alternative optimal solutions zx1x1 x2x2 x3x3 s1s1 s2s2 s3s3 s4s4 rhs Basic variable 1000010 0 280 Z=280 01.60011.2-5.60 27.2 S 1 =27.2 01.60101.2-1.60 11.2 x 3 =11.2 00.8 10 0-0.41.201.6x 2 =1.6 0-0.80000.4-1.213.4S 4 =3.4 Another optimal tableau for Dakota furniture($35/table)

62 Alternative optimal solutions Note: because x 2 has a zero coefficient in the optimal tableau ’ s row 0, the pivot that enters x 2 into the basis does not change row 0. All variables in new row 0 still have nonnegative coefficients, thus, the new tableau is also optimal. The pivot has not changed the value of z, an alternative optimal solution is z=280, s 1 =27.2, x 3 =11.2,x 2 =1.6,s 4 =3.4,and x 1 =s 3 =s 2 =0.

63 Alternative optimal solutions Any point on the line segment joining two optimal extreme points will also be optimal.

64 Alternative optimal solutions For 0≤c≤1, all points are optimal.

65 Unbounded LPs There exist points in the feasible region for which z assumes arbitrarily large (in max problems) or arbitrarily small (in min problems) values.

66 Example 3 Breadco Bakeries bakes two kinds of bread: french and sourdough. Each loaf of french bread can be sold for 36¢, and each loaf of sourdough bread for 30¢. A loaf of french bread requires 1 yeast packet and 6 oz of flour; sourdough requires 1 yeast packet and 5 oz of flour.

67 Example 3 At present, Breadco has 5 yeast packets and 10 oz of flour. Additional yeast packets can be purchased at 3¢ each, and additional flour at 4¢/oz. formulate and solve an LP that can be used to maximize Breadco’s profits.

68 Example 3 Solution Define x 1 =number of loaves of french bread baked x 2 =number of loaves of sourdough bread baked x 3 =number of yeast packets purchased x 4 =number of ounces of flour purchased Objective is to maximize z=revenues – costs, where revenues = 36x 1 +30x 2 and costs=3x 3 +4x 4 Thus, objective function is max z=36x 1 +30x 2 -3x 3 -4x 4

69 Example 3 Constraint 1 Number of yeast packages used to bake bread cannot exceed available yeast plus purchased yeast. Available yeast + purchased yeast=5+x 3 Then x 1 +x 2 ≤5+x 3 or x 1 +x 2 -x 3 ≤5

70 Example 3 Constraint 2 Ounces of flour used to bake breads cannot exceed available flour plus purchased flour. Available flour + purchased flour=10+x 4 Then 6x 1 +5x 2 ≤10+x 4 or 6x 1 +5x 2 -x 4 ≤10

71 Example 3 The LP: max z=36x 1 +30x 2 -3x 3 -4x 4 s.t. x 1 + x 2 -x 3 ≤5 (yeast constraint) 6x 1 +5x 2 -x 4 ≤10 (flour constraint) x 1,x 2,x 3,x 4 ≥0 adding slack variables s 1 and s 2 to the two constraints.

72 Example 3 Initial tableau for Breadco: zx1x1 x2x2 x3x3 x4x4 s1s1 s2s2 rhs Basic variable Ratio 1-36-3034000Z=0 0110105S 1 =55/1=5 0 ⑥ 500110x 3 =10 10/6=5/3* The ratio test indicates that x1 should enter the basis in row 2.

73 Example 3 first tableau for Breadco: zx1x1 x2x2 x3x3 x4x4 s1s1 s2s2 rhs Basic variable Ratio 1003-20660Z=60 001/61/61-1/610/3S 1 =10/320* 015/60-1/601/65/3x 1 =5/3 none The ratio test indicates that x4 should enter the basis in row 1.

74 Example 3 second tableau for Breadco: zx1x1 x2x2 x3x3 x4x4 s1s1 s2s2 rhs Basic variable Ratio 102-90124100Z=100 001-61620x 4 =20None 0110105x 1 =5 None The ratio test fails to indicate the row in which x 3 should enter the basis.

75 Example 3 What is happening? Holding the other nonbasic variables at zero, x 4 =20+6x 3 x 1 =5+x 3 as x 3 is increased, both x 4 and x 1 increase, and no matter how large we make x 3, the inequalities x 4 ≥0 and x 1 ≥0 will still be true. Note: an unbounded LP for a max problem occurs when a variable with a negative coefficient in row 0 has a nonpositive coefficient in each constraint.

76 Unbounded LPs If an LP is unbounded, one will eventually come to a tableau where one wants to enter a variable into the basis, but the ratio test will fail. An unbounded LP is usually caused by an incorrect formulation.

77 example In the Breadco example, we allowed Breakco to pay 3+6(4)=27¢ for the ingredients in a loaf of french bread and then sell the loaf for 36¢. Thus, each loaf of french bread earns a profit of 9¢. Since unlimited purchases of yeast and flour are allowed, it is clear that our model allows Breadco to manufacture as much french bread as it desires, thereby, earning arbitrarily large profits.

78 example Our formulation of the Breadco example ignored several aspects of reality. First, we assumed that demand for Breadco ’ s products is unlimited. Second, we ignored the fact that certain resources to make bread are in limited supply. Finally, we made the unrealistic assumption that unlimited quantities of yeast and flour could be purchased.


Download ppt "The Simplex Algorithm The Simplex Algorithm LI Xiao-lei."

Similar presentations


Ads by Google