Example #2.) Flip the third constraint to get initial dictionary z = 0.00 + 3.00 x1 - 1.00 x2 --------------------------------------------- x3 = 8.00 - 1.00 x1 x4 = 10.00 - 1.00 x1 - 1.00 x2 x5 = 8.00 - 2.00 x1 + 1.00 x2 Original Matrix: [ 1 0 | 1 0 0 ] A = [ 1 1 | 0 1 0 ] [ 2 -1 | 0 0 1 ] scriptB = { 3, 4, 5 } [ 1 0 0 ] B = [ 0 1 0 ] ( equals B-inverse, [ 0 0 1 ] of course) ENTERING VARIABLE: x1 LEAVING VARIABLE: x5 NEW DICTIONARY: z = 12.00 + 0.50 x2 - 1.50 x5 --------------------------------------------- x3 = 4.00 - 0.50 x2 + 0.50 x5 x4 = 6.00 - 1.50 x2 + 0.50 x5 x1 = 4.00 + 0.50 x2 - 0.50 x5 scriptB = { 3, 4, 1 } [ 1 0 1 ] B = [ 0 1 1 ] [ 0 0 2 ] [ 1 0 -1/2 ] B-inv = [ 0 1 -1/2 ] (x3,x4 cols from LHS, [ 0 0 1/2 ] x5 col pulled over from RHS) ENTERING VARIABLE: x2 RATIOS (for each constraint): LEAVING VARIABLE: x4 NEW DICTIONARY: z = 14.00 - 0.33 x4 - 1.33 x5 --------------------------------------------- x3 = 2.00 + 0.33 x4 + 0.33 x5 x2 = 4.00 - 0.67 x4 + 0.33 x5 x1 = 6.00 - 0.33 x4 - 0.33 x5 scriptB = { 3, 2, 1 } [ 1 0 1 ] B = [ 0 1 1 ] (submatrix of original) [ 0 -1 2 ] [ 1 -1/3 -1/3 ] B-inv = [ 0 2/3 -1/3 ] (x3 col from LHS, [ 0 1/3 1/3 ] x4,x5 cols pulled over) STOP: All cj-bar <= 0 so we have reached optimality. Optimal Basis: { 3,2,1 } Optimal Solution: x = ( 6, 4, 2, 0, 0 ) Optimal Objective Value: z = 14 Example #4.) Toss in three slack variables to get initial dictionary z = 0.00 + 1.00 x1 + 2.00 x2 --------------------------------------------- x3 = 40.00 - 4.00 x1 - 1.00 x2 x4 = 20.00 - 2.00 x1 - 1.00 x2 x5 = 10.00 - 1.00 x1 - 1.00 x2 Original Matrix: [ 4 1 | 1 0 0 ] A = [ 2 1 | 0 1 0 ] [ 1 1 | 0 0 1 ] scriptB = { 3, 4, 5 } -1 [ 1 0 0 ] B = B [ 0 1 0 ] [ 0 0 1 ] ENTERING VARIABLE: x1 RATIOS (for each constraint): LEAVING VARIABLE: x3 NEW DICTIONARY: z = 10.00 + 1.75 x2 - 0.25 x3 --------------------------------------------- x1 = 10.00 - 0.25 x2 - 0.25 x3 x4 = 0.00 - 0.50 x2 + 0.50 x3 x5 = 0.00 - 0.75 x2 + 0.25 x3 scriptB = { 1, 4, 5 } [ 4 0 0 ] B = [ 2 1 0 ] (submatrix of original) [ 1 0 1 ] [ 1/4 0 0 ] B-inv = [-1/2 1 0 ] (x4,x5 cols from LHS, [-1/4 0 1 ] x3 col pulled over) ENTERING VARIABLE: x2 RATIOS (for each constraint): LEAVING VARIABLE: x4 NEW DICTIONARY: (degenerate pivot) z = 10.00 + 1.50 x3 - 3.50 x4 --------------------------------------------- x1 = 10.00 - 0.50 x3 + 0.50 x4 x2 = 0.00 + 1.00 x3 - 2.00 x4 x5 = 0.00 - 0.50 x3 + 1.50 x4 scriptB = { 1, 2, 5 } [ 4 1 0 ] B = [ 2 1 0 ] (submatrix of original) [ 1 1 1 ] [ 1/2 -1/2 0 ] B-inv = [-1 2 0 ] (x5 col from LHS, [ 1/2 -3/2 1 ] x3,x4 cols pulled over) ENTERING VARIABLE: x3 RATIOS (for each constraint): LEAVING VARIABLE: x5 NEW DICTIONARY: (degenerate pivot) z = 10.00 + 1.00 x4 - 3.00 x5 --------------------------------------------- x1 = 10.00 - 1.00 x4 + 1.00 x5 x2 = 0.00 + 1.00 x4 - 2.00 x5 x3 = 0.00 + 3.00 x4 - 2.00 x5 scriptB = { 1, 2, 3 } [ 4 1 1 ] B = [ 2 1 0 ] (submatrix of original) [ 1 1 0 ] [ 0 1 -1 ] B-inv = [ 0 -1 2 ] (x3 col from LHS [ 1 -3 2 ] - basic in 3rd row - x4,x5 cols pulled over from RHS) ENTERING VARIABLE: x4 RATIOS (for each constraint): LEAVING VARIABLE: x1 NEW DICTIONARY: z = 20.00 - 1.00 x1 - 2.00 x5 --------------------------------------------- x4 = 10.00 - 1.00 x1 + 1.00 x5 x2 = 10.00 - 1.00 x1 - 1.00 x5 x3 = 30.00 - 3.00 x1 + 1.00 x5 scriptB = { 4, 2, 3 } [ 0 1 1 ] B = [ 1 1 0 ] (submatrix of original A [ 0 1 0 ] with cols indexed 4,2,3) [ 0 1 -1 ] B-inv = [ 0 0 1 ] (x3,x4 cols from LHS [ 1 0 -1 ] - basic in 3rd row and 1st row, resp. - x5 col pulled over from RHS) STOP: All cj-bar <= 0 so we have reached optimality. Optimal Basis: { 4,2,3 } Optimal Solution: x = ( 0, 10, 30, 10, 0 ) Optimal Objective Value: z = 20