Commit cd335b24 authored by Georgios Dagkakis's avatar Georgios Dagkakis

some corrections. Now output of 2 approaches seems to coincide. More verification needed

parent 7b3b9562
...@@ -183,11 +183,11 @@ class Allocation(): ...@@ -183,11 +183,11 @@ class Allocation():
# update allocation output variable # update allocation output variable
# distinguish case of FutureDemand from PPOSdemand # distinguish case of FutureDemand from PPOSdemand
if MA.future == 1: if MA.future == 1:
G.AllocationFuture[G.replication].append([MA.orderID, alternativeMADict[chosenMAId], allocableQty, self.week+1]) G.AllocationFuture[G.replication].append([MA.orderID, chosenMAId, allocableQty, self.week+1])
G.FutureLateness[G.replication] += max([0, self.week - MA.originalWeek])*allocableQty G.FutureLateness[G.replication] += max([0, self.week - MA.originalWeek])*allocableQty
G.FutureEarliness[G.replication] += max([0, MA.originalWeek - self.week])*allocableQty G.FutureEarliness[G.replication] += max([0, MA.originalWeek - self.week])*allocableQty
else: else:
G.AllocationPPOS[G.replication].append([MA.orderID, alternativeMADict[chosenMAId], allocableQty, self.week+1]) G.AllocationPPOS[G.replication].append([MA.orderID, chosenMAId, allocableQty, self.week+1])
G.PPOSLateness[G.replication] += max([0, self.week - MA.originalWeek])*allocableQty G.PPOSLateness[G.replication] += max([0, self.week - MA.originalWeek])*allocableQty
G.PPOSEarliness[G.replication] += max([0, MA.originalWeek - self.week])*allocableQty G.PPOSEarliness[G.replication] += max([0, MA.originalWeek - self.week])*allocableQty
......
...@@ -190,10 +190,10 @@ def writeOutput(): ...@@ -190,10 +190,10 @@ def writeOutput():
print 'allocation', alloc print 'allocation', alloc
counterCols = [5 for i in range(len(profile))] counterCols = [5 for i in range(len(profile))]
# TODO the below crashes, got to check # TODO the below crashes, got to check
# for i in range(len(alloc)): for i in range(len(alloc)):
# for j in range(3): for j in range(3):
# sheet.write(alloc[i][0]+2,counterCols[alloc[i][0]]+j,alloc[i][j+1]) sheet.write(alloc[i][0]+2,counterCols[alloc[i][0]]+j,alloc[i][j+1])
# counterCols[alloc[i][0]] += 3 counterCols[alloc[i][0]] += 3
attempts = (max(counterCols)-5)/3 attempts = (max(counterCols)-5)/3
for i in range(attempts): for i in range(attempts):
...@@ -229,7 +229,7 @@ def writeOutput(): ...@@ -229,7 +229,7 @@ def writeOutput():
sheet.write(0,2,'excess Units') sheet.write(0,2,'excess Units')
for i in buf: for i in buf:
sheet.write(row,0,i.orderID+1) sheet.write(row,0,i.orderID+1)
sheet.write(row,1,i.MAid+1) sheet.write(row,1,i.MAid)
sheet.write(row,2,i.qty) sheet.write(row,2,i.qty)
row +=1 row +=1
...@@ -241,7 +241,6 @@ def writeOutput(): ...@@ -241,7 +241,6 @@ def writeOutput():
sheet.write_merge(0,1,0,0,'Bottlenecks') sheet.write_merge(0,1,0,0,'Bottlenecks')
i=2 i=2
for record in G.CurrentCapacityDict: for record in G.CurrentCapacityDict:
print record, G.CurrentCapacityDict[record]
sheet.write(i,0,record) sheet.write(i,0,record)
sheet.write(i,1,G.CurrentCapacityDict[record][0]) sheet.write(i,1,G.CurrentCapacityDict[record][0])
sheet.write(i,2,G.CurrentCapacityDict[record][1]) sheet.write(i,2,G.CurrentCapacityDict[record][1])
...@@ -294,6 +293,7 @@ def main(): ...@@ -294,6 +293,7 @@ def main():
AM = AllocManagement() AM = AllocManagement()
AM.Run() AM.Run()
writeOutput() # currently to excel for verification. To be outputted in JSON writeOutput() # currently to excel for verification. To be outputted in JSON
print G.AllocationPPOS
if __name__ == '__main__': if __name__ == '__main__':
main() main()
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment