SortCustomer() and WarehouseHasItems() functions

This commit is contained in:
JLo'w 2016-02-11 21:43:28 +01:00
parent 5621b6385b
commit 90e6087478

12
main.py
View file

@ -197,3 +197,15 @@ newTurn()
f = open(sys.argv[1] + 'o', 'w')
f.write(str(len(Out)) + '\n' + '\n'.join(Out))
f.close()
def SortCustomer():
CpSort = []
for i in range(0, len(Cp)):
CpSort.append((i, Cp[i], distance(Wp[0], Cp[i])))
CpSort.sort(key=lambda tup: tup[2])
def WarehouseHasItems(w, items):
for i in range(0, len(items):
if Wi[w][items[i][0]] < items[i][1]:
return False
return True