MBG0903's picture
Create tools/slotting.py
a1d7074 verified
raw
history blame contribute delete
676 Bytes
import pandas as pd
import numpy as np
def optimize_slotting(df: pd.DataFrame):
"""
Assign aisle/rack based on velocity.
Fast β†’ aisles 1–5
Medium β†’ 6–12
Slow β†’ 13–20
"""
df = df.copy()
def assign_location(row):
if row["Velocity"].lower() == "fast":
aisle = np.random.randint(1, 6)
elif row["Velocity"].lower() == "medium":
aisle = np.random.randint(6, 12)
else:
aisle = np.random.randint(13, 20)
rack = np.random.randint(1, 30)
return aisle, rack
df["Suggested Aisle"], df["Suggested Rack"] = zip(*df.apply(assign_location, axis=1))
return df