Itroductio to Optiizatio, DIKU 007-08 Moday 9 Noveber David Pisiger Lecture, Duality ad sesitivity aalysis Duality, shadow prices, sesitivity aalysis, post-optial aalysis, copleetary slackess, KKT optiality coditio, CPLEX sesitivity Taha sectio.6.,.,.,.,.5 all exaples ca be read briefly Duality, otivatio Lookig for a upper boud o LP: axiize x + x subject to x + x x + x 5 x,x 0 Multiply secod costrait by two gives upper boud 0 x + x 0 Add first ad secod costrait gives upper boud 9 x + x 9 Liear cobiatio of costraits rewritte to Dual proble y (x + x )+y (x + x ) y + 5y (y + y )x +(y + y )x y + 5y iiize y + 5y subject to y + y y + y y,y 0 Duality Prial proble Dual proble ax j= c j x j s.t. j= a i j x j b i i =,..., x j 0 j =,..., i i= b i y i s.t. i= a i j y i c j j =,..., y i 0 i =,..., Strog duality For every bouded, feasible LP with prial solutio x, there exists dual feasible y such that j= c j x j = Proof: Show at VA course. i= b i y i Weak duality For every prial feasible x, dual feasible y Proof j= c j x j j=( i= j= c j x j a i j y i )x j = i= b i y i i=( j= a i j x j )y i i= b i y i If x prial feasible, y dual feasible, j= c j x j = i= b i y i the x is prial optial, ad y is dual optial.
Dualizatio (Taha table.) Prial-Dual Relatio Maxiizatio proble Miiizatio Proble Costraits Variables 0 0 = urestricted Variables Costraits 0 0 urestricted = Exaple ax x + x + 5x s.t. 5x + x + x = 8 (y ) x + x + 8x (y ) 6x + 7x + x (y ) x (y ) x 0 x,x R Dual Optial Ifeasible Ubouded Optial Possible Ipossible Ipossible Prial Ifeasible Ipossible Possible Possible Ubouded Ipossible Possible Ipossible i 8y + y + y + y s.t. 5y + y + 6y + y = (x ) y + y + 7y = (x ) y + 8y + y 5 (x ) y 0 y 0 y 0 y R 5 6 Ecooic iterpretatio of Dual variables (Taha..) y i, dual variables, shadow prices, argial prices If costrait i express a liit o resource i the dual variable y i represets the worth per uit of resource i If prial proble ax j= c j x j s.t. j= a i j x j b i i =,..., x j 0 j =,..., has optial solutio value z. The ax j= c j x j s.t. j= a i j x j b i + ε i i =,..., x j 0 j =,..., Reddy Mikks Prial Dual ax z = 5x + x s.t. 6x + x (resource M) x + x 6 (resource M) x + x (arket) x (dead) x,x 0 i w = y + 6y + y + y s.t. 6y + y y 5 y + y + y + y y,y,y,y 0 has optial solutio value z + i= y i ε i The chages eed to be sufficiet sall, such that curret solutio reais optial Weak duality theore: su of profits su of worth of resources x = (, ) y = (,,0,0) z = 7 8
Reddy Mikks Copleetary slackess (Core probl. 9-) profit of icreasig M oe uit z G z C 6 = 0 = prial (P) ax cx s.t. Ax b x 0 dual (D) i yb s.t. ya c y 0 Assue x feasible to (P) ad y feasible to (D) Necessary ad sufficiet coditios for x,y to be optial: ( j= a i j x j = b i or y i = 0) for i =,..., ad ( i= a i j y i = c j or x j = 0) for j =,..., Ecooical iterpretatio profit of icreasig M oe uit z C z B 6 9 = 0 = j= a i j x j < b i y i = 0 If resource b i is ot fully used, the o additioal profit ca be obtaied by icreasig the resource (i.e. y i = 0). i= a i j y i > c j x j = 0 If costs of resources for producig ite j exceed sellig cost, the we should ot produce ite j (i.e. x j = 0). 0 KKT optiality coditio Karush-Kuh-Tucker optiality coditio for geeral o-liear costraied iiizatio proble For LP-probles ax cx s.t. Ax b x 0 the KKT optiality coditio becoes Ax b, x 0 (prial feasible) ya c, y 0 (dual feasible) i yb s.t. ya c y 0 y(ax b) = 0, x(c ya) = 0 (copleetary slack) Fidig the dual variables if the ith costrait is a iequality the the y i will appear i the colu associated with the correspodig slack variable. if the ith costrait is a iequality the the absolute value of y i will appear i the colu associated with the correspodig surplus variable. Exaple, Reddy Mikks Iteratio 0: Iteratio : y = (,,0,0) basic z x x x x x 5 x 6 solutio z 5 0 0 0 0 0 x 0 6 0 0 0 x 0 0 0 0 6 x 5 0 0 0 0 x 6 0 0 0 0 0 basic z x x x x x 5 x 6 solutio z 0 0 0 0 x 0 0 0 0 x 0 0 0 8 0 0 x 5 0 0 0 8 5 5 0 x 6 0 0 8 0
Whe Siplex teriates Fidig the dual variables i geeral Assue that proble is bouded ad feasible. Whe siplex teriates we have solutio value objective fuctio reduced costs basis equatios z = c B A B b z+(c B A B A N c N )x N = (c B A B )b c = c B A B A N c N 0 x B + A B A Nx N = A B b oegativity of all variables x 0 (P) ax cx s.t. Ax = b x 0 (D) i yb s.t. ya c Assue that x is a optial solutio. The dual variables ca be foud as y = c B A B Let y = c B A B, verify strog duality theore: yb = c B A B b = z ya = c B A B A = c B A B (A B A N = ( c B c B A B A ) N (c B c N ) = c sae solutio dual feasible Uderstadig Siplex Tableau (Taha..) Optial Dual Solutio (Taha..) Method ( Optial ) value ( ) Optial prial z-coefficiet of of dual variable y i = startig variable x i + origial objective coefficiet x i z+(c B A B A N c N )x N + (c B A B I d) s = (c BA B )b ax cx+ds s.t. Ax+Is = b x,s 0 basic solutio i Siplex A B x B + A N x N + Is = b x B + A B A N A B s = A B b objective fuctio z+(c B A B A N c N )x N +(c B A B I d)s = (c BA B )b Method ( ) Optial values of dual = variables Row vector of origial objective coefficiets of optial prial basic variables y = c B A B ( ) Optial prial iverse 5 6
Exaple Sesitivity Aalysis (Taha.6) Prial ax z = 5x + x + x MR s.t. x + x + x + x = 0 x x + x + R = 8 x,x,x,x,r 0 Dual i w = 0y + 8y s.t. y + y 5 y y y + y y 0 y M Fial Siplex table basic x x x x R solutio 9 z 0 0 5 5 5 + M 5 5 x 0 5 5 5 5 7 6 x 0 5 5 5 5 Method y = 9 5 + 0 = 9 5, y = 5 + M +( M) = 5 Method (y,y ) = (,5)( 5 5 5 5 ) = ( 9 5, 5 ) Sesitivity Aalysis: fid liits of paraeters such that curret solutio reais optial Post-optial Aalysis: deterie ew optiu resultig fro targeted chages i iput data 7 8 Chages i the right-had side (Taha.6.) Let D i be chage to costrait i Add D i to right-had side Write up feasibility coditios for curret solutio to reai optial Deterie liits of D i for which curret solutio reais optial TOYCO odel ax z = x + x + 5x s.t. x + x + x 0 x + x 60 x + x 0 x,x,x 0 Fial Siplex table basic x x x x x 5 x 6 solutio z 0 0 0 50 x 0 0 00 x 0 0 0 0 x 6 0 0 0 Slack variables x,x 5,x 6, their coefficiets are dual variables y =,y =,y = 0 Feasibility Rage ax z = x + x + 5x s.t. x + x + x 0+D x + x 60+D x + x 0+D x,x,x 0 i atrix for after addig slack variables basic solutio i Siplex optial table Ax = b+d A B x B + A N x N = b+d x B + A B A Nx N = A B (b+d) x = 00+ D D x = 0+ D x 6 = 0 D + D + D Curret solutio reais feasible as log as x,x,x 6 0 9 0
Feasibility Rage Chages i the objective fuctio (Taha.6.) Chagig operatio tie fro 0 to 0+D x = 00+ D 0 x = 0 0 x 6 = 0 D 0 Iplyig 00 D 0 Chagig operatio tie fro 60 to 60+D Iplyig 0 D 00 Chagig operatio tie fro 0 to 0+D Iplyig 0 D Checkig feasibility of chage Checkig whether D = 0, D =, D = 0 feasible x = 00+ D D = 88 0 x = 0+ D = 0 x 6 = 0 D + D + D = 78 0 Let d i be chage to coefficiet c i Add d i to respective coefficiet Write up feasibility coditios for curret solutio to reai optial Deterie liits of d i for which curret solutio reais optial TOYCO odel ax z = x + x + 5x s.t. x + x + x 0 x + x 60 x + x 0 x,x,x 0 Fial Siplex table basic x x x x x 5 x 6 solutio z 0 0 0 50 x 0 0 00 x 0 0 0 0 x 6 0 0 0 Objective Fuctio ax z = (+d )x + (+d )x + (5+d )x s.t. x + x + x 0 x + x 60 x + x 0 x,x,x 0 Siplex algorith, fids objective fuctio z+((c B + d B )A B A N (c N + d N )x N = ((c B + d B )A B )b Curret solutio reais optial as log as reduced costs are oegative for all obasis variables c N = (c B + d B )A B A N (c N + d N ) 0 reduced costs ca be rewritte c N = (c B+ d B )A B A N (c N + d N ) = c N + d B A B A N d N = c N + d B A N d N where A N is the cotets of the fial siplex table TOYCO odel Fial siplex table with d-values at appropriate places d d d 0 0 0 basic x x x x x 5 x 6 solutio z 0 0 0 50 d x 0 0 00 d x 0 0 0 0 0 x 6 0 0 0 curret solutio reais optial as log as reduced costs c = d + d d 0 c = + d 0 c 5 = d + d 0 axiize z = (+d )x + x + 5x coditio d 0 0 0 givig < d axiize z = x +(+d )x + 5x givig < d 8 axiize z = x + x +(5+d )x givig 8 < d
Post-optiality aalysis (Taha.5) Post-optiality aalysis Periodic recalculatio of the optiu solutio. Post-optiality aalysis deteries the ew solutio i a efficiet way. Coditio after paraeters chage Curret solutio reais optial ad feasible Curret solutio becoes ifeasible Curret solutio becoes ooptial Curret solutio becoes ooptial ad ifeasible Recoeded actio No further actio ecessary Use dual siplex to recover feasibility Use prial siplex to recover feasibility Use geeralized siplex to obtai ew solutio TOYCO Exaple.5- ax z = x + x + 5x s.t. x + x + x 0 x + x 60 x + x 0 x,x,x 0 Solutio x = 0, x = 00, x = 0. Add costrait x + x + x 500 Redudat Add costrait x + x + x 500 Ru dual siplex 5 6 Dual Siplex Dual siplex starts fro (better tha) optial ifeasible basis solutio. Searches for feasible solutio. leavig variable: x r is the basic variable havig ost egative value. optiality criteria: if all basic variables are oegative eterig variable: obasic variable with a r j < 0 { } c i,a r j < 0 Exaple Siplex table a r j i z = x + x + x s.t. x x x x x x 6 x + x + x x,x,x 0 basic x x x x x 5 x 6 solutio z 0 0 0 0 x 0 0 x 5 0 0 6 x 6 0 0 7 All reduced costs c j 0. Ifeasible Leavig variable x 5 as 6 sallest. { } c i,a r j < 0 = i {, }, = a r j Eterig variable x Iteratio : basic x x x x x 5 x 6 solutio z 5 0 0 0 x 0 0 x 0 0 x 6 0 0 Leavig variable x Eterig variable { 5 i, }, = Iteratio : basic x x x x x 5 x 6 solutio z 0 0 9 0 0 x 0 x 0 0 0 0 x 6 0 0 0 0 Optial ad feasible 8
Sesitivity with CPLEX Sesitivity with CPLEX TOYCO exaple axiize x + x + 5 x subject to x + x + x <= 0 x + x <= 60 x + x <= 0 bouds x >= 0 x >= 0 x >= 0 ed Solutio Dual siplex - Optial: Objective =.500000000e+0 Solutio tie = 0.00 sec. Iteratios = () CPLEX> dis se obj - OBJ Sesitivity Rages Variable Nae Reduced Cost Dow Curret Up x -.0000 -ifiity.0000 7.0000 x zero zero.0000 0.0000 x zero. 5.0000 +ifiity CPLEX> dis se rhs - RHS Sesitivity Rages Costrait Nae Dual Price Dow Curret Up c.0000 0.0000 0.0000 0.0000 c.0000 0.0000 60.0000 860.0000 c zero 00.0000 0.0000 +ifiity CPLEX> dis sol var - Variable Nae Solutio Value x 00.000000 x 0.000000 All other variables i the rage - are zero. CPLEX> dis sol dua - Costrait Nae Dual Price c.000000 c.000000 All other dual prices i the rage - are zero. 9 0