Skip to content

Commit

Permalink
Linter formatting for report
Browse files Browse the repository at this point in the history
  • Loading branch information
tdmittens committed Apr 8, 2021
1 parent ada3266 commit ef7e143
Show file tree
Hide file tree
Showing 14 changed files with 884 additions and 417 deletions.
2 changes: 1 addition & 1 deletion python/calculations.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ def SKUAssignment(locationDistances, assignment):
#df = locationDistances.sort_values(by=['Distance'], ascending=True)
append_df = assignment['SAP #']
df = locationDistances.join(append_df)
df.rename(columns={'SAP #':'SKU'}, inplace=True)
df.rename(columns={'SAP #': 'SKU'}, inplace=True)
print("SKU Assignment for this heuristic method has been completed.")
return df

Expand Down
29 changes: 14 additions & 15 deletions python/distance_algo.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ def sortIntoAisles(SKUList):
# SKU = (2,7) where 2 is aisle, 7 is location
newSKUList = []
for SKU in SKUList:
if SKU[1] % 2 ==0:
if SKU[1] % 2 == 0:
SKUAisle = SKU[1]/2
else:
else:
SKUAisle = int(SKU[1]/2)+1
newSKU = (SKU[0], SKUAisle)
newSKUList.append(newSKU)
Expand All @@ -33,10 +33,10 @@ def sortIntoAisles(SKUList):

# this method is just to check if it should enter the current aisle on its tour or keep moving forward in the bottom aisle

#def flipStartPoint(SortedList, LastAisle):
# def flipStartPoint(SortedList, LastAisle):
# for SKU in SortedList:
# SKU[0] = (LastAisle+1)-SKU[0]


def bottomNode(dataTuple, sorted, lastAisle):
# if at last aisle
Expand Down Expand Up @@ -93,47 +93,46 @@ def topNode(dataTuple, sorted, lastAisle):

return (dataTuple[0], dataTuple[1]+1)


def distanceAlgo(SKUList, aisles):
SKUComplete = False
sortedList = sortIntoAisles(SKUList) # sort SKUS in order
lastAisle = (sortedList[len(sortedList)-1])[1]
#this condition will ensure that the picker can leave the warehouse when complete

# this condition will ensure that the picker can leave the warehouse when complete
if lastAisle % 2 == 1:
lastAisle+=1
lastAisle += 1
# sortedList = flipStartPoint(sortedList, lastAisle) #bandaid to flip sku pick locations

# current node will be a tuple
# tuple starts at
# tuple starts at
currentNode = (0, (sortedList[0])[1]-1)
# if currentNode[1] <= 0:
# currentNode = (0,lastAisle)
allNodes = [currentNode]


while (SKUComplete is False):
# if currentNode[0]>lastAisle: #need to fix, should be done through method
# break
if currentNode[0] == 0:
currentNode = bottomNode(currentNode, sortedList, lastAisle)
elif currentNode[0] == 1:
currentNode = middleNode(currentNode, sortedList, aisles, lastAisle)
currentNode = middleNode(
currentNode, sortedList, aisles, lastAisle)
elif currentNode[0] == 2:
currentNode = topNode(currentNode, sortedList, lastAisle)
if currentNode == (0, lastAisle):
SKUComplete = True
allNodes.append(currentNode)
# print(currentNode)

return allNodes

# print(allNodes)
# # just temp print out of pathing
# for node in allNodes:
# emptyPath[2-node[1]][node[0]-1] = 1
#
#
# # https://stackoverflow.com/questions/17870612/printing-a-two-dimensional-array-in-python
# print('\n'.join([''.join(['{:2}'.format(item) for item in row])
# for row in emptyPath]))


34 changes: 19 additions & 15 deletions python/distance_calc.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,35 +3,39 @@
Created on Sun Mar 7 17:29:19 2021
@author: Tarandeep
This is a method used after the distance algorithm is commplete
This will take the nodes traversed and convert to distance
"""


def distanceCalculation(distanceNodes):
distance = 0

#params
BETWEEN = 5.89 #travel along aisles
LOWERVERT = 68.87 #below crossaisle
UPPERVERT = 52.25 #above crossaisle



# params
BETWEEN = 5.89 # travel along aisles
LOWERVERT = 68.87 # below crossaisle
UPPERVERT = 52.25 # above crossaisle

prevNode = distanceNodes[0]
for node in distanceNodes:
if node == prevNode:
pass
#if moving along aisles
elif node[1] == prevNode[1]:
# if moving along aisles
elif node[1] == prevNode[1]:
distance += BETWEEN
#if moving from middle to north
elif prevNode[0] == 1 and node[0] == 2:
# if moving from middle to north
elif prevNode[0] == 1 and node[0] == 2:
distance += UPPERVERT
#if moving from middle to south
# if moving from middle to south
elif prevNode[0] == 1 and node[0] == 0:
distance += LOWERVERT
#if moving from south to middle - note that cross aisles already checked before above
# if moving from south to middle - note that cross aisles already checked before above
elif prevNode[0] == 0:
distance += LOWERVERT
elif prevNode[0] ==2:
elif prevNode[0] == 2:
distance += UPPERVERT
prevNode = node

return distance
return distance
Loading

0 comments on commit ef7e143

Please sign in to comment.