I see that you always pick the pivot where its c[i] cost is 'more negative' . Why not use Bland's rule, pick the first negative c[i], pivot over the column i and have certainty that it will never present a cycle ?
Your presentation is too good. Your method of solving is much easier than the usual practise of calculation where (Z-C) relative cost factor is taken as index row to check for optimality condition.!!
Basic Solution(BS) : This solution is obtained by setting any n variables (among m+n variables) equal to zero and solving for remaining m variables, provided the determinant of the coefficients of these variables is non-zero. Such m variables are called basic variables and remaining n zero valued variables are called non basic variables .
Basic Feasible Solution(BFS) : It is a basic solution which also satisfies the non negativity restrictions.
Step 1: Convert all the inequality constraints into equalities by the use of slack variables .
Let S 1 , S 2 , S 3 be three slack variables.
Introducing these slack variables into the inequality constraints and rewriting the objective function such that all variables are on the left-hand side of the equation. Model can rewritten as:
Z - 13x 1 -11x 2 = 0 Subject to constraints: 4x 1 +5x 2 + S 1 = 1500 5x 1 +3x 2 +S 2 = 1575 x 1 +2x 2 +S 3 = 420 x 1 , x 2 , S 1 , S 2 , S 3 > 0
One Feasible solution that satisfies all the constraints is: x 1 = 0, x 2 = 0, S 1 = 1500,
S 2 = 1575, S 3 = 420 and Z=0.
Now, S 1 , S 2 , S 3 are Basic variables.
Step III : Set up an initial table as:
8.
Cont… Step IV: a) Choose the most negative number from row A1(i.e Z row). Therefore, x 1 is a entering variable . b) Calculate Ratio = Sol col. / x 1 col. (x 1 > 0 ) c) Choose minimum Ratio. That variable(i.e S 2 ) is a departing variable . D1 C1 B1 A1 Row NO. 0 0 0 0 -11 -13 1 Z 420 315 375 Ratio 420 1 0 0 2 1 0 S 3 1575 0 1 0 3 5 0 S 2 1500 0 0 1 5 4 0 S 1 Sol. S 3 S 2 S 1 x 2 x 1 Z Coefficients of: Basic Variable
9.
Cont…. Step V: x 1 becomes basic variable and S 2 becomes non basic variable. New table is: 75 525 92.3 Ratio 105 1 -1/5 0 7/5 0 0 S 3 D1 315 0 1/5 0 3/5 1 0 x 1 C1 240 0 -4/5 1 13/5 0 0 S 1 B1 4095 0 13/5 0 -16/5 0 1 Z A1 Sol. S 3 S 2 S 1 x 2 x 1 Z Coefficients of: Basic Variable Row NO.
10.
Cont… Next Table is : Optimal Solution is : x 1 = 270, x 2 = 75, Z= 4335 75 5/7 -1/7 0 1 0 0 x 2 D1 270 -3/7 2/7 0 0 1 0 x 1 C1 45 -13/7 -3/7 1 0 0 0 S 1 B1 4335 16/7 15/7 0 0 0 1 Z A1 Sol. S 3 S 2 S 1 x 2 x 1 Z Coefficients of: Basic Variable Row NO.
11.
Example Max. Z = 3x 1 +5x 2 +4x 3 Subject to constraints: 2x 1 +3x 2 < 8 2x 2 +5x 3 < 10 3x 1 +2x 2 +4x 3 < 15 x 1 , x 2 , x 3 > 0
12.
Cont… Let S 1 , S 2 , S 3 be the three slack variables. Modified form is: Z - 3x 1 -5x 2 -4x 3 =0 2x 1 +3x 2 +S 1 = 8 2x 2 +5x 3 +S 2 = 10 3x 1 +2x 2 +4x 3 +S 3 = 15 x 1 , x 2 , x 3 , S 1 , S 2 , S 3 > 0 Initial BFS is : x 1 = 0, x 2 = 0, x 3 =0, S 1 = 8, S 2 = 10, S 3 = 15 and Z=0.
13.
Cont… Therefore, x 2 is the entering variable and S 1 is the departing variable. 4 5 0 -4 x 3 15/2 5 8/3 Ratio 15 1 0 0 2 3 0 S 3 10 0 1 0 2 0 0 S 2 8 0 0 1 3 2 0 S 1 0 0 0 0 -5 -3 1 Z Sol. S 3 S 2 S 1 x 2 x 1 Z Coefficients of: Basic Variable
14.
Cont… Therefore, x 3 is the entering variable and S 2 is the departing variable. 4 5 0 -4 x 3 29/12 14/15 - Ratio 29/3 1 0 -2/3 0 5/3 0 S 3 14/3 0 1 -2/3 0 -4/3 0 S 2 8/3 0 0 1/3 1 2/3 0 x 2 40/3 0 0 5/3 0 1/3 1 Z Sol. S 3 S 2 S 1 x 2 x 1 Z Coefficients of: Basic Variable
15.
Cont… Therefore, x 1 is the entering variable and S 3 is the departing variable. 0 1 0 0 x 3 89/41 - 4 Ratio 89/15 1 -4/5 2/15 0 41/15 0 S 3 14/15 0 1/5 -2/15 0 -4/15 0 x 3 8/3 0 0 1/3 1 2/3 0 x 2 256/15 0 4/5 17/15 0 -11/15 1 Z Sol. S 3 S 2 S 1 x 2 x 1 Z Coefficients of: Basic Variable
16.
Cont… Optimal Solution is : x 1 = 89/41, x 2 = 50/41, x 3 =62/41, Z= 765/41 0 1 0 0 x 3 89/41 15/41 -12/41 -2/41 0 1 0 x 1 62/41 4/41 5/41 -6/41 0 0 0 x 3 50/41 -10/41 8/41 15/41 1 0 0 x 2 765/41 11/41 24/41 45/41 0 0 1 Z Sol. S 3 S 2 S 1 x 2 x 1 Z Coefficients of: Basic Variable
17.
Example Min.. Z = x 1 - 3x 2 + 2x 3 Subject to constraints: 3x 1 - x 2 + 3x 3 < 7 -2x 1 + 4x 2 < 12 -4x 1 + 3x 2 + 8x 3 < 10 x 1 , x 2 , x 3 > 0
18.
Cont… Convert the problem into maximization problem Max.. Z’ = -x 1 + 3x 2 - 2x 3 where Z’= -Z Subject to constraints: 3x 1 - x 2 + 3x 3 < 7 -2x 1 + 4x 2 < 12 -4x 1 + 3x 2 + 8x 3 < 10 x 1 , x 2 , x 3 > 0
19.
Cont… Let S 1 , S 2 and S 3 be three slack variables. Modified form is: Z’ + x 1 - 3x 2 + 2x 3 = 0 3x 1 - x 2 + 3x 3 +S 1 = 7 -2x 1 + 4x 2 + S 2 = 12 -4x 1 + 3x 2 + 8x 3 +S 3 = 10 x 1 , x 2 , x 3 > 0 Initial BFS is : x 1 = 0, x 2 = 0, x 3 =0, S 1 = 7, S 2 = 12, S 3 = 10 and Z=0.
20.
Cont… Therefore, x 2 is the entering variable and S 2 is the departing variable. 10/3 10 1 0 0 8 3 -4 0 S 3 0 0 0 S 3 0 3 2 x 3 3 - Ratio 12 1 0 4 -2 0 S 2 7 0 1 -1 3 0 S 1 0 0 0 -3 1 1 Z’ Sol. S 2 S 1 x 2 x 1 Z’ Coefficients of: Basic Variable
21.
Cont… Therefore, x 1 is the entering variable and S 1 is the departing variable. - 1 1 -3/4 0 8 0 -5/2 0 S 3 0 0 0 S 3 0 3 2 x 3 - 4 Ratio 3 1/4 0 1 -1/2 0 x 2 10 1/4 1 0 5/2 0 S 1 9 3/4 0 0 -1/2 1 Z’ Sol. S 2 S 1 x 2 x 1 Z’ Coefficients of: Basic Variable
11 1 -1/2 1 11 0 0 0 S 3 0 0 0 S 3 3/5 6/5 13/5 x 3 5 3/10 1/5 1 0 0 x 2 4 1/10 2/5 0 1 0 x 1 11 8/10 1/5 0 0 1 Z’ Sol. S 2 S 1 x 2 x 1 Z’ Coefficients of: Basic Variable
23.
Example Max.. Z = 3x 1 + 4x 2 Subject to constraints: x 1 - x 2 < 1 -x 1 + x 2 < 2 x 1 , x 2 > 0
24.
Cont… Let S 1 and S 2 be two slack variables . Modified form is: Z -3x 1 - 4x 2 = 0 x 1 - x 2 +S 1 = 1 -x 1 + x 2 +S 2 = 2 x 1 , x 2 , S 1 , S 2 > 0 Initial BFS is : x 1 = 0, x 2 = 0, S 1 = 1, S 2 = 2 and Z=0.
25.
Cont… Therefore, x 2 is the entering variable and S 2 is the departing variable. 2 - Ratio 2 1 0 1 -1 0 S 2 1 0 1 -1 1 0 S 1 0 0 0 -4 -3 1 Z Sol. S 2 S 1 x 2 x 1 Z Coefficients of: Basic Variable
26.
Cont… x 1 is the entering variable, but as in x 1 column every no. is less than equal to zero, ratio cannot be calculated. Therefore given problem is having a unbounded solution . - - Ratio 2 1 0 1 -1 0 x 2 3 1 1 0 0 0 S 1 8 4 0 0 -7 1 Z Sol. S 2 S 1 x 2 x 1 Z Coefficients of: Basic Variable
28.
Introduction LPP, in which constraints may also have > and = signs, we introduce a new type of variable , called the artificial variable . These variables are fictitious and cannot have any physical meaning. Two Phase Simplex Method is used to solve a problem in which some artificial variables are involved. The solution is obtained in two phases.
29.
Example Min.. Z = 15/2 x 1 - 3x 2 Subject to constraints: 3x 1 - x 2 - x 3 > 3 x 1 - x 2 + x 3 > 2 x 1 , x 2 , x 3 > 0
30.
Cont… Convert the objective function into the maximization form Max. Z’ = -15/2 x 1 + 3x 2 where Z’= -Z Subject to constraints: 3x 1 - x 2 - x 3 > 3 x 1 - x 2 + x 3 > 2 x 1 , x 2 , x 3 > 0
31.
Cont… Modified form is : Introduce surplus variables S 1 and S 2 , and artificial variables a 1 and a 2 Z’ + 15/2 x 1 - 3x 2 = 0 Subject to constraints: 3x 1 - x 2 - x 3 –S 1 + a 1 = 3 x 1 - x 2 + x 3 –S 2 + a 2 = 2 x 1 , x 2 , x 3 , S 1 , S 2 , a 1 , a 2 > 0
Phase I : Simplex method is applied to a specially constructed Auxiliary LPP leading to a final simplex table containing a BFS to the original problem.
Step 1 : Assign a cost –1 to each artificial variable and a cost 0 to all other variables in the objective function.
Step 2 : Construct the auxiliary LPP in which the new objective function Z * is to be maximized subject to the given set of constraints.
33.
Cont… Max. Z * = -a 1 –a 2 Z * + a 1 + a 2 = 0 Subject to constraints: 3x 1 - x 2 - x 3 –S 1 + a 1 = 3 x 1 - x 2 + x 3 –S 2 + a 2 = 2 x 1 , x 2 , x 3 , S 1 , S 2 , a 1 , a 2 > 0 Auxiliary LPP is: Initial solution is a 1 = 3, a 2 = 2 and Z * = 0
Step 3 : Solve the auxiliary problem by simplex method until either of the following three possibilities arise:
Max Z * < 0 and at least one artificial variable appear in the optimum basis at a positive level. In this case given problem does not have any feasible solution.
Max Z * = 0 and at least one artificial variable appear in the optimum basis at a zero level. In this case proceed to Phase II.
Max Z * = 0 and no artificial variable appear in the optimum basis. In this case also proceed to Phase II.
35.
Cont… This table is not feasible as a 1 and a 2 has non zero coefficients in Z * row. Therefore next step is to make the table feasible. 1 0 1 a 2 0 1 1 a 1 1 -1 0 x 3 2 -1 0 -1 1 0 a 2 3 0 -1 -1 3 0 a 1 0 0 0 0 0 1 Z * Sol. S 2 S 1 x 2 x 1 Z * Coefficients of: Basic Variable
36.
Cont… Therefore, x 1 is the entering variable and a 1 is the departing variable. 2 1 Ratio 1 0 0 a 2 0 1 0 a 1 1 -1 0 x 3 2 -1 0 -1 1 0 a 2 3 0 -1 -1 3 0 a 1 -5 1 1 2 -4 1 Z * Sol. S 2 S 1 x 2 x 1 Z * Coefficients of: Basic Variable
37.
Cont… Therefore, x 3 is the entering variable and a 2 is the departing variable. 3/4 - Ratio 1 0 0 a 2 4/3 -1/3 -4/3 x 3 1 -1 1/3 -2/3 0 0 a 2 1 0 -1/3 -1/3 1 0 x 1 -1 1 -1/3 2/3 0 1 Z * Sol. S 2 S 1 x 2 x 1 Z * Coefficients of: Basic Variable
38.
Cont… As there is no variable to be entered in the basis, this table is optimum for Phase I. In this table Max. Z * = 0 and no artificial variable appears in the optimum basis, therefore we can proceed to Phase II. 1 0 0 x 3 3/4 -3/4 1/4 -1/2 0 0 x 3 5/4 -1/4 -1/4 -1/2 1 0 x 1 0 0 0 0 0 1 Z * Sol. S 2 S 1 x 2 x 1 Z * Coefficients of: Basic Variable
39.
Cont… Phase II : The artificial variables which are non basic at the end of Phase I are removed from the table and as well as from the objective function and constraints. Now assign the actual costs to the variables in the Objective function. That is, Simplex method is applied to the modified simplex table obtained at the Phase I. Again this table is not feasible as basic variable x 1 has a non zero coefficient in Z’ row. So make the table feasible. 1 0 0 x 3 3/4 -3/4 1/4 -1/2 0 0 x 3 5/4 -1/4 -1/4 -1/2 1 0 x 1 0 0 0 -3 15/2 1 Z’ Sol. S 2 S 1 x 2 x 1 Z’ Coefficients of: Basic Variable
Optimal Solution is : x 1 = 5/4, x 2 = 0, x 3 = 3/4,
Z’ = -75/8 Z = 75/8
1 0 0 x 3 3/4 -3/4 1/4 -1/2 0 0 x 3 5/4 -1/4 -1/4 -1/2 1 0 x 1 -75/8 15/8 15/8 3/4 0 1 Z’ Sol. S 2 S 1 x 2 x 1 Z’ Coefficients of: Basic Variable
41.
Example Min.. Z = x 1 - 2x 2 –3x 3 Subject to constraints: -2x 1 + x 2 + 3x 3 = 2 2x 1 + 3x 2 + 4x 3 = 1 x 1 , x 2 , x 3 > 0
42.
Cont… Phase I: Introducing artificial variables a 1 and a 2 Auxiliary LPP is: Max. Z* = -a 1 - a 2 Z* + a 1 + a 2 = 0 Subject to constraints: -2x 1 + x 2 + 3x 3 + a 1 = 2 2x 1 + 3x 2 + 4x 3 + a 2 = 1 x 1 , x 2 , x 3 > 0
43.
Cont… This table is not feasible as a 1 and a 2 has non zero coefficients in Z * row. Therefore next step is to make the table feasible. 1 0 1 a 2 0 1 1 a 1 4 3 0 x 3 1 3 2 0 a 2 2 1 -2 0 a 1 0 0 0 1 Z * Sol. x 2 x 1 Z * Coefficients of: Basic Variable
44.
Cont… Therefore, x 3 is the entering variable and a 2 is the departing variable. 1/4 2/3 Ratio 1 0 0 a 2 0 1 0 a 1 4 3 -7 x 3 1 3 2 0 a 2 2 1 -2 0 a 1 -3 -4 0 1 Z * Sol. x 2 x 1 Z * Coefficients of: Basic Variable
45.
Cont… As there is no variable to be entered in the basis, therefore Phase I ends here. But one artificial variable is present in the basis and Z * < 0. Therefore we cannot proceed to Phase II. Given problem is having a non-feasible solution . 0 1 0 a 1 1 0 0 x 3 1/4 3/4 1/2 0 x 3 5/4 -5/4 -7/2 0 a 1 -5/4 5/4 7/4 1 Z * Sol. x 2 x 1 Z * Coefficients of: Basic Variable
46.
Example Min.. Z = 4x 1 + x 2 Subject to constraints: 3x 1 + x 2 = 3 4x 1 + 3x 2 > 6 x 1 +2x 2 < 4 x 1 , x 2 > 0
47.
Cont… Phase I : Introducing artificial variable a 1 and a 2 , surplus variable S 1 and slack variable S 2 Auxiliary LPP is : Max. Z* = -a 1 - a 2 Z* + a 1 + a 2 = 0 Subject to constraints: 3x 1 + x 2 +a 1 = 3 4x 1 + 3x 2 –S 1 + a 2 = 6 x 1 +2x 2 +S 2 = 4 x 1 , x 2 > 0
48.
Cont… This table is not feasible as a 1 and a 2 has non zero coefficients in Z * row. Therefore next step is to make the table feasible. 4 0 0 1 0 2 1 0 S 2 0 0 0 S 2 1 0 1 a 2 0 1 1 a 1 -1 0 0 S 1 6 3 4 0 a 2 3 1 3 0 a 1 0 0 0 1 Z * Sol. x 2 x 1 Z * Coefficients of: Basic Variable
49.
Cont… Therefore, x 1 is the entering variable and a 1 is the departing variable. 4 3/2 1 Ratio 4 0 0 1 0 2 1 0 S 2 0 0 0 S 2 1 0 0 a 2 0 1 0 a 1 -1 0 1 S 1 6 3 4 0 a 2 3 1 3 0 a 1 -9 -4 -7 1 Z * Sol. x 2 x 1 Z * Coefficients of: Basic Variable
50.
Cont… Therefore, x 2 is the entering variable and a 2 is the departing variable. 9/5 6/5 3 Ratio 3 0 1 0 5/3 0 0 S 2 0 0 0 S 2 1 0 0 a 2 -1 0 1 S 1 2 5/3 0 0 a 2 1 1/3 1 0 x 1 -2 -5/3 0 1 Z * Sol. x 2 x 1 Z * Coefficients of: Basic Variable
51.
Cont… As there is no variable to be entered in the basis, this table is optimum for Phase I. In this table Max. Z * = 0 and no artificial variable appears in the optimum basis, therefore we can proceed to Phase II. 1 1 1 0 0 0 S 2 0 0 0 S 2 -3/5 1/5 0 S 1 6/5 1 0 0 x 2 3/5 0 1 0 x 1 0 0 0 1 Z * Sol. x 2 x 1 Z * Coefficients of: Basic Variable
52.
Cont… Phase II : Original Objective function is: Min.. Z = 4x 1 + x 2 Convert the objective function into the maximization form Max. Z’ = -4 x 1 - x 2 where Z’= -Z Again this table is not feasible as basic variable x 1 and x 2 has a non zero coefficient in Z’ row. So make the table feasible. 1 1 1 0 0 0 S 2 0 0 0 S 2 -3/5 1/5 0 S 1 6/5 1 0 0 x 2 3/5 0 1 0 x 1 0 1 4 1 Z * Sol. x 2 x 1 Z * Coefficients of: Basic Variable
53.
Cont… Therefore, S 1 is the entering variable and S 2 is the departing variable. 1 - 3 Ratio 1 1 1 0 0 0 S 2 0 0 0 S 2 -3/5 1/5 -1/5 S 1 6/5 1 0 0 x 2 3/5 0 1 0 x 1 -18/5 0 0 1 Z ’ Sol. x 2 x 1 Z ’ Coefficients of: Basic Variable
56.
Introduction At the stage of improving the solution during Simplex procedure, if a tie for the minimum ratio occurs at least one basic variable becomes equal to zero in the next iteration and the new solution is said to be Degenerate .
57.
Example Max.. Z = 3x 1 + 9x 2 Subject to constraints: x 1 + 4x 2 < 8 x 1 + 2x 2 < 4 x 1 , x 2 > 0
58.
Cont… Let S 1 and S 2 be two slack variables. Modified form is: Z - 3x 1 - 9x 2 = 0 x 1 + 4x 2 + S 1 = 8 x 1 + 2x 2 +S 2 = 4 x 1 , x 2 , S 1 , S 2 > 0 Initial BFS is : x 1 = 0, x 2 = 0, S 1 = 8, S 2 = 4 and Z=0.
59.
Cont… In this table S 1 and S 2 tie for the leaving variable. So any one can be considered as leaving variable. Therefore, x 2 is the entering variable and S 1 is the departing variable. 2 2 Ratio 4 1 0 2 1 0 S 2 0 0 S 2 1 0 S 1 8 4 1 0 S 1 0 -9 -3 1 Z Sol. x 2 x 1 Z Coefficients of: Basic Variable
60.
Cont… Therefore, x 1 is the entering variable and S 2 is the departing variable. 0 8 Ratio 0 1 -1/2 0 1/2 0 S 2 0 0 S 2 1/4 9/4 S 1 2 1 1/4 0 x 2 18 0 -3/4 1 Z Sol. x 2 x 1 Z Coefficients of: Basic Variable