Nearest warehouse
This commit is contained in:
parent
042f668374
commit
df1f75c876
13
main.py
13
main.py
|
@ -198,6 +198,18 @@ def end():
|
|||
print("--- End!")
|
||||
|
||||
# IA
|
||||
def nearestW(p, pos):
|
||||
minDist = math.inf
|
||||
selW = None
|
||||
for w in range(W):
|
||||
if Wi[w][p] > 0:
|
||||
dist = distance(Wp[w], pos)
|
||||
if dist < minDist:
|
||||
minDist = dist
|
||||
selW = w
|
||||
return selW
|
||||
|
||||
|
||||
def listNeeds():
|
||||
N = []
|
||||
# client, product
|
||||
|
@ -207,6 +219,7 @@ def listNeeds():
|
|||
N.append((c, p))
|
||||
return N
|
||||
|
||||
|
||||
while t < 10:
|
||||
N = listNeeds()
|
||||
newTurn()
|
||||
|
|
Reference in a new issue