| 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 | |