SIMPLEX METHOD Geometric idea: Consider corner points only. - Start in a corner - Find an edge with maximal increase of the objective function - Find a better CP at the end of this edge - Stop if improvement is possible Practical implementation cannot be geometric, but must be algebraic Inqualities are not suitable for algebra! Start from the standard form: Max Z = c1x1 + c2x2 + … + cnxn s.t. a11x1 + a12x2 + … + a1nxn ≤ b1 a21x1 + a22x2 + … + a2nxn ≤ b2 … … … … … … … … am1x1 + am2x2 + … + amnxn ≤ bm and x1, x2 …, xn ≥ 0 Here all bi ≥ 0, so x1 = x2 = … = xn = 0 is a feasible starting solution (CPF). Rewrite all inequalities as equalities: x1 + 4x2 ≤ 17 ⇔ 0 ≤ 17 - x1 - 4x2 Introduce a new extra variable: x3 := 17 - x1 - 4x2 x1 + 4x2 ≤ 17 ⇔ x1 + 4x2 + x3 = 17 ∧ x3 ≥ 0 x3 is called slack variable. x3 indicates how “well” the inequality x1 + 4x2 ≤ 17 holds (x3 > 0) or does not hold (x3 < 0), e.g. how much the production is under or over its upper bound. For each ≤ inequality we get an extra non-negative (slackvariable. n variables with m constraints (≤) ⇒ n + m variables with m constraints (=) A feasible CP solution is called basic solution. In a corner point n (slack) variables are = 0, so we have a maximum of m positive variables. They are called the basic variables of that CP. Simplex method algebraically: 1 Starting solution: feasible basic solution. (= zero solution of the original problem) 2 Create a new basic solution that differs one basic variable: One non-basic variable becomes > 0 while one other basic variable becomes = 0. (This corresponds to walking to a new vertex along an edge of the feasibility region). The objective value must improve. The new solution is the feasible basic solution. 3 Continue with 2 until no improvement is possible. Stop. In an LP problem a local optimum is also global, so it is correct that the algorithm will stop. Standard example from the book: Wyndor Glass Co. In three factories doors with aluminum and wooden framings are constructed. Aluminum frames need 1 hour in factory 1 and 3 hours in plant 3 per batch, the profit is $3000. Wooden frames use 2 hours in plant 2 and 3 hours in factory 3 per batch, the profit is $5000. The plants have available for production: 4, 12, and 18 hours, respectively. LP model: Max s.t. Z = 3x1 + 5x2 x1 ≤ 2x2 ≤ 3x1 + 2x2 ≤ x1, x2 ≥ 0 4 12 18 (capacity plant 1) (capacity plant 2) (capacity plant 3) (quantities) Replace the inequalities by equalities (Augmented form): Max s.t. Z = 3x1 + 5x2 x1 + x3 = 2x2 + x4 = 3x1 + 2x2 +x5 = x1, x2, x3, x4, x5 ≥ 0 4 12 18 Simplex algorithm: Start with the origin of the original problem: (0, 0) → (0, 0, 4, 12, 18) (Initial Basic Feasible solution (BF)) Is this solution optimal? The “free” (non-basic) variables are x1 and x2. The objective function is Z = 3x1 + 5x2 and it increases if x1 or x2 increases. The increase is maximal for x2 (largest coefficient), so x2 must be increased How large can x2 become? Constraints: x3 = 4 – x1 x4 = 12 – 2x2 x5 = 18 – 3x1 – 2x2 x1 = 0, x2 must increase: x3 = 4 x4 = 12 – 2x2 x5 = 18 – 2x2 ≥0 ≥0 ≥0 ⇒ x2 ≤ 6 ⇒ x2 ≤ 9 Conclusion: x2 can be 6, maximal. In this case x4 = 0. Starting solution: after one iteration: (0, 0, 4, 12, 18) basis: x3, x4, x5 (0, 6, 4, 0, 6) basis: x3, x2, x5 What next? Z -3x1 - 5x2 x1 + x3 + x4 2x2 +x5 3x1 + 2x2 x1, x2, x3, x4, x5 ≥ 0 = = = = 0 4 12 18 Can the non-basic variables x1, x4 be increased? What is the effect on the objective function? Rewrite the system. Take care that the coefficient of x2 in the x4 equation becomes 1 and remove all other coefficients from the x2 column: Z -3x1 - 5x2 x1 2x2 3x1 + 2x2 Z -3x1 - 5x2 x1 x2 3x1 + 2x2 Z + x3 + ½ x4 + 5/2x4 -3x1 x1 + x3 x2 3x1 = + x3 = + x4 = +x5 = + ½ x4 - x4 0 4 12 18 = = = +x5 = 0 4 6 18 = = = +x5 = 30 4 6 6 Now it is clear that Z increases as a function of x1, decreases with x4. How far can x1 increase (if x4 = 0)? x3 = x2 = x5 = 4 - x1 ⇒ x1 ≤ 4 6 6 - 3x1 ⇒ x1 ≤ 2 Conclusion: x1 can be 2, maximal. Then x5 = 0. New BF solution is (2, 6, 2, 0, 0), basis: x3, x2, x1 Next iteration: rewrite the system: Z + 5/2x4 -3x1 x1 + x3 + ½ x4 - x4 x2 3x1 = = = +x5 = 30 4 6 6 becomes: Z + 5/2x4 x1 + ½ x4 - 1/3x4 +1/3x5 = = = = 30 4 6 2 x1 + 3/2x4 + x5 x3 + 1/3x4 - 1/3x5 + ½ x4 - 1/3x4 +1/3x5 = = = = 36 2 6 2 -3x1 x1 + x3 x2 Z x2 The objective function now decreases if x4 or x5 are increased. Local optimum = global optimum. BF solution is (2, 6, 2, 0, 0), so x1 = 2, x2 = 6, Z = 36 Simplex method in tabular form