Presentation is loading. Please wait.

Presentation is loading. Please wait.

Linear Programming SIMPLEX METHOD.

Similar presentations


Presentation on theme: "Linear Programming SIMPLEX METHOD."— Presentation transcript:

1 Linear Programming SIMPLEX METHOD

2 SIMPLEX METHOD Graphical solution is the easiest way to solve a small problem . It can be used effectively to the LP problem with two variables. Most real-life LP problems have more than two variables and thus too large for simple graphical solution procedure. Problems faced in business and government can have hundreds, or even thousands of variables. We need a more powerful method than graphing: “ Simplex method” How does the simplex method works? The concept is similar to graphical LP in one important respect. Graphical method shows that optimal solution is always associated with the corner or extreme point of the solution. LP theory tells “ the optimal solution lies at one of them. In LP problems with several variables , it may not be able to graph the feasible region, but optimal solution will still lie at a corner point of the feasible region. This is the key idea for development of the simplex method.

3 The simplex method examines corner points in a systematic fashion, using basic algebraic concepts.
It does so in iterative manner that is, repeating the same set of procedures time after time until an optimal solution is reached. Each iteration brings a higher value for the objective function that we are always moving closer to the optimal solution. Why should we study the simplex method. It is important to understand the ideas used to produce solutions. The simplex approach yields not only the optimal solution to Xj variables and the maximum profit but valuable economic information as well. To be able to use computers successfully and interpret LP computer printouts, we need to know what the simplex method is doing and why.

4 The Steps for Solving LP Maximization Problems
I. Formulate the LP problem’s objective function and constraints. II. Add slack variables to each less-than-or-equal-to constraint and to the problem’s objective function. III. Develop an initial simplex tableau with slack variables in the basis. Compute the Zj and Cj – Zj values for this tableau IV. Follow these five steps until an optimal solution has been reached: 1. Choose the variable with the greatest positive Cj – Zj to enter the solution. This is the pivot column. 2. Determine the solution mix variable to be replaced and the pivot row by selecting the row with the smallest (nonnegative) ratio of the quantity (rhs)-to-pivot column substitution rate. This row is the pivot row. 3. Calculate the new values for the pivot row. 4. Calculate the new values for the other row(s). 5. Calculate the Zj and Cj – Zj values for this tableau. If there are any Cj – Zj numbers greater than zero, return to step 1. If there are no Cj – Zj numbers greater than or equal to zero, an optimal solution has been reached.

5 Pivot number : The number at the intersection of the pivot row and pivot column.
The new values for the pivot row are computed by dividing every number in the pivot row by the pivot number. New row numbers= numbers in old row- [(number above or below pivot number) x (corresponding number in newly replaced row)]

6 Standard LP Form ( Taha, 1997, p. 68)
-All the constraints (with the exception of the nonnegativity restrictions on the variables) are equations with nonnegative right-hand side -All the variables are nonnegative -The objective function may be of the maximization or the minimization type.

7 How to convert an LP to standard form
-if the constraint i of an LP is a ≤ constraint, we convert it to an equality constraint by adding a slack variable si to the ith constraint and adding the sign restriction si ≥ 0 . For example, instead of 400 x1+ 200x2 ≤ 700 400 x1+ 200x2 + s1 = 700 and s1 ≥ 0 are added to LP. Slack Variable : the amount of the resource unused in the constraint i.

8 if the ith constraint of an LP is a ≥ constraint, then it can be converted to an equality constraint by subtracting an excess variable (a surplus variable) ei from the ith constraint and adding the sign restriction ei ≥ 0. For example, instead of 400 x1+ 200x2+ 150x3+ 500x4 ≥ 500 400 x1+ 200x2+ 150x3+ 500x4 – e1 = 500 and e1 ≥ 0 are added to LP. Surplus Variable : the amount by which the constraint i. is oversatisfied ( the amount of resource usage above the minimum required).

9 if the constraint i of an LP has a negative right hand side element,
the constraint is converted to the constraint with nonnegative right hand side element by multiplying it by (-1) . For example, -2x1+ x2 ≤ -6 is transformed into 2x1- x2 ≥ 6 then, 2x1- x2 - e1= 6 Similarly, 4x1- 2x2 ≥ -26 is transformed into x1+ 2x2 ≤ 26 -4x1+ 2x2 + s1= 6

10 Zmax= 30x1 - 4x2 s.t. 5x1-x2 ≤ 30 x1≤ 5 x1≥ 0 x2 urs
- If xi is unrestricted in sign in an LP -Define two variables xi' and xi" ( xi= xi' -xi" ) -Substitute (xi' -xi") for xi in each constraints and in the objective function. -Add the sign restriction xi' ≥ 0 , xi" ≥ 0 Zmax= 30x1 - 4x2 s.t. 5x1-x2 ≤ 30 x1≤ 5 x1≥ 0 x2 urs

11 Because x2 is urs, substitute (x2' –x2") for x2 in each constraints and in the objective function. Zmax= 30x1 - 4 x2' +4x2" s.t. 5x1- x2' + x2"≤ 30 x1≤ 5 x1, x2', x2" ≥ 0 Then, the LP is converted to standard form by adding slack variables to each constraints and adding sign restrictions si ≥ 0

12 Example 13 The Dakota Furniture Company manufactures desks, 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 Table 13. Table 13 . Resource Requirements for Dakota Furniture Resource Desk Table Chair Lumber (board ft) 8 6 1 Finishing hours 4 2 1.5 Carpentry hours 0.5 Currently, 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. Dakota believes that demand for desks and chairs is unlimited, but at most 5 tables can be sold. Because the available resources have already been purchased, Dakota wants to maximize total revenue.

13 The Steps for Solving LP Maximization Problems
I.Formulate the LP problem’s objective function and constraints. Decision variables The company must decide how many desks, tables and chairs should be produced. x1 = the number of desks produced x2 = the number of tables produced x3 = the number of chairs produced Objective Function Dakota wants to maximize total revenue, so the objective function may be written as Zmax = 60x1+30x2+20x3

14 Constraints The values of x1, x2 and x3 are limited by the following four restrictions: Constraint 1: no more than 48 board feet of lumber may be used (or, the board feet of lumber used can not exceed 48 ) 8x1+ 6x x3 ≤ ( Lumber constraint) Constraint 2: no more than 20 hours of finishing time may be used (or, the hours of finishing time used can not exceed 20 hours) 4x1+ 2x2+1.5x3 ≤ 20 ( Finishing constraint) Constraint 3: no more than 8 hours of carpentry time may be used (or, the hours of carpentry time used can not exceed 8 hours) 2x1+1.5x2+0.5x3 ≤ ( Carpentry constraint) Constraint 4: Because of limited demand, at most 5 tables should be produced x ≤ ( Limitation on table demand)

15 8x1+ 6x2 + x3 ≤ 48 (lumber constraint)
Sign restriction To obtain meaningful solutions, the values for x1, x2 and x3 must be non negative numbers x1 , x2, x3 ≥ 0 The complete problem zmax = 60x1+30x2+20x3 s.t. 8x1+ 6x x3 ≤ 48 (lumber constraint) 4x1+ 2x2+1.5x3 ≤ (finishing constraint) 2x1+1.5x2+0.5x3 ≤ ( carpentry constraint) x ≤ ( demand constraint) x1 , x2, x3 ≥ 0 ( nonnegativity constraint)

16 In our example S1, S2, S3 and S4 are slack variables
II. Add slack variables to each less-than-or-equal-to constraint and to the problem’s objective function (convert the problem to standard form) -Note: if the constraint i of an LP is a ≤ constraint, we convert it to an equality constraint by adding a slack variable si to the ith constraint and adding the sign restriction si ≥ 0 8x x x3 +S1 = 48 4x x2+ 1.5x S2 = 20 2x1 +1.5x2+ 0.5x S3 = 8 x S4 = 5 x1 , x2, x3 ,S1, S2, S3, S4 ≥ 0 Slack Variable represents the amount of the resource unused in the constraint i. In our example S1, S2, S3 and S4 are slack variables S1: slack variable representing unused board feet in lumber S2: slack variable representing unused hours in finishing department S3: slack variable representing unused hours in carpentry department S3: slack variable representing unused amount on demand for table

17 zmax = 60x1+30x2 +20x3 + 0S1+ 0S2+ 0S3+ 0S4 s.t.
Add all new variables (slack variables) to the original objective function Because slack variables yield no profit, they are added to the original objective function with 0 profit coefficient. zmax = 60x1+30x2 +20x3 + 0S1+ 0S2+ 0S3+ 0S4 s.t. 8x x x3 +S1 = 48 4x x2+ 1.5x S2 = 20 2x1 +1.5x2+ 0.5x S3 = 8 x S4 = 5 x1 , x2, x3 ,S1, S2, S3, S4 ≥ 0

18 The simplex method begins with an initial feasible solution in which all real variables are set equal to 0. This trivial solution always produces a profit of $0, as well as slack variables equal to the constant (right-hand side) terms in the constraint equations. It is not a very exiting solution in terms of economic returns, but it is one of the original corner point solutions. The simplex method will start at this corner point and then move up or even to the corner point that yields the most improved profit.

19 III Develop an initial simplex tableau with slack variables in the basis. Compute the Zj and Cj – Zj values for this tableau Developing an initial simplex tableau (To find the starting basic feasible solution): use a table and place all the coefficients in tabular form. - write down all variables in the model with the coefficients of the objective function, in the first row of the table (corresponding objective function coefficients(Cj) are placed above the variables). - the coefficients of the 1st constraint is placed in the 3rd row, the 2nd in the 4th and so on. - insert a Solution Mix Column on left hand-side of the table (write down slack variables with their objective function coefficients). Notice that variables in the Solution Mix Column are called as Basic Variables. - insert a Quantity Column on right hand-side of the table (write down right hand-side values of the constraints).

20 Cj 60 30 20 Solution Mix (Basis) X1 X2 X3 S1 S2 S3 S4 Quantity 8 6 1 48 4 2 1.5 0.5 5 Zj Cj - Zj

21 Computing the Zj and Cj – Zj values for this tableau:
Zj values for each column are obtained by multiplying each technological coefficient in the column by its corresponding Cj of basic variable and summing these products. Expl: Zj for Column X1 8*0 + 4*0 + 2*0 + 0*0 = 0 These values represent the Gross Profit given up by adding 1 unit of this variable into the current solution. - Zj value for RHS Column is computed by multiplying each value in the column by its corresponding Cj of basic variables and summing these products. This value represent the total contribution of the current solution. Expl: At this stage the value of Z is 0.

22 Cj 60 30 20 Solution Mix(Basis) X1 X2 X3 S1 S2 S3 S4 Quantity 8 6 1 48 4 2 1.5 0.5 5 Zj Cj - Zj

23 The values of non-basic variables are 0 (x1= 0 , x2 = 0 , x3 = 0)
SUMMARY: This table represents a Basic Feasible Solution Table. { A basic solution to AX=b ( m linear equations, n variables, and n ≥m) is obtained by setting n-m variables equal to 0 and solving for the values of the remaining m variables. Any basic solution in which all variables are nonnegative is a basic feasible solution} 4 Basic variables, 3 Non-basic variables. Basic Variables, which are in the Basis Column (Solution Mix Column) are S1, S2, S3, S4 Non-Basic Variables, which are not in the Basis Column ( Solution Mix Column) are x1 , x2, x3 . The solution values of the basic variables are found in the RHS Column. S1= 48 , S2 = 20 , S3 = 8, S4 = 5. The values of non-basic variables are 0 (x1= 0 , x2 = 0 , x3 = 0) The value of Objective fn: Z=0

24 This row (Cj – Zj) is important for 2 reasons:
Test whether the solution is optimal or not: - Compute the last row (Cj – Zj): Substract each value in the row Zj from its corresponding value in the Cj row. For example, for X1 column the value is computed by subtracting 0 from 60 (60-0=0). Cj – Zj represents the Net Profit (or Loss) that will result from introducing 1 unit of each variable into the solution (the profit gained - the profit given up). This row (Cj – Zj) is important for 2 reasons:

25 - It tells if the current solution is optimal.
-If the solution is not optimal, this row determines which variable should enter the solution in the next iteration For a max. problem the solution is optimal if all Cj – Zj values are ≤ 0. For a min. problem the solution is optimal if all Cj – Zj values are ≥ 0. If the solution is optimal the iteration stops.

26 So, decide which of the variables will enter the solution.
IV. Follow these five steps until an optimal solution has been reached: - If the solution is not optimal, this row determines which variable should enter the solution in the next iteration. Expl: If 1 unit of x1 is added to the solution, objective fn. value will increase by 60 - If 1 unit of x2 is added to the solution, objective fn. value will increase by 30. - If 1 unit of x3 is added to the solution, objective fn. value will increase by 20. So, decide which of the variables will enter the solution. Since the goal is maximizing the profit, choose the one with the largest positive Cj – Zj value. In the problem, select x1 as the entering variable because its coefficient in the row is highest. OPTIMALITY CONDITION: The Entering variable in a max.(min.) problem is the non basic variable having the most positive(negative) coefficient in the Cj – Zj row. Ties are broken arbitrarily. The optimum is reached at the iteration where all the Cj – Zj coefficients are non-positive(nonnegative).

27 x1 column is the pivot column.
The column associated with the entering variable is called “pivot column”. So, x1 column is the pivot column.

28 Then decide which of the basic variables will leave the basis.
Since x1 will be entered to the solution, decide which variable will be replaced. (S1? S2? S3? S4?) To decide this, apply the Minimum Ratio test: Divide the each coefficient in the RHS column by its corresponding coefficient in the pivot column. Expl: For S1 row: For S2 row: For S3 row: 8/2 = 4 desks For S4 row: 5/0 = Undefined

29 The first ratio (=6 desks) tells that if we use all amount of resource 1 for making desks we can make 6 desks if we use all of the resource 2 we can make 5 desks. Similarly, if we use all of the resource 3 we can make 4 desks. However, desk production requires all of the resources in the model. This means, we can produce at most 4 desks. This quantity satisfies all constraints in the model. In other words; the “Smallest Ratio” indicates the maximum number of units of production that can be produced without violating none of the original constraints. So the smallest ratio is selected as the leaving variable. Otherwise, the next iteration will be infeasible. MIN Ratio Test : Min bi/aij where aij>0 for entering variable xj,

30 FEASIBILITY CONDITION:
If the denominator is negative or 0, ignore it. FEASIBILITY CONDITION: For both maximization and the minimization problems, the leaving variable is the basic variable associated with the smallest non-positive ratio. Ties are broken arbitrarily. The row associated with leaving variable is called pivot row. Here the row with S3 is the pivot row. The number at the intersection of the pivot row and the pivot column is called pivot number. Here pivot number is 2. Now that we are at the next iteration in the table, S1, S2 and S4 are still basic variables. However, S1 is replaced by x1. x1 becomes basic variable instead of S3.

31 Cj 60 30 20 Solution Mix (Basis) X1 X2 X3 S1 S2 S3 S4 Quantity 8 6 1 48 4 2 1.5 0.5 Pivot Row 5 Zj Cj - Zj Pivot Column

32 Calculating the new values for the pivot row:
The new values for the pivot row are computed by dividing every number in the pivot row by the pivot number (old pivot row/ pivot number). X1 2/2 1.5/2 0.5/2 0/2 1/2 8/2 1 .75 .25 0.5 4 Place all new values into the table.

33 Calculating the new values for the remaining row(s)
The new values for old row are computed with the following equation: New row numbers = numbers in old row - [(number above or below pivot number) x (corresponding number in newly replaced row)] Old S1 row 8 6 1 48 -(8*new pivot row) 0.75 0.25 0.5 4 New S1 row -1 -4 16

34 Old S2 row 4 2 1.5 1 20 -(4*new pivot row) 0.75 0.25 0.5 New S2 row -1 -2 Old S4 row 1 5 -(0*new pivot row) 0.75 0.25 0.5 4 New S4 row

35 Cj 60 30 20 X1 X2 X3 S1 S2 S3 S4 -1 1 -4 16 0.5 -2 4 x1 0.75 0.25 .5 5 Zj Cj - Zj

36 Compute the Zj and Cj – Zj values for this table.
Follow these five steps until an optimal solution has been reached: Choose the variable with the greatest positive Cj – Zj to enter the solution. This is the pivot column. 2. Determine the solution mix variable to be replaced and the pivot row by selecting the row with the smallest (nonnegative) ratio of the quantity (rhs)-to-pivot column substitution rate. This row is the pivot row. 3. Calculate the new values for the pivot row. 4. Calculate the new values for the other row(s). 5. Calculate the Zj and Cj – Zj values for this tableau. If there are any Cj – Zj numbers greater than zero, return to step 1. If there are no Cj – Zj numbers greater than zero, an optimal solution has been reached.

37 Cj 60 30 20 X1 X2 X3 S1 S2 S3 S4 -1 1 -4 16 0.5 -2 4 x1 0.75 0.25 .5 5 Zj 45 15 240 Cj - Zj -15 -30

38 Cj 60 30 20 X1 X2 X3 S1 S2 S3 S4 -1 1 -4 16 0.5 -2 4 Pivot Row x1 0.75 0.25 .5 5 Zj 45 15 240 Cj - Zj -15 -30 Pivot Column

39 The optimal table Cj 60 30 20 x1 x2 x3 S1 S2 S3 S4 -2 1 2 -8 24 -4 8 1.25 -0.5 1.5 5 Zj 35 10 280 Cj - Zj -5 -10

40 The optimal solution to the problem is to manufacture 2 desks and 8 chairs.
4 Basic variables, 3 Non-basic variables. Basic Variables, which are in the Basis Column (Solution Mix Column) are S1, x1, x3, S4 Non-Basic Variables, which are not in the Basis Column ( Solution Column) are x2 , S2, S3 . The solution values of the basic variables are found in the RHS Column. S1= 24 , x1 = 2 , x3 = 8, S4 = 5. The values of non-basic variables are 0. x2 = 0, S2= 0 , S3 = 0. The value of Objective fn: Z=$280

41 Since x2=0 no tables should be made. We are not producing table.
If we add to the solution a unit of x2, objective fn. value is decreased by 5. The given up profit per unit of x2 (35) is greater than the gained profit per unit of x2 (30). So the net profit is negative. Cj 60 30 20 x1 x2 x3 S1 S2 S3 S4 -2 1 2 -8 24 -4 8 1.25 -0.5 1.5 5 Zj 35 10 280 Cj - Zj -5 -10

42 - S1 and S4 are nonbinding (abundant resources)
Cj 60 30 20 x1 x2 x3 S1 S2 S3 S4 -2 1 2 -8 24 -4 8 1.25 -0.5 1.5 5 Zj 35 10 280 Cj - Zj -5 -10 - S1= 24 because only 8x1+ 6x x3 ≤ (lumber constraint) (the amount of resources used ≤ the amount of resources avaible) 8 (2) + 6(0)+ 8(1) = 24 ft. of lumber are being used. Thus, = 24 board feet of lumber are being used. Similarly, S4 = 5 makes sense because, the slack in constraint 4 is 5. - S1 and S4 are nonbinding (abundant resources)

43 - 4x1+ 2x2+1.5x3 ≤ 20 ( finishing constraint)
S2 = S3 = 0 all available finishing and carpentry hours are being utilized, so they are binding (scarce resources) Expl. - 4x1+ 2x2+1.5x3 ≤ 20 ( finishing constraint) - 4 (2) + 2(0)+ 1.5(8) =20 (the amount of resources used = the amount of resources available) similarly 2x1+1.5x2+0.5x3 ≤ 8 (carpentry constraint) 2(2) + 1.5(0)+ 0.5(8) =8 (the amount of resources used = the amount of resources available) Cj 60 30 20 x1 x2 x3 S1 S2 S3 S4 -2 1 2 -8 24 -4 8 1.25 -0.5 1.5 5 Zj 35 10 280 Cj - Zj -5 -10

44 All basic variables have 0 coefficient in the Cj-Zj row.
60 30 20 x1 x2 x3 S1 S2 S3 S4 -2 1 2 -8 24 -4 8 1.25 -0.5 1.5 5 Zj 35 10 280 Cj - Zj -5 -10 Note that: All basic variables have 0 coefficient in the Cj-Zj row. All non-basic variables have negative values ( max. problem). The coefficient of a decision variable in the Cj-Zj row is referred to as the variable’s reduced cost. The reduced cost for a basic variable will be always 0. In our optimal table, the reduced costs for x1 and x3 are 0. The reduced cost for x2 is 5. This means that increasing x2 by 1 will reduce Z by 5 (while other non-basic variables remain 0). The reduced cost for x2 is 5. This means that increasing x2 by 1 will reduce Z by 5 (while other non-basic variables remain 0).

45 The coefficient of slack variables in the Cj-Zj row corresponds to the unit worth of resource, or dual prices or shadow price. For example if the amount of the finishing time increased by 1, objective function value is increased by 10 (as long as its value lies in the range of feasibility). Cj 60 30 20 x1 x2 x3 S1 S2 S3 S4 -2 1 2 -8 24 -4 8 1.25 -0.5 1.5 5 Zj 35 10 280 Cj - Zj -5 -10 The basic feasible solution : x1 = 2,x3 = 8,s1 = 24,s4 = 5,x2 = s2 = s3 = 0 z = $280

46 Shadow price of the ith constraint is the amount by which the optimal z- value is improved (increased in a max problem and decreased in a min problem) if we increase bi by 1 (from bi to bi +1). This assumes that after the right hand side of constraint i has been changed to bi +1, the current basis remains optimum.


Download ppt "Linear Programming SIMPLEX METHOD."

Similar presentations


Ads by Google