set t period /1*3/ i parts /i1,i2/; parameters MC capaciy /300/ DC capaciy/1000/ AC capaciy/500/ RC capaciy/500/ r(i) space in R /i1 20, i2 5/ a(i) number of part i in a product /i1 1, i2 4/; parameter it(t) totalt u(t); totalt=card(t); it(t)=ord(t)-1; u(t)=uniform(0,1);; Scalar d /0.3/ b /0.2/ c /0.8/ z1/1.65/ z2/1.65/ alpha/0.4/ beta/0.3/ gamma/0.4/; POSITIVE variable MO(i,t) 'part i purchased from external at the beginning of period t' MP(t) 'product produced at mfg at the beginning of period t' DD(t) 'DC demand at the beginning of period t' CR(t) 'returned product shipped to CC at the beginning of period t' CU(t) 'reused product shipped to DC at the beginning of period t' CA(t) 'returned product shipped to A at the beginning of period t' AP(t) 'disassembling at the beginning of period t' AR(i,t) 'disassembled part i shipped to R at the beginning of period t' RP(i,t) 'refurbished part i quantities produced at the beginning of period t' RQ(i,t) 'refurbished part i shipped to mfg.' MU(t) 'produce up to level at the beginning of period t' DU(t) 'order up to level at the beginning of period t' MI(i,t) 'part i inventory at mfg at the beginning of period t' MIP(t) 'positive product inventory at mfg at the beginning of period t' MIN(t) 'negative product inventory at mfg at the beginning of period t' DIP(t) 'positive product inventory at DC at the beginning of period t' DIN(t) 'negative product inventory at DC at the beginning of period t' AI(t) 'product inventory at disassembly center at the beginning of period t' RI(i,t) 'part i inventory at refurbishing center at the beginning of period t' MT(t)'trend equation for DC' ML(t)'level equation for DC' MF(t)'forecasting for DC' DT(t)'trend equation for customer' DL(t)'level equation for customer' DF(t)'forecasting for customer' X(t) total avgX sumofall Xvariable avgq sumofallq DCvariable avgin sumofallin INvariable BWE orderbwe invenbwe free variable z; equation E_MO(i,t) 'part i purchased from external at the beginning of period t' E_MP(t) 'product produced at mfg at the beginning of period t' E_MP2(t) E_DD(t) 'demand for DC' E_DO2(t) E_CR(t) 'returned product shipped to CC at the beginning of period t' E_CU(t) 'reused product shipped to DC at the beginning of period t' E_CA(t) 'returned product shipped to A at the beginning of period t' E_AP(t) 'disassembling at the beginning of period t' E_AP2(t) E_AR(i,t) 'disassembled part i shipped to R at the beginning of period t' E_RP(i,t) 'refurbished part i quantities produced at the beginning of period t' E_RP2(i,t) E_RQ(i,t) 'refurbished part i shipped to mfg.' E_MU(t) 'produce up to level at the beginning of period t' E_DU(t) 'order up to level at the beginning of period t' E_MI(i,t) 'part i inventory at mfg at the beginning of period t' E_MIP(t) 'product inventory at mfg at the beginning of period t' E_DI(t) 'product inventory at DC at the beginning of period t' E_AI(t) 'product inventory at A at the beginning of period t' E_RI(i,t) 'part i inventory at R at the beginning of period t' E_MF(t)'forecasting demand for DC' E_MT(t)'trend equation of forecasting for DC' E_ML(t)'level equation of forecasting for DC' E_DF(t)'forecasting demand for customer' E_DT(t)'trend equation of forecasting for customer' E_DL(t)'level equation of forecasting for DC' E_X(t) varX1'sum of all demand' varX2'total number of t' varX3'avg. demand' varX4'variable of demand' varq1'sum of all demand' varq2'avg. demand from DC' varq3'variable of DC demand' varin1'sum of all inventory' varin2'avg. inventory from DC' varin3'variable of DC inventory' E_BWE E_ORDERBWE E_INVENBWE obj'objective function'; E_MP(t)..MP(t)=l=MU(t)-(MIP(t)- MIN(t)); E_MP2(t)..MP(t)=l=MC; E_MI(i,t)..MI(i,t+1)=e=MI(i,t)+MO(i,t)+RQ(i,t-1)-a(i)*MP(t); E_MU(t)..MU(t)=e=MF(t)+z1*(MF(t-1)- DD(t-1)); E_MO(i,t)..MO(i,t)=e=a(i)* MP(t)- RQ(i,t-1)- a(i)*(MIP(t)- MIN(t)); E_MIP(t)..(MIP(t+1)-MIN(t+1))=e=(MIP(t)-MIN(t))+MP(t)-DD(t); E_ML(t)..ML(t)=e=(1-alpha)*MF(t)+alpha*DD(t); E_MT(t)..MT(t)=e=MT(t-1)+beta*(MF(t)-MF(t-1)-MT(t-1)); E_MF(t)..MF(t+1)=e=ML(t)+MT(t); E_DD(t)..DD(t)=l=DC-CU(t-1); E_DO2(t)..DD(t)=l=DU(t)-(DIP(t)- DIN(t))-CU(t-1); E_DU(t)..DU(t)=e=DF(t)+z2*(DF(t-1)-X(t-1)); E_DI(t)..(DIP(t+1)-DIN(t+1))=e=(DIP(t)-DIN(t))+DD(t)+CU(t)-X(t); E_DL(t)..DL(t)=e=(1-alpha)*DF(t)+alpha*X(t); E_DT(t)..DT(t)=e=DT(t-1)+beta*(DF(t)-DF(t-1)-DT(t-1)); E_DF(t)..DF(t+1)=e=DL(t)+DT(t); E_CR(t)..CR(t)=e=b*X(t); E_CU(t)..CU(t+1)=e=d*CR(t); E_CA(t)..Ca(t+1)=e=(1-d)*CR(t); E_AI(t)..AI(t+1)=e=AI(t)+CA(t)-AP(t); E_AR(i,t)..AR(i,t)=e=c*a(i)*AP(t-1); E_AP(t)..AP(t)=l=AI(t)+CA(t); E_AP2(t)..AP(t)=l=AC; E_RI(i,t)..RI(i,t+1)=e=RI(i,t)+AR(i,t)-RP(i,t); E_RP(i,t)..RP(i,t)=l=RI(i,t)+AR(i,t); E_RP2(i,t)..r(i)*RP(i,t)=l=RC; E_RQ(i,t)..RQ(i,t+1)=e=RP(i,t); varX1..sumofall=E=sum(t,X(t)); varX2..total=e=totalt; varX3..avgX=e=(sumofall/totalt); varX4..Xvariable=e=sum(t,sqr(X(t)-avgX))/totalt; varq1..sumofallq=e=sum(t,DD(t)); varq2..avgq=e=(sumofallq/totalt); varq3..DCvariable=e=sum(t,sqr(DD(t)-avgq))/totalt; varin1..sumofallin=e=sum(t,DIP(t)-DIN(t)); varin2..avgin=e=(sumofallin/totalt); varin3..INvariable=e=sum(t,sqr(DIP(t)-DIN(t)-avgin))/totalt; E_ORDERBWE..orderbwe=e=DCvariable/Xvariable; E_INVENBWE..invenbwe=e=INvariable/Xvariable; E_BWE..BWE=e=gamma*orderbwe+(1-gamma)*invenbwe; E_X(t)..X(t)=e=500+100*(it(t)/52)+200*sin(it(t)/52*2*3.14)+20*u(t); MP.fx("1")=300; DD.fx("1")=300; MO.fx("i1","1")=400; MO.fx("i2","1")=400; MO.l(i,t)=400; MI.fx("i1","1")=0; MI.fx("i2","1")=0; MI.l(i,t)=0; AI.l("1")=0; AP.l("1")=0; RI.fx("i1","1")=0; RI.fx("i2","1")=0; RI.l(i,t)=0; AR.fx("i1","1")=0; AR.fx("i2","1")=0; AR.l(i,t)=0; RP.fx("i1","1")=0; RP.fx("i2","1")=0; RP.l(i,t)=0; RQ.fx("i1","1")=0; RQ.fx("i2","1")=0; RQ.l(i,t)=0; RI.fx("i1","1")=0; RI.fx("i2","1")=0; RI.l(i,t)=0; DD.l(t)=0; MIP.l(t)=0;MIN.l(t)=0;DIP.l(t)=0;DIN.l(t)=0; Xvariable.l=606.6816; obj..z=e=sum(t,MP(t)); model LP/ all/; Solve LP using NLP maximizing z; Display Xvariable.L,BWE.L,totalt,sumofall.L;