SortCustomer() and WarehouseHasItems() functions
This commit is contained in:
parent
5621b6385b
commit
90e6087478
12
main.py
12
main.py
|
@ -197,3 +197,15 @@ newTurn()
|
||||||
f = open(sys.argv[1] + 'o', 'w')
|
f = open(sys.argv[1] + 'o', 'w')
|
||||||
f.write(str(len(Out)) + '\n' + '\n'.join(Out))
|
f.write(str(len(Out)) + '\n' + '\n'.join(Out))
|
||||||
f.close()
|
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
|
Reference in a new issue