Math Models of OR: Handling Upper Bounds in Simplex John E. Mitchell Department of Mathematical Sciences RPI, Troy, NY 280 USA September 208 Mitchell Handling Upper Bounds in Simplex / 8
Introduction Outline Introduction 2 Example 3 Tableaus Mitchell Handling Upper Bounds in Simplex 2 / 8
Introduction Slack variables Consider the linear programming problem min c T x subject to Ax = b 0 x u Could introduce slack variables s to get standard form: Increase from n to 2n variables. min c T x subject to Ax = b x + s = u x, s 0 Increase from m constraints to m + n constraints. Mitchell Handling Upper Bounds in Simplex 3 / 8
Introduction Modify pivot rules Instead, modify the pivot rules and work with the original tableau. A variable can be nonbasic at either its lower bound or its upper bound. If it is at its upper bound, it can enter the basis if its reduced cost is positive. The variable will be decreased. In the minimum ratio test, we ensure that no variable violates its upper or lower bound. Mitchell Handling Upper Bounds in Simplex 4 / 8
Example Outline Introduction 2 Example 3 Tableaus Mitchell Handling Upper Bounds in Simplex 5 / 8
Example Example min 2x 3 3x 4 subject to x + x 3 + 3x 4 = 6 x 2 x 3 2x 4 = 0 x 4 0 x 2 3 0 x 3 5 0 x 4 Have basic feasible solution: Nonbasics: x 3 = 0, x 4 = Basics: x = 6 x 3 3x 4 = 3, x 2 = + x 3 + 2x 4 =. Note how x 4 impacts these values. Objective function value: 2(0) 3() = 3. Mitchell Handling Upper Bounds in Simplex 6 / 8
Example Graphing the example x 4 min 2x 3 3x 4 s.t. x + x 3 + 3x 4 = 6 x 2 x 3 2x 4 = 0 x 4 0 x 2 3 0 x 3 5 0 x 4 0 2 3 4 5 x 3 Mitchell Handling Upper Bounds in Simplex 7 / 8
Example Graphing the example x 4 x 3 + 3x 4 = 2, x = 4 x 3 + 3x 4 = 6, x = 0 min 2x 3 3x 4 s.t. x + x 3 + 3x 4 = 6 x 2 x 3 2x 4 = 0 x 4 0 x 2 3 0 x 3 5 0 x 4 0 2 3 4 5 x 3 Mitchell Handling Upper Bounds in Simplex 7 / 8
Example Graphing the example x 4 x 3 + 2x 4 =, x 2 = 0 x 3 + 2x 4 = 4, x 2 = 3 min 2x 3 3x 4 s.t. x + x 3 + 3x 4 = 6 x 2 x 3 2x 4 = 0 x 4 0 x 2 3 0 x 3 5 0 x 4 0 2 3 4 5 x 3 Mitchell Handling Upper Bounds in Simplex 7 / 8
Example Graphing the example x 4 x 3 + 2x 4 =, x 2 = 0 x 3 + 3x 4 = 2, x = 4 x 3 + 2x 4 = 4, x 2 = 3 x 3 + 3x 4 = 6, x = 0 min 2x 3 3x 4 s.t. x + x 3 + 3x 4 = 6 x 2 x 3 2x 4 = 0 x 4 0 x 2 3 0 x 3 5 0 x 4 0 2 3 4 5 x 3 Mitchell Handling Upper Bounds in Simplex 7 / 8
Example Graphing the example x 4 x 3 + 2x 4 =, x 2 = 0 x 3 = 0 contour x 3 + 3x 4 = 2, x = 4 x 4 = x 3 + 2x 4 = 4, x 2 = 3 x 3 + 3x 4 = 6, x = 0 min 2x 3 3x 4 s.t. x + x 3 + 3x 4 = 6 x 2 x 3 2x 4 = 0 x 4 0 x 2 3 0 x 3 5 0 x 4 0 2 3 4 5 x 3 Mitchell Handling Upper Bounds in Simplex 7 / 8
Example Graphing the example x 4 x 3 + 2x 4 =, x 2 = 0 simplex direction: increase x 3, keep x 4 = contour x 3 + 3x 4 = 2, x = 4 x 4 = x 3 + 2x 4 = 4, x 2 = 3 x 3 + 3x 4 = 6, x = 0 min 2x 3 3x 4 s.t. x + x 3 + 3x 4 = 6 x 2 x 3 2x 4 = 0 x 4 0 x 2 3 0 x 3 5 0 x 4 0 2 3 4 5 x 3 Mitchell Handling Upper Bounds in Simplex 7 / 8
Example Graphing the example x 4 x 3 + 2x 4 =, x 2 = 0 simplex direction: increase x 3, keep x 4 = contour x 3 + 3x 4 = 2, x = 4 x 4 = x 3 + 2x 4 = 4, x 2 = 3 x 3 + 3x 4 = 6, x = 0 min 2x 3 3x 4 s.t. x + x 3 + 3x 4 = 6 x 2 x 3 2x 4 = 0 x 4 0 x 2 3 0 x 3 5 0 x 4 0 2 3 4 5 x 3 Mitchell Handling Upper Bounds in Simplex 7 / 8
Example Performing the simplex pivot algebraically min 2x 3 3x 4 subject to x + x 3 + 3x 4 = 6 x 2 x 3 2x 4 = 0 x 4 Nonbasics: 0 x 2 3 x 3 = 0, x 4 = 0 x 3 5 0 x 4 Since x 4 is at its upper bound and has a negative reduced cost, we don t bring x 4 into the basis. Instead, x 3 enters the basis. Calculate the simplex direction: We are increasing x 3, so the changes in the basic variables are given by the negatives of the entries in the x 3 column of the tableau. Direction is x = (,,, 0) T. Mitchell Handling Upper Bounds in Simplex 8 / 8
Example Finding the minimum ratio Taking a step of length t in the simplex direction gives a new point: x 3 x 2 x 3 = 0 + t x 4 0 Need to keep x within its bounds. x is decreasing. Need t 3 to keep x 0. x 2 is increasing. Need t 2 to keep x 2 3. x 3 is increasing. Need t 5 to keep x 3 5. So choose t = 2. x 2 leaves the basis at its upper bound. Mitchell Handling Upper Bounds in Simplex 9 / 8
Tableaus Outline Introduction 2 Example 3 Tableaus Mitchell Handling Upper Bounds in Simplex 0 / 8
Tableau for first iteration Tableaus x x 2 x 3 x 4 Min ratios 0 0 0 2 3 LB UB 6 0 3 3 3 0 2 UB 4 3 5 B/LB/UB B B LB UB Values 3 0 Initial value of objective is z = 0 3() = 3. x 3 enters the basis. The Min ratios columns correspond to variables leaving the basis: if the pivot is in the first constraint, x would leave the basis at its lower bound, and if the pivot is in the second constraint, x 2 would leave the basis at its upper bound. By the minimum ratio test, x 2 leaves the basis at its upper bound. Mitchell Handling Upper Bounds in Simplex / 8
Tableau for first iteration Tableaus x x 2 x 3 x 4 Min ratios 0 0 0 2 3 LB UB 6 0 3 3 3 0 2 UB 4 3 5 B/LB/UB B B LB UB Values 3 0 Initial value of objective is z = 0 3() = 3. x 3 enters the basis. The Min ratios columns correspond to variables leaving the basis: if the pivot is in the first constraint, x would leave the basis at its lower bound, and if the pivot is in the second constraint, x 2 would leave the basis at its upper bound. By the minimum ratio test, x 2 leaves the basis at its upper bound. Mitchell Handling Upper Bounds in Simplex / 8
Tableau for first iteration Tableaus x x 2 x 3 x 4 Min ratios 0 0 0 2 3 LB UB 6 0 3 3 3 0 2 UB 4 3 5 B/LB/UB B B LB UB Values 3 0 Initial value of objective is z = 0 3() = 3. x 3 enters the basis. The Min ratios columns correspond to variables leaving the basis: if the pivot is in the first constraint, x would leave the basis at its lower bound, and if the pivot is in the second constraint, x 2 would leave the basis at its upper bound. By the minimum ratio test, x 2 leaves the basis at its upper bound. Mitchell Handling Upper Bounds in Simplex / 8
Tableau for first iteration Tableaus x x 2 x 3 x 4 Min ratios 0 0 0 2 3 LB UB 6 0 3 3 3 0 2 UB 4 3 5 B/LB/UB B B LB UB Values 3 0 Initial value of objective is z = 0 3() = 3. x 3 enters the basis. The Min ratios columns correspond to variables leaving the basis: if the pivot is in the first constraint, x would leave the basis at its lower bound, and if the pivot is in the second constraint, x 2 would leave the basis at its upper bound. By the minimum ratio test, x 2 leaves the basis at its upper bound. Mitchell Handling Upper Bounds in Simplex / 8
Tableau for first iteration Tableaus x x 2 x 3 x 4 Min ratios 0 0 0 2 3 LB UB 6 0 3 3 3 0-2 UB 4 3 5 B/LB/UB B B LB UB Values 3 0 Initial value of objective is z = 0 3() = 3. x 3 enters the basis. The Min ratios columns correspond to variables leaving the basis: if the pivot is in the first constraint, x would leave the basis at its lower bound, and if the pivot is in the second constraint, x 2 would leave the basis at its upper bound. By the minimum ratio test, x 2 leaves the basis at its upper bound. Mitchell Handling Upper Bounds in Simplex / 8
Tableaus Tableau for second iteration x x 2 x 3 x 4 Min ratios 0 0 0 2 3 LB UB 3 6 0 3 3 0-2 R 2 then R 0 + 2R 2, R R 2 x x 2 x 3 x 4 2 0 2 0 5 0 0 2 UB 4 3 5 B/LB/UB B UB B UB Values 3 2 Value of objective is z = 2 2(3) + () = 7. Basics: x = 5 x 2 x 4 =, x 3 = + x 2 2x 4 = 2. Mitchell Handling Upper Bounds in Simplex 2 / 8
Tableaus Graphing the second pivot x 4 x 3 + 2x 4 =, x 2 = 0 x 3 + 3x 4 = 2, x = 4 x 4 = contour x 3 + 2x 4 = 4, x 2 = 3 x 3 + 3x 4 = 6, x = 0 x x 2 x 3 x 4 2 0 2 0 5 0 0 2 UB 4 3 5 B/LB/UB B UB B UB Values 3 2 0 2 3 4 5 x 3 Mitchell Handling Upper Bounds in Simplex 3 / 8
Tableaus Graphing the second pivot x 4 x 3 + 2x 4 =, x 2 = 0 contour x 3 + 3x 4 = 2, x = 4 simplex direction: decrease x 4, keep x 2 = 3 x 3 + 2x 4 = 4, x 2 = 3 x 3 + 3x 4 = 6, x = 0 x x 2 x 3 x 4 2 0 2 0 5 0 0 2 UB 4 3 5 B/LB/UB B UB B UB Values 3 2 0 2 3 4 5 x 3 Mitchell Handling Upper Bounds in Simplex 3 / 8
Tableaus Graphing the second pivot x 4 x 3 + 2x 4 =, x 2 = 0 0 contour x 3 + 3x 4 = 2, x = 4 simplex direction: decrease x 4, keep x 2 = 3 x 3 + 2x 4 = 4, x 2 = 3 x 4 = 0 x 3 + 3x 4 = 6, x = 0 2 3 4 5 x x 2 x 3 x 4 2 0 2 0 5 0 0 2 UB 4 3 5 B/LB/UB B UB B UB Values 3 2 x 3 Mitchell Handling Upper Bounds in Simplex 3 / 8
Making the second pivot Tableaus x x 2 x 3 x 4 Min ratios 2 0 2 0 LB UB 5 0 4 5 2 0 2 2 UB 4 3 5 B/LB/UB B UB B UB Values 3 2 x 4 enters the basis and decreases. Thus, x and x 3 increase. Simplex direction: We are decreasing x 4, so the changes in the basic variables are given by the entries in the x 4 column of the tableau. Direction is x = (, 0, 2, ) T. Mitchell Handling Upper Bounds in Simplex 4 / 8
Choosing the steplength x x 2 x 3 x 4 = Tableaus 3 2 + t 0 2 The value of the minimum ratio for the basic variables x and x 3 is 2.5, which would drive x 3 to its upper bound of 5. The incoming basic variable also provides an upper bound on the maximum possible step length. Since we require x 4 0, the step length must be. Thus, the pivot is to keep x 4 nonbasic, but switch it from being nonbasic at its upper bound to nonbasic at its lower bound. This changes the value of the basic variables x and x 3. Mitchell Handling Upper Bounds in Simplex 5 / 8
Tableaus Tableau for third iteration This tableau is in optimal form. x x 2 x 3 x 4 2 0 2 0 5 0 0 2 UB 4 3 5 B/LB/UB B UB B LB Values 2 3 4 0 Optimal value of objective is z = 2 2(3) + (0) = 8. Basics: x = 5 x 2 x 4 = 2, x 3 = + x 2 2x 4 = 4. x 2 is at its upper bound, and decreasing x 2 will increase the objective function value. x 4 is at its lower bound, and increasing x 4 will increase the objective function value. Mitchell Handling Upper Bounds in Simplex 6 / 8
Tableaus The iterations of the algorithm x 4 x 3 + 3x 4 = 6, x = 0 x 3 + 3x 4 = 2, x = 4 x 3 + 2x 4 = 4, x 2 = 3 x 3 + 2x 4 =, x 2 = 0 0 optimal contour 2 3 4 5 x 3 Mitchell Handling Upper Bounds in Simplex 7 / 8
Tableaus Summary Advantage of this approach: The reduction in the linear algebra per iteration is notable: we only need m basic variables; we d need m + n if we used explicit slack variables. So the pivot matrices are far smaller. Each iteration requires checking each of the m basic variables against one of its bounds. This is perhaps cumbersome to do when working an example by hand, but it s easy to automate in a computer code. Mitchell Handling Upper Bounds in Simplex 8 / 8