Turnovers=A.Input_data(worksheet_RapidMiner,workbook)#Dictionary with the data from the Excel file
worksheets=workbook.sheet_names()
worksheet_RapidMiner=worksheets[0]
#Create lists with the MAs' names and the Turnovers for the first twelve weeks of 2010 retrieving this data from the dictionary
PPOS=Turnovers.get('Ppos',[])
PPOSToBeDisaggregated='PPOS4'
SP=Turnovers.get('SP',[])
PPOSQuantity=1000
MA=Turnovers.get('FP Material No PGS+',[])
PlannedWeek=2
GlobalDemand=Turnovers.get('Global demand',[])
A=Import_Excel()
#Call the Distributions object and fit the data from the list in Normal distribution, so as to have info on Global demand (mean and standard deviation)
Turnovers=A.Input_data(worksheet_RapidMiner,workbook)#Dictionary with the data from the Excel file
D=Distributions()
E=HandleMissingValues()
#Create lists with the MAs' names and the Turnovers for the first twelve weeks of 2010 retrieving this data from the dictionary
MA=E.DeleteMissingValue(MA)
PPOS=Turnovers.get('Ppos',[])
t=D.Normal_distrfit(GlobalDemand)
SP=Turnovers.get('SP',[])
avg=t.get('mean')
MA=Turnovers.get('FP Material No PGS+',[])
stdev=t.get('stdev')
GlobalDemand=Turnovers.get('Global demand',[])
defconstrained_sum_sample_pos(n,total):
#Call the Distributions object and fit the data from the list in Normal distribution, so as to have info on Global demand (mean and standard deviation)
D=Distributions()
E=HandleMissingValues()
MA=E.DeleteMissingValue(MA)
t=D.Normal_distrfit(GlobalDemand)
avg=t.get('mean')
stdev=t.get('stdev')
defconstrained_sum_sample_pos(n,total):
"""Return a randomly chosen list of n positive integers summing to total.
"""Return a randomly chosen list of n positive integers summing to total.
week=[1,2,3,4,5,6,7,8,9,10]# list that defines the planning horizon, i.e. 10 weeks
week=[1,2,3,4,5,6,7,8,9,10]# list that defines the planning horizon, i.e. 10 weeks
foriinweek:
foriinweek:
Demand=int(abs(random.normalvariate(avg,stdev)))# Generate a random, non-negative, integer number from the Normal distribution
Demand=int(abs(random.normalvariate(avg,stdev)))# Generate a random, non-negative, integer number from the Normal distribution
AllocatedPercent=0.8-(0.05*i)# Defines a number starts with 0.8 or 80% and reduced with every iteration at 0.05 or 5%
AllocatedPercent=0.8-(0.05*i)# Defines a number starts with 0.8 or 80% and reduced with every iteration at 0.05 or 5%
Remaining_Demand=int((1-AllocatedPercent)*Demand)# Defines the Remaining demand
Remaining_Demand=int((1-AllocatedPercent)*Demand)# Defines the Remaining demand
...
@@ -95,21 +104,21 @@ for i in week:
...
@@ -95,21 +104,21 @@ for i in week:
dicta.update({MA[index]:[TotalUnits,MinUnits]})# it updates a dictionary with key the different MAs and values the remaining demand and (b[index]*lista[index])
dicta.update({MA[index]:[TotalUnits,MinUnits]})# it updates a dictionary with key the different MAs and values the remaining demand and (b[index]*lista[index])
DemandProfile.update({i:dicta})#It updates a dictionary with key the number of each iteration (week) and value the dictionary dicta
DemandProfile.update({i:dicta})#It updates a dictionary with key the number of each iteration (week) and value the dictionary dicta