TITLE SCPc; INDEX sku := (AJ8172, LQ8811, RN0098, NN1100, WN7342); sku1 := sku; time := (jan1,jan2,jan3,jan4,jan5,jan6,jan7,jan8); resource := (HR_101,MT_402); DATA Numbertime := count(time); InitialInventory[sku] := (90, 300, 100, 0, 900); Leadtime[sku] := (2, 3, 4, 1, 12); Prodrequire[sku, sku1] := (0, 0, 0, 0, 0, ! R(sku2, sku) 2, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0); ExtDemand[sku,time] := (20, 30, 10, 20, 30, 20, 30, 40, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); ResourceReq[sku,resource] := (0.00208333, 0, 0.00104166, 0.00333333, 0, 0, 0.000001, 0, 0, 0); ordinal[time] := (1,2,3,4,5,6,7,8); LM := 10000; Invtolerance := 0.25; MaxExtraResource := 0.5; !no need for vector as is scalar value ChangeoverWaste[sku,sku1] := (0, 0, 0, 0, 0, 10,10,0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); ResChangeUsage[sku,resource] := (0.2, 0, 0.2, 0.5, 0, 0, 0, 0, 0, 0); HoldingCost[sku] := (2, 1, 0.5, 0.1, 0.1); ChangeoverCost[sku] := (800, 4200, 1, 1, 1); AddFractionCost := 1; TardinessCost[sku] := (400, 100, 4, 4, 4); VARIABLE Prod[sku,time]; PrdIndicator[sku,time]; Invminus[sku,time]; Invplus[sku,time]; Overtime[resource,time]; MODEL MIN Cost = SUM(sku: SUM(time: (TardinessCost * Invminus + HoldingCost * (Invplus + Leadtime * Prod) + ChangeoverCost * PrdIndicator) + UM(resource: AddFractionCost * Overtime))); SUBJECT TO MaterialRequirement[sku,time]: SUM(time=1..time-Leadtime: Prod) + InitialInventory + SUM(time=1..time: ExtDemand) >= SUM(time=1..time: ExtDemand + SUM(sku1: Prodrequire * Prod[sku:=sku1] + ChangeoverWaste * PrdIndicator[sku:=sku1])); Sunset[sku]: SUM(time: Prod WHERE (time >= Numbertime-Leadtime+1)) = 0; Capacity[time,resource]: SUM(sku: ResourceReq * Prod + ResChangeUsage * PrdIndicator) - Overtime <= 1; MaxFraction[resource,time]: Overtime - MaxExtraResource <= 0; ProductionIndicator[sku,time]: PrdIndicator - (Prod / LM) >= 0; InventoryCalc[sku,time]: Invplus - Invminus - (SUM(time=1..time-Leadtime: Prod) + InitialInventory - SUM(time=1..time: ExtDemand + SUM(sku1: Prodrequire * Prod[sku:=sku1] + ChangeoverWaste * PrdIndicator[sku:=sku1]))) = 0; InventoryTolerance[sku]: InitialInventory * (1 - Invtolerance) <= Invplus[sku,time:=last(time)] <= InitialInventory * (1 + Invtolerance) ; BINARY PrdIndicator; END