360 likes | 725 Views
Lecture 9 The Revised Simplex Algorithm. Problem Statement: Min cx Subject to Ax = b x > 0 Alg 5C Page 236 0. Initialization Select any starting basic feasible solution. Partition the variables into basic and nonbasic variables (BASIC, NONBASIC). Simplex Algorithm.
E N D
Lecture 9 The Revised Simplex Algorithm • Problem Statement: • Min cx • Subject to Ax = b • x > 0 • Alg 5C Page 236 • 0. Initialization • Select any starting basic feasible solution. Partition the variables into basic and nonbasic variables (BASIC, NONBASIC).
Simplex Algorithm • Then Ax = b is partitioned into • BxB + NxN = b. • Let xB = B-1b and xN = 0. • This is the starting solution. • Pricing • Solve vB = cB. That is v = cBB-1. The vector cB has elements of the cost coefficients corresponding to the basic variables. This is original data. • Calculate the reduced costs (actually directional derivatives)
Simplex Algorithm • cbarj = cj – vaj for each xj NONBASIC where aj is column j of the matrix A. • Note that cj and aj are original data. • 2. Check Optimality • If cbarj> 0 for all xj NONBASIC, then stop, xB is optimal. Otherwise, let the entering variable • xp NONBASIC be any one with cbarj < 0.
Simplex Alg • 3. Simplex Direction • Solve By = ap (ap is the pth col of A) • That is, y = B-1ap • Aside: Suppose BASIC = {x2, x3,x5} and • NONBASIC = {x1,x4,x6,x7} and p is 4. Hence, x4 is going to move from NONBASIC to BASIC. Suppose y = [1, -2, 0.5]. What is the direction of improvement? Answer d = [0, -1, 2, 1, -0.5, 0, 0]. • All nonbasics are 0 except p which is 1. All basics have –yj.
Simplex Alg • Why does this work? BxB + NxN = b holds. • New Point = [XB,XN] = [xB, xN] + d • = [xB- y, xN+ ep] • where ep is a vector of all 0s except a 1 in position p • BXB + NXN = B[xB - y] + N[xN+ ep] • = BxB - By + NxN+ Nep
Simplex Alg • = b - By + NxN + Nep • = b –B(B-1ap) + 0 + ap = b - ap + ap = b • That is, the new point satisfies Ax = b. • We need to worry about the new point satisfying • x > 0. • End Of Aside
Simplex Alg • 4. Step Size • XB = xB - y > 0 • y < xB • < xBi / yi for all yi > 0 If yi< 0 for all i, then the solution is unbounded.
Simplex Alg • 5. New Point • [XB,XN] = [xB - , xN + ep] • Reset BASIC and NONBASIC and return to step 1.
Example #1 • Minimize –2x1 – x2 • Subject to x1 + x2< 6 • x1< 5 • x2< 5 • x1> 0, x2> 0
Standard Form • Minimize -2x1 – x2 • Subject to x1 +x2 +x3 = 6 • x1 +x4 = 5 • x2 +x5 = 5 • All variables > 0 A = b =
0. Initialization • BASIC = {x3, x4, x5} NONBASIC = {x1, x2} B = B-1 =
0. Initialization Continued • xB = B-1b = = = xN = =
0. Initialization Continued • Where are we? • What space are we working in? R? x2 x4 x5 x3 x1
1. Pricing • v = cBB-1 = = cbar1 = c1 – va1 = -2 - = -2
1. Pricing Continued • cbar2 = c2 – v a2 = -1 - = -1 NOTE: We are minimizing and we found one directional derivative of –2 and another of –1. This is good!
2. Check Optimality • Not all cbar > 0, therefore not optimal. • Let p = 1. • (Could we let p = 2 at this stage in the algorithm?)
3. Simplex Direction • y = B-1a1 = = Direction of movement in R5 is d = [1, 0, -1, -1, 0] Corresponding to [x1, x2, x3, x4, x5]
3. Simplex Direction Continued • Note: Ax = b for the current x. If we let X = x + d to get a new point, then AX = b also. • Try it for = 4. • X = = + 4
Simplex Direction Continued • Let us substitute X = [4,0,2,1,5] into AX = b = Checks
4. Step Size • y = xB = Is the minimum of [6/1, 5/1] = 5
5. New Point • BASIC = {x3,x4,x5} NONBASIC = {x1,x2} • [XB | XN] = [xB - y | xN + ep] • = [6,5,5] – 5[1,1,0] | [0,0] + 5[1,0] = [1,0,5] | [5,0] Or x1 = 5, x2 = 0, x3 = 1, x4 = 0, x5 = 5
5. New Point Continued • Check AX = b Checks
5. New Point Continued • Where are we now? • x1 = 5, x2 = 0 BASIC = {x1, x3, x5}, NONBASIC = {x2, x4}
1. Pricing B = B-1 = Checks B-1b = =
1. Pricing Continued • v = cBB-1 = = cbar2 = c2 - = -1=0 = -1 x2 prices favorably
1. Pricing Continued • cbar4 = c4 - = 0 + 2 = 2 x4 prices unfavorably!!!!!!!!!!!!!
2. Check Optimality • Not Optimal – let p = 2 • That is nonbasic variable x2 at the current value of 0 will be allowed to increase.
3. Simplex Direction • y = B-1a2 = = Basic var Can you give the direction vector d for this step? d = [ _, _, _, _, _]
4. Step Size • y < xB < = min [1/1, 5/1] = 1
5. New Point • [XB | XN] = [xB - y | xN + e2] • xB - y = [5, 1, 5] – 1[0, 1, 1] = [5, 0, 4] for [x1, x3, x5] • x2 = = 1, and x4 remains at 0 • New Solution: Checks
5. New Point Continued • Where are we now? BASIC = {x1=5, x2=1,x5=4} NONBASIC = {x3=0, x4=0}
1. Pricing • B = B-1 = v = cBB-1 = =
1. Pricing Continued • cbar3 = c3 – va3 = 0 – • cbar4 = c4 – va4 = 0 - = 1 = 1
2. Check Optimality • O P T I M A L ! ! ! ! !