1 5.7 Initialization Revisited Motivation: a solution for the transformed system is feasible for the original system if and only if all the artificial variables are equal to zero. Two methods are available for this purpose: Big M Two-Phase They look quite different but are essentially equivalent. Big M 2 Associate with each artificial variable a very unattractive cost coefficient (cj). Since we try to optimize the objective function, the optimal solution generated by such a model will make the artificial variables as small as possible. If the problem is feasible, the smallest feasible value of any artificial variable is zero. 3 Thus, if the problems is feasible, this approach will yield an optimal solution with all the artificial variables equal to zero. 4 Example max Z' 3x1 5 x2 Mx 5 M x 6 x x1 x4 2 x2 x5 4 12 3x1 2 x2 x 3 x 6 18 x1, x2 , x3 , x4 , x 5 , x 6 0 (5.41) BV 5 Eq. # x4 1 2 3 Z' x5 x6 Z' Initial x1 1 0 3 3 x2 0 2 2 5 x3 0 0 -1 0 x4 1 0 0 0 x5 x6 0 1 0 M 0 0 1 M tableau is not in canonical form: Have to set the reduced costs of the artificial variables to zero. We use (legal) row operations for this purpose. RHS 4 12 18 0 BV 6 Eq. # x4 1 2 3 Z' x5 x6 Z' BV Eq. # x4 x1 1 0 3 3 x2 0 2 2 5 x4 1 0 0 0 x3 0 0 -1 0 x1 x2 1 1 x5 x6 2 Z x5 x6 0 1 0 M 0 0 1 M RHS 4 12 18 0 x3 x4 x5 x6 RH S 0 0 1 0 0 4 0 2 0 0 1 0 12 3 3 2 - 1 0 0 1 18 Z - 3M + 3 - 4M +5 M 0 0 0 - 3 0M BV Eq. # x4 x3 x4 x5 x6 RH S 0 0 1 0 0 4 0 2 0 0 1 0 12 3 3 2 - 1 0 0 1 18 Z Z - 3M + 3 - 4M +5 M 0 0 0 - 3 0M BV Eq. # x4 x2 7 x1 x2 1 1 x5 x6 2 x1 x2 x3 x4 x5 x6 RH S 1 1 0 0 1 0 0 2 2 0 1 0 0 1 /2 0 6 x6 3 3 0 - 1 0 - 1 1 2 Z Z - 3M + 3 0 M 0 2 M - 5 /2 0 - 6M - 30 BV Eq. # x4 x2 x1 Z' x1 x2 x3 x4 x5 x6 RH S 1 0 0 1 /3 1 1 /3 - 1 /3 4 2 0 1 0 0 1 /2 0 6 3 1 0 - 1 /3 0 - 1/3 1 /3 6 Z' 0 0 1 0 M - 3 /2 M - 1 - 36 8BV Eq. # x4 x2 x1 Z' x1 x2 x3 x4 x5 x6 RH S 1 0 0 1 /3 1 1 /3 - 1 /3 4 2 0 1 0 0 1 /2 0 6 3 1 0 - 1 /3 0 - 1/3 1 /3 6 Z' 0 0 1 0 M - 3 /2 M - 1 - 36 Note that, as expected, all the artificial variables are nonbasic (thus equal to zero). The optimal solution is x=(6,6,0,4,0,0) 9 Once Remark an artificial variable is out of the basis, we never put it back into the basis. Thus, once an artificial variable is out of the basis, we can “ignore” its column. If you want to handle M numerically (i.e set it to a given value) make sure that it is not too large, but also not too small The Big M method is “not nice”. What happens if opt=min ? 10 2-Phase Method Phase 1: Find a basic feasible solution to the original problem (i.e. take the artificial variables out of the basis). Phase 2: Find an optimal solution to the original problem, ignoring the artificial variables. 11 Phase 1 Let w := sum of the artificial variables w* := minimum value of w subject to the constraints. Because the artificial variables must satisfy the nonnegativity constraint, w*=0 if and only if all the artificial variables are equal to zero. Thus, the goal in Phase 1 is to minimize w (regardless of what is the value of opt in the original problem) 12Case 1: w*>0 The problem is not feasible!!! (why!) Case 2: w*=0 and all the artificial variables are non-basic A basic feasible solution to the original problem has been generated. Continue with Phase 2. Case 3: w*=0, but at least one artificial variable is in the basis. Using pivot operations, take all the artificial variables out of the basis. 13 5.7.3 Example max Z ' 3x1 5x 2 x x1 x4 4 2x2 x5 12 3x1 2 x2 x 3 x 6 18 x1, x2 , x3 , x4 , x 5 , x 6 0 14 Phase 1 min w x 5 x 6 x1 x x4 2x2 x5 4 12 3x1 2 x2 x 3 x 6 18 x1, x2 , x3 , x4 , x 5 , x 6 0 15 BV x4 x5 x6 w Eq. # 1 2 3 w We x1 1 0 3 0 x2 0 2 2 0 x3 0 0 -1 0 x4 1 0 0 0 x5 0 1 0 -1 x6 0 0 1 -1 have to restore the canonical form (by legal row operations) RHS 4 12 18 0 16 BV Eq. # x1 x2 x3 x4 x5 x6 RH S x4 1 1 0 0 1 0 0 4 x5 2 0 2 0 0 1 0 12 x6 3 3 2 - 1 0 0 1 18 w w 0 0 0 0 - 1 - 1 0 BV Eq. # x4 x1 x2 x3 x4 x5 x6 RH S 1 1 0 0 1 0 0 4 x5 2 0 2 0 0 1 0 12 x6 3 3 2 - 1 0 0 1 18 w w 3 4 - 1 0 - 1 0 - 1 0 30 corrections!!! 17BV Eq. # x1 x2 x3 x4 x5 x6 RH S x4 x2 x6 1 1 0 0 1 0 0 4 2 0 1 0 0 1 /2 0 6 3 3 0 - 1 0 - 1 1 6 w w 3 0 - 1 0 - 2 0 6 x1 x2 x3 x4 x5 x6 RH S BV Eq. # x4 x2 x1 1 0 0 1 /3 1 1 /3 0 2 2 0 1 0 0 1 /2 0 6 3 1 0 - 1 /3 0 - 1/3 1 2 w w 0 0 0 0 - 1 0 0 End of Phase 1: All the artificial variables are out of the basis. Phase 2 18 BV Eq. # x4 x2 x1 w x1 x2 x3 x4 x5 x6 RH S 1 0 0 1 /3 1 1 /3 0 2 2 0 1 0 0 1 /2 0 6 3 1 0 - 1 /3 0 - 1/3 1 2 w 0 0 0 0 - 1 0 0 We now have to restore the original objective function: z’ = 3x1 5x2 BV Eq. # x4 x2 x1 Z' x1 x2 x3 x4 1 0 0 1/3 1 2 2 0 1 0 0 6 3 1 0 - 1 /3 0 2 Z' 3 0 0 1 0 - 36 5 0 x5 x6 RH S 0 BV 19 Eq. # x4 x2 x1 Z' x1 x2 x3 x4 1 0 0 1/3 1 2 2 0 1 0 0 6 3 1 0 - 1 /3 0 2 Z' 3 0 0 1 0 - 36 5 0 x5 x6 RH S 0 This is not in canonical form, so we use legal row operations to restore the canonical form. BV x4 x2 x1 Z' Eq. # 1 2 3 Z' x1 0 0 1 0 x2 0 1 0 0 x3 1/3 0 - 1/3 1 x4 1 0 0 0 x5 x6 RHS 2 6 2 - 36 20 Remark Read the material in the lecture notes concerning the relationship between the Big M method and the 2-Phase Method and make sure you understand why there are “equivalent” and why the 2 Phase Method is better. (end of section 5.7) 21 5.8 Algorithm Complexity Worst case is very bad In practice : surprisingly well!!!