MBG0903 commited on
Commit
a1d7074
·
verified ·
1 Parent(s): 99a3d22

Create tools/slotting.py

Browse files
Files changed (1) hide show
  1. tools/slotting.py +26 -0
tools/slotting.py ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import pandas as pd
2
+ import numpy as np
3
+
4
+
5
+ def optimize_slotting(df: pd.DataFrame):
6
+ """
7
+ Assign aisle/rack based on velocity.
8
+ Fast → aisles 1–5
9
+ Medium → 6–12
10
+ Slow → 13–20
11
+ """
12
+
13
+ df = df.copy()
14
+
15
+ def assign_location(row):
16
+ if row["Velocity"].lower() == "fast":
17
+ aisle = np.random.randint(1, 6)
18
+ elif row["Velocity"].lower() == "medium":
19
+ aisle = np.random.randint(6, 12)
20
+ else:
21
+ aisle = np.random.randint(13, 20)
22
+ rack = np.random.randint(1, 30)
23
+ return aisle, rack
24
+
25
+ df["Suggested Aisle"], df["Suggested Rack"] = zip(*df.apply(assign_location, axis=1))
26
+ return df