INDR 262 Introduction to Optimization Methods STARTING SOLUTION AND CONVERGENCE Simplex Method: Simple method starts from an initial basic feasible solution. min z = cx st. Ax ≤ b x≥0 If b ≥ 0 Add slacks xs to each constraint: Ax + xs = b x, xs ≥ 0 Therefore, an initial basic feasible solution can be easily obtained when we have only Ax ≤ b in the set of constraints. Question: What happens if b is not nonnegative Ax≥b and x≥0, b must be nonnegative for a feasible solution. Add artificial variables, xa to negative rows (or rows without a designated basic variable). How to eliminate artificial variables? Artificial variables should be 0. Two methods for solving problems without an initial basic feasible solution: 1. The big-M method 2. Two – Phase method 1. The big-M Method max cx s.t. Ax=b x≥0 If an initial basic feasible solution is unknown, introduce the artificial variable xa: Ax+xa=b x, xa≥0 In order to eliminate artificial variables from the basis, introduce sufficiently large M (bigM) as cost coefficient of the artificial variables in the objective max z = cx - Mxa s.t. Ax + xa=b x, xa ≥ 0 2. The Two-Phase Method Phase I: Formulate the constraint of the LP problem as in the big-M method to secure an initial basic feasible solution. Next, find a basic solution of the resulting equation that minimizes the sum of the artificial variables. 1 Metin Turkay INDR 262 Introduction to Optimization Methods min z=xa s.t. Ax+xa=b x, xa ≥ 0 If the optimal solution is positive, the LP problem has no feasible solution. Otherwise, go to phase II. Phase II: Use the feasible solution obtained in Phase I as the initial basic feasible solution. Solve the LP problem with simplex method. Example: min z= subject to 3x1 +2x2 +4x3 2x1 3x1 x1 + x2 +3x3 = 60 +3x2 +5x3 ≥ 120 ≥ 0 x2 ≥ 0 x3 ≥ 0 Convert the minimization objective to maximization: min z = 3x1 +2x2 +4x3 max -z = -3x1 -2x2 -4x3 a) Solution by the Big M method. Rewrite the problem introducing slack (x4) and artificial variables (x5, x6): max -z= (0) -z +3x1 +2x2 +4x3 +Mx5 +Mx6 = 0 (1) 2x1 + x2 +3x3 + x5 = 60 (2) 3x1 +3x2 +5x3 -x4 + x6 = 120 Since the artificial variables x5 and x6 are basic, we must reorganize row 0 to have 0 reduced costs for these variables: New row 0 = Old row 0 – M*(row 1) – M*(row 2) = [3 2 4 0 M M 0] – M*[2 1 3 0 1 0 60] – M*[3 3 5 -1 0 1 120] = [-5M+3 -4M+2 -8M+4 M 0 0 -180M] Iter 0 1 2 B.V. Eqn z x1 x2 x3 x4 x5 x6 RHS Z 0 -1 -5M+3 -4M+2 -8M+4 M 0 0 -180M x5 1 0 2 1 3 0 1 0 60 20 x6 2 0 3 3 5 -1 0 1 120 24 z 0 -1 ⅓M+⅓ -4/3M+⅔ 0 M /3M-4/3 0 -20M-80 x3 1 0 2/3 1/3 1 0 1/3 0 20 60 x6 2 0 -1/3 4/3 0 -1 -5/3 1 20 15 z 0 -1 ½ 0 0 ½ M- ½ M- ½ -90 x3 1 0 ¾ 0 1 ¼ ¾ -¼ 15 x2 2 0 -¼ 1 0 -¾ -5/4 ¾ 15 8 Ratio 2 Metin Turkay INDR 262 Introduction to Optimization Methods The optimal solution: x1* = 0, x2* = 15, x3* = 15, z* = 90 b) Solution by the Two-Phase method. Phase I: min z = x5 +x6 subject to 2x1 + x2 +3x3 +x5 3x1 +3x2 +5x3 -x4 +x6 x1, x2, x3, x4, x5, x6 Convert the minimization objective to maximization: min z= x5 +x6 max -z= -x5 -x6 (0) (1) (2) -z 2x1 3x1 + x2 +3x2 +3x3 +5x3 +x5 +x5 = 60 = 120 ≥ 0 +x6 -x4 = 0 = 60 = 120 +x6 Since the artificial variables x5 and x6 are basic, we must reorganize row 0 to have 0 reduced costs for these variables: New row 0 = Old row 0 – 1*(row 1) – 1*(row 2) = [0 0 0 0 1 1 0] – 1*[2 1 3 0 1 0 60] – 1*[3 3 5 -1 0 1 120] = [-5 -4 -8 1 0 0 -180] Iter 0 1 2 B.V. Eqn z x1 x2 x3 x4 x5 x6 RHS Ratio z 0 -1 -5 -4 -8 1 0 0 -180 x5 1 0 2 1 3 0 1 0 60 20 x6 2 0 3 3 5 -1 0 1 120 24 z 0 -1 ⅓ -4/3 0 1 8 /3 0 -20 x3 1 0 2/3 1/3 1 0 1/3 0 20 60 x6 2 0 -1/3 4/3 0 -1 -5/3 1 20 15 z 0 -1 0 0 0 0 1 1 0 x3 1 0 ¾ 0 1 ¼ ¾ -¼ 15 x2 2 0 -¼ 1 0 -¾ -5/4 ¾ 15 Phase II: Rewrite the optimization model by, • dropping the artificial variables x5 and x6 • using the original objective function min z = 3x1 +2x2 +4x3 s.t. ¾x1 +x3 +¼x4 =15 -¼x1 + x2 -¾x4 =15 x1, x2, x3, x4 ≥ 0 3 Metin Turkay INDR 262 Introduction to Optimization Methods Convert the minimization objective to maximization: min z= 3x1 +2x2 +4x3 max -z= -3x1 -2x2 -4x3 max -z= s.t. -3x1 -2x2 -4x3 ¾x1 + x3 +¼x4 =15 -¼x1 + x2 -¾x4 =15 x1, x2, x3, x4 ≥ 0 (0) (1) (2) -z +3x1 +2x2 +4x3 = 0 ¾x1 + x3 +¼x4 =15 -¼x1 + x2 -¾x4 =15 Since the variables x2 and x3 are basic, we must reorganize row 0 to have 0 reduced costs for these variables: New row 0 = Old row 0 – 4*(row 1) – 2*(row 2) = [3 2 4 0 0] – 4*[¾ 0 1 ¼ 15] – 2*[-¼ 1 0 –¾ 15] = [½ 0 0 ½ -90] Iter 0 B.V. Eqn z x1 x2 x3 x4 RHS z 0 -1 ½ 0 0 ½ -90 x3 1 0 ¾ 0 1 ¼ 15 x2 2 0 -¼ 1 0 -¾ 15 The optimal solution: x1* = 0, x2* = 15, x3* = 15, z* = 90 4 Metin Turkay INDR 262 Introduction to Optimization Methods Analysis of the big-M Method max z = cx - Mxa s.t. Ax + xa = b x, xa ≥ 0 Optimal solution is found x*≥0, xa*=0 Artificial values have all 0 values. The solution is optimal. x*≥0, xa*≠0 Some of the artificial variables are nonzero. The solution is infeasible The problem is unbounded. zk–ck = min (zj–cj)>0, yk≤0 x*≥0, xa*=0 Unbounded x*≥ 0, xa*≠0 Infeasible 5 Metin Turkay INDR 262 Introduction to Optimization Methods Degeneracy When there is a tie in the minimum ratio test for determining the leaving variable, one or more of the basic variables will be zero in the next iteration, the new solution is called a degenerate solution. → The model has at least one redundant constraint. Ex : max z = 3x1 + 9x2 s.t. x1 + 4x2 ≤ 8 x1 + 2x2 ≤ 4 x1, x2 ≥ 0 Initial Simplex Tableau: xB z x3 x4 x1 -3 1 1 x2 -9 4 2 x3 0 1 0 x4 0 0 1 RHS 0 8 4 x3 leaves x2 enters xB z x2 x4 z 0 0 0 x1 -3/4 1/4 1/2 xB z x2 x1 z 1 0 0 x1 0 0 1 x2 0 1 0 x3 9/4 1/4 -1/2 x4 0 0 1 RHS 18 2 0 x4 leaves x1 enters Implications of degenerate solutions: x2 0 1 0 x3 3/2 1/2 -1 x4 3/2 -1/2 2 RHS 18 2 0 a) cycling b) circling 6 Metin Turkay INDR 262 Introduction to Optimization Methods Unbounded Solutions: In some LP models, the values of the variables may be increased indefinitely without violating any of the constraint. This condition is called unsoundness. Ex: max s.t. z = x1 + 2x2 x1 - x2 ≤ 10 2x1 ≤ 40 x1, x2 ≥ 0 xB z x3 x4 z 1 0 0 x1 -1 1 2 x2 -2 -1 0 x3 0 1 0 x4 0 0 1 RHS 0 10 40 Observations: • x2 is selected as the entering basic variable since it has the most negative row-0 coefficient • x3 cannot leave the basis because a12 is -1 indicating that the value of the entering basic variable, x2, should decrease which is not possible since the current value of x2 which is a nonnegative variable is 0; decreasing x2 further will make the solution infeasible • x4 cannot leave the basis because a12 is 0 indicating that the value of the entering basic variable, x2, can increase to infinity without violating this constraint Therefore, this problem is unbounded. 7 Metin Turkay INDR 262 Introduction to Optimization Methods Example 1: min z= 4x1 s.t. 3x1 4x1 x1 x1, + x2 + x2 +3x2 +2x2 x2 =3 ≥6 ≤4 ≥0 First introduce the slack variables: min z= 4x1 + x2 s.t. 3x1 + x2 4x1 +3x2 –x3 x1 +2x2 +x4 x1, x2, x3, x4 =3 =6 =4 ≥0 No initial basis, introduce artificial variables. a) big-M Method: min s.t. z= 4x1 3x1 4x1 x1 x1, + x2 +Mx5 +Mx6 + x2 + x5 =3 +3x2 –x3 + x6 = 6 +2x2 +x4 =4 x2, x3, x4, x5, x6 ≥ 0 xB z x5 x6 x4 Eqn 0 1 2 3 z 1 0 0 0 x1 -4 3 4 1 x2 -1 1 3 2 x3 0 0 -1 0 x5 -M 1 0 0 x6 -M 0 1 0 x4 0 0 0 1 RHS 0 3 6 4 Eliminate inconsistency in basic variable x5 and x6. Multiply each row whose basic variable is an artificial variable by the negative of its row-0 entry and add to row-0: New row 0: Old row 0: +M*row 1: +M*ow 2: New row 0= xB z x5 x6 x4 Old row 0 +M*row 1 -4 -1 0 3M M 0 4M 3M -M -4+7M -1+ 4M -M Eqn 0 1 2 3 z 1 0 0 0 x1 7M-4 3 4 1 +M*row 2 -M -M 0 M 0 0 0 M 0 0 0 0 x2 4M-1 1 3 2 x3 -M 0 -1 0 | 0 |3M |6M |9M x5 0 1 0 0 x6 0 0 1 0 x4 0 0 0 1 RHS 9M 3 6 4 Ratio 1 3/2 4 8 Metin Turkay INDR 262 Introduction to Optimization Methods Entering Variable: x1 has the most positive coefficient in row-0. Leaving Variable: minimum ratio test → x5 is the leaving basic variable xB z x1 x6 x4 Eqn 0 1 2 3 z 1 0 0 0 x1 0 1 0 0 x2 1/3(5M+1) 1/3 5/3 5/3 x3 -M 0 -1 0 x5 -1/3(7M+4) 1/3 -4/3 -1/3 x6 0 0 1 0 x4 0 0 0 1 RHS 2M+4 1 2 3 Ratio 3 6/5 9/5 Entering Variable: x2 has the most positive coefficient in row 0. Leaving Variable: minimum ratio test → x6 is the leaving basic variable xB z x1 x2 x4 Eqn 0 1 2 3 z 1 0 0 0 x1 0 1 0 0 x2 0 0 1 0 x3 -1/5 1/5 -3/5 1 x5 -M+8/5 3/5 -4/5 1 x6 -M-1/5 -1/5 3/5 -1 x4 0 0 0 1 RHS 18/5 3/5 6/5 1 b) Two-Phase Method: Phase I: min z0 = x5 +x6 s.t. 3x1 + x2 +x5 =3 4x1 +3x2 –x3 +x6 = 6 x1 +2x2 +x4 =4 x1, x2, x3, x4, x5, x6 ≥ 0 xB z0 x5 x6 x4 Old z0–row : 0 +1*x5–row : 3 +1*x6–row : 4 New z0 – row : 7 0 1 3 4 xB z0 x5 x6 x4 z0 1 0 0 0 0 0 -1 -1 z0 1 0 0 0 x1 0 3 4 1 -1 1 0 x2 0 1 3 2 -1 0 1 0 x1 7 3 4 1 x3 0 0 -1 0 0 | 0 | 0 | 0 x2 4 1 3 2 x5 -1 1 0 0 x6 -1 0 1 0 x4 0 0 0 1 RHS 0 3 6 4 x6 0 0 1 0 x4 0 0 0 1 RHS 9 3 6 4 0 3 6 0 | 9 x3 x5 -1 0 0 1 -1 0 0 0 9 Metin Turkay INDR 262 Introduction to Optimization Methods → Simplex Method: Optimal Solution for the Phase I problem xB z0 x1 x2 x4 z0 0 0 0 0 x1 0 1 0 0 x2 0 0 1 0 x3 0 1/5 -3/5 1 x5 -1 3/5 -4/5 1 x6 -1 -1/5 3/5 -1 x4 0 0 0 1 RHS 0 3/5 6/5 1 → Optimal Solution with z0 = 0 → Continue with Phase II. Phase II: min s.t. Delete artificial variables and use the optimal solution in Phase I as the LP problem: z= 4x1 +x2 x1 +1/5x3 = 3/5 x2 -3/5x3 = 6/5 x3 +x4 = 1 x1, x2, x3, x4 ≥ 0 xB z x1 x2 x4 z 1 0 0 0 x1 -4 1 0 0 x2 -1 0 1 0 x3 0 1/5 -3/5 1 x4 0 0 0 1 RHS 0 3/5 6/5 1 x1 and x2 have nonzero coefficients in the row-0, they must be substituted out. Old row-0 : -4 +4*x1–row : 4 +1*x2–row : 0 New row – 0 : 0 -1 0 1 0 4/5 -3/5 0 1/5 0 | 0 0 | 12/5 0 | 6/5 0 | 18/5 z 1 0 0 0 x1 0 1 0 0 → Initial simplex tableau: xB z x1 x2 x4 x2 0 0 1 0 x3 1/5 1/5 -3/5 1 x4 0 0 0 1 RHS 18/5 3/5 6/5 1 Continue until finding the optimal solution! 10 Metin Turkay