$Title (SCPc) Formulation set PP SKU Numbers / AJ8172, LQ8811, RN0098, NN1100, WN7342 / TT Time Buckets / 1jan04*8jan04 / KK Resources / HR-101, MT-402 /; alias (TT,TTp) (PP,PPp); table R(PP,PP) number of i to make one j AJ8172 LQ8811 RN0098 NN1100 WN7342 AJ8172 LQ8811 2 RN0098 1 NN1100 1 WN7342 1 ; table demand(PP,TT) External Demand for an item in a period 1jan04 2jan04 3jan04 4jan04 5jan04 6jan04 7jan04 8jan04 AJ8172 20 30 10 20 30 20 30 40 LQ8811 RN0098 NN1100 WN7342 ; parameter lev(PP) Level in the production tree TD(PP) total demand extern plus implicit; scalar runlev level iteration / 0 /; * Root node get level 0, all other get -1 lev(PP)$(sum(PPp,R(PP,PPp))) = -1; TD(PP)$(lev(PP) = 0) = sum(TT,demand(PP,TT)); loop(PP$(lev(PP) = runlev), runlev = runlev + 1; lev(PPp)$R(PPp,PP) = runlev; TD(PPp)$R(PPp,PP) = sum(TT,demand(PPp,TT)) + R(PPp,PP)*TD(PP); ); parameter LT(PP) Lead Time I(PP) Beginning Inventory H(PP) per period holding cost C(PP) total changeover cost A(PP) per period tardiness cost; table SKUdata LT I H C A AJ8172 2 90 2.0 800 400 LQ8811 3 300 1.0 4200 100 RN0098 4 100 0.5 1 4 NN1100 1 0.1 1 4 WN7342 2 900 0.1 1 4 ; LT(PP) = SKUdata(PP,'LT'); I(PP) = SKUdata(PP,'I'); H(PP) = SKUdata(PP,'H'); C(PP) = SKUdata(PP,'C'); A(PP) = SKUdata(PP,'A'); scalar IT inventory tolerance at the end / 0.25 /; table U(PP,KK) fraction of recource k needed by one i HR-101 MT-402 AJ8172 0.00208333 0 LQ8811 0.00104166 0.00333333 RN0098 0 0 NN1100 0.000001 0 WN7342 0 0 ; table F(KK,TT) max fraction of k that can be added in t 1jan04 2jan04 3jan04 4jan04 5jan04 6jan04 7jan04 8jan04 MT-402 0.5 0.5 0.5 0.5 0.5 0.5 0.5 0.5 HR-101 0.5 0.5 0.5 0.5 0.5 0.5 0.5 0.5 ; table S(PP,KK) fraction of k used to changeover to i HR-101 MT-402 AJ8172 0.2 0 LQ8811 0.2 0.5 RN0098 0 0 NN1100 0 0 WN7342 0 0 ; table W(PP,PP) waste of i to changeover to j AJ8172 LQ8811 RN0098 NN1100 WN7342 AJ8172 LQ8811 10 10 RN0098 NN1100 WN7342 ; table O(KK,TT) marginal cost per fraction 1jan04 2jan04 3jan04 4jan04 5jan04 6jan04 7jan04 8jan04 MT-402 1 1 1 1 1 1 1 1 HR-101 1 1 1 1 1 1 1 1; ; parameter M(PP) big M for equation defprod; M(PP) = TD(PP); binary variable d(PP,TT) production indicator positive variable x(PP,TT) number of SKUs to produce y(KK,TT) overtime frac. of resource k in t iplus(PP,TT) inventory of SKU i to carry in t iminus(PP,TT) quantity of SKU i backordered in t variable inv(PP,TT) intermediate inventory variable obj objective variable; equation defobj objective function defreq(PP,TT) material requirement defprod(PP,TT) production indicator defcap(TT,KK) capacity definv(PP,TT) inventory macro definvsplit(PP,TT) inventory split in carry and backorder; defobj.. obj =E= sum((PP,TT), A(PP)*iminus(PP,TT) + H(PP)*iplus(PP,TT) + C(PP)*d(PP,TT)) + sum((KK,TT), O(KK,TT)*y(KK,TT)); defreq(PP,TT).. inv(PP,TT) + sum(TTp$(ord(TTp)<=ord(TT)), demand(PP,TTp)) =G= 0; defcap(TT,KK).. sum(PP, U(PP,KK)*x(PP,TT) + S(PP,KK)*d(PP,TT)) =L= 1 + y(KK,TT); defprod(PP,TT).. x(PP,TT) =L= d(PP,TT)*M(PP); definv(PP,TT).. inv(PP,TT) =E= sum(TTp$(ord(TTp)<=ord(TT)-LT(PP)), x(PP,TTp)) + I(PP) - sum(TTp$(ord(TTp)<=ord(TT)), demand(PP,TTp) + sum(PPp, R(PP,PPp)*x(PPp,TTp) + W(PP,PPp)*d(PPp,TTp))); definvsplit(PP,TT).. iplus(PP,TT) - iminus(PP,TT) =E= inv(PP,TT); model SCPc /defobj, definv, defreq, defcap, defprod, definvsplit/; * Max fraction y.up(KK,TT) = F(KK,TT); * Sunset x.fx(PP,TTp)$(ord(TTp) > card(TT)-LT(PP)) = 0; d.fx(PP,TTp)$(ord(TTp) > card(TT)-LT(PP)) = 0; * inventory tolerance iplus.up(PP,TTp)$(ord(TTp) = card(TT)) = (1+IT)*I(PP); iplus.lo(PP,TTp)$(ord(TTp) = card(TT)) = (1-IT)*I(PP); option optcr=0.0; solve SCPc minimizing obj using mip;