|
1 | | -# Optimizing-Warehouse-Efficiency-via-Python-Based-Order-Batching |
| 1 | +# Optimizing-Warehouse-Efficiency-via-Python-Based-Order-Batching |
| 2 | + |
| 3 | +In a **Distribution Center (DC)**, walking time from one location to another during picking route can account for 60% to 70% of the operator’s working time. Reducing this walking time is the most effective way to increase your DC overall productivity. |
| 4 | + |
| 5 | +<p align="center"> |
| 6 | + <img align="center" src="static/img/intro_1.gif" width=75%> |
| 7 | +</p> |
| 8 | +<p align="center"><b>Scenario 1:</b> Picking routes with 1 order picked per wave</p> |
| 9 | + |
| 10 | +I've been exploring an approach to design a model that simulates the impact of different picking processes and routing methods, aiming to find the optimal order picking strategy using the **Single Picker Routing Problem (SPRP)** in a two-dimensional warehouse layout (axis-x and axis-y). |
| 11 | + |
| 12 | +SPRP is a specific application of the general **Traveling Salesman Problem (TSP)** answering the question: |
| 13 | +> “Given a list of storage locations and the distances between each pair of locations, what is the shortest possible route that visits each storage location and returns to the depot ?” |
| 14 | +
|
| 15 | +This repo is containing a ready-to-use **Streamlit App** designed for **Logistics Engineers** to test these different strategies by only uplooading their own dataset of order lines records. |
| 16 | +- |
| 17 | + |
| 18 | +# Picking Route Optimization 🚶♂️ |
| 19 | + |
| 20 | +## 💾 **Initial: prepare order lines datasets with picking locations** |
| 21 | + |
| 22 | +Based on your **actual warehouse layout**, storage locations are mapped with **2-D (x, y) coordinates** that will be used to measure walking distance. |
| 23 | + |
| 24 | +<p align="center"> |
| 25 | + <img align="center" src="static/img/warehouse_layout.png" width=75%> |
| 26 | +</p> |
| 27 | +<p align="center">Warehouse Layout with 2D Coordinates</p> |
| 28 | + |
| 29 | +Every storage location must be linked to a Reference using Master Data. (For instance, reference #123129 is located in coordinate (xi, yi)). You can then associate every order line to a geographical location for picking. |
| 30 | + |
| 31 | +<p align="center"> |
| 32 | + <img align="center" src="static/img/processing_layout.png" width=75%> |
| 33 | + |
| 34 | +</p> |
| 35 | +<p align="center">Database Schema</p> |
| 36 | + |
| 37 | +Order lines can be extracted from your WMS Database, this table should be joined with the Master Data table to link every order line to a storage location and its (x, y) coordinate in your warehouse. Extra tables can be added to include more parameters in your model like (Destination, Delivery lead time, Special Packing, ..). |
| 38 | + |
| 39 | +## 🧪 **Experiment 1: Impacts of wave picking on the pickers walking distance?** |
| 40 | + |
| 41 | +### ✔️ Problem Statement |
| 42 | + |
| 43 | +For this study, we will use the example of E-Commerce type DC where items are stored in 4 level shelves. These shelves are organized in multiple rows (Row#: 1 … n) and aisles (Aisle#: A1 … A_n). |
| 44 | + |
| 45 | +<p align="center"> |
| 46 | + <img align="center" src="static/img/trolley.jpeg" width=35%> |
| 47 | + |
| 48 | +</p> |
| 49 | +<p align="center">Different routes between two storage locations in the warehouse</p> |
| 50 | + |
| 51 | +1. Items Dimensions: Small and light dimensions items |
| 52 | +2. Picking Cart: lightweight picking cart with a capacity of 10 orders |
| 53 | +3. Picking Route: Picking Route starts and ends at the same location |
| 54 | + |
| 55 | +Scenario 1, the worst in terms of productivity, can be easily optimized because of |
| 56 | +- Locations: Orders #1 and #2 have common picking locations |
| 57 | +- Zones: orders have picking locations in a common zone |
| 58 | +- Single-line Orders: items_picked/walking_distance efficiency is very low |
| 59 | + |
| 60 | +<p align="center"> |
| 61 | + <img align="center" src="static/img/wave_picking.gif" width=75%> |
| 62 | + |
| 63 | +</p> |
| 64 | +<p align="center"><b>Scenario 2:</b> Wave Picking applied to Scenario 1</p> |
| 65 | + |
| 66 | +The first intuitive way to optimize this process is to combine these three orders in one picking route — this strategy is commonly called Wave Picking. |
| 67 | + |
| 68 | +We are going to build a model to simulate the impact of several Wave Picking strategies in the total walking distance for a specific set of orders to prepare. |
| 69 | + |
| 70 | + |
| 71 | +### 📊 Simulation |
| 72 | + |
| 73 | +In the article I have built a set of functions needed to run different scenarios and simulate the pickers walking distance. |
| 74 | + |
| 75 | +**Function:** Calculate distance between two picking locations |
| 76 | +<p align="center"> |
| 77 | + <img align="center" src="static/img/batch_function_1.png" width=75%> |
| 78 | + |
| 79 | +</p> |
| 80 | +<p align="center"><b>Function:</b> Different routes between two storage locations in the warehouse</p> |
| 81 | + |
| 82 | + |
| 83 | +This function will be used to calculate the walking distance from a point i (xi, yi) and j (xj, yj). |
| 84 | + |
| 85 | +Objective: return the shortest walking distance between the two potential routes from point i to point j. |
| 86 | +> Parameters |
| 87 | +- y_low : lowest point of your alley (y-axis) |
| 88 | +- y_high : highest point of your alley (y-axis) |
| 89 | + |
| 90 | +**Function:** the Next Closest Location |
| 91 | +<p align="center"> |
| 92 | + <img align="center" src="static/img/batch_function_2.png" width=75%> |
| 93 | + |
| 94 | +</p> |
| 95 | +<p align="center"><b>Function:</b> Next Storage Location Scenario</p> |
| 96 | + |
| 97 | + |
| 98 | +This function will be used to choose the next location among several candidates to continue your picking route. |
| 99 | + |
| 100 | +Objective: return the closest location as the best candidate |
| 101 | + |
| 102 | + |
| 103 | +This function will be used to create your picking route from a set of orders to prepare. |
| 104 | +- Input: a list of (x, y) locations based on items to be picked for this route |
| 105 | +- Output: an ordered sequence of locations covered and total walking distance |
| 106 | + |
| 107 | + |
| 108 | +**Function:** Create batches of n orders to be picked at the same time |
| 109 | +- Input: order lines data frame (df_orderlines), number of orders per wave (orders_number) |
| 110 | +- Output: data frame mapped with wave number (Column: WaveID), the total number of waves (waves_number) |
| 111 | + |
| 112 | + |
| 113 | +**Function:** listing picking locations of wave_ID picking route |
| 114 | +- Input: order lines data frame (df_orderlines) and wave number (waveID) |
| 115 | +- Output: list of locations i(xi, yi) included in your picking route |
| 116 | + |
| 117 | +### ☑️ **Results and Next Steps** |
| 118 | + |
| 119 | +After setting up all necessary functions to measure picking distance, we can now test our picking route strategy with picking order lines. |
| 120 | + |
| 121 | +Here, we first decided to start with a very simple approach |
| 122 | +- Orders Waves: orders are grouped by chronological order of receiving time from OMS ( TimeStamp) |
| 123 | +- Picking Route: picking route strategy is following the Next Closest Location logic |
| 124 | + |
| 125 | +To estimate the impact of wave picking strategy on your productivity, we will run several simulations with a gradual number of orders per wave: |
| 126 | +1. Measure Total Walking Distance: how much walking distance is reduced when the number of orders per route is increased? |
| 127 | +2. Record Picking Route per Wave: recording the sequence of locations per route for further analysis |
| 128 | + |
| 129 | +<p align="center"> |
| 130 | + <img align="center" src="static/img/batch_final.png" width=100%> |
| 131 | + |
| 132 | +</p> |
| 133 | +<p align="center"><b>Experiment 1:</b> Results for 5,000 order lines with a ratio from 1 to 9 orders per route</p> |
| 134 | + |
| 135 | + |
| 136 | +## 🧮**Experiment 2: Impacts of orders batching using spatial clusters of picking locations?** |
| 137 | + |
| 138 | +<p align="center"> |
| 139 | + <img align="center" src="static/img/cluster_process.png" width=100%> |
| 140 | + |
| 141 | +</p> |
| 142 | +<p align="center"><b>Order Lines Processing</b> for Order Wave Picking using Clustering by Picking Location</p> |
| 143 | + |
| 144 | +### 💡**Idea: Picking Locations Clusters** ### |
| 145 | + |
| 146 | +Group picking locations by clusters to reduce the walking distance for each picking route. _(Example: the maximum walking distance between two locations is <15 m)_ |
| 147 | + |
| 148 | +Spatial clustering is the task of grouping together a set of points in a way that objects in the same cluster are more similar to each other than to objects in other clusters. |
| 149 | + |
| 150 | +For this part we will split the orders in two categories: |
| 151 | +- Mono-line orders: they can be associated to a unique picking locations |
| 152 | +- Multi-line orders: that are associated with several picking locations |
| 153 | + |
| 154 | +#### **Mono-line orders** |
| 155 | +<p align="center"> |
| 156 | + <img align="center" src="static/img/cluster_walking_distance.png" width=100%> |
| 157 | + |
| 158 | +</p> |
| 159 | +<p align="center">Left [Clustering using Walking Distance] / Right [Clustering using Euclidian Distance]</p> |
| 160 | + |
| 161 | +_Grouping orders in cluster within n meters of walking distance_ |
| 162 | + |
| 163 | +#### **Multi-line orders** |
| 164 | +<p align="center"> |
| 165 | + <img align="center" src="static/img/cluster_centroids.png" width=75%> |
| 166 | + |
| 167 | +</p> |
| 168 | +<p align="center"><b>Example: </b>Centroid of three Picking Locations</p> |
| 169 | + |
| 170 | +_Grouping multi-line orders in cluster (using centroids of picking locations) within n meters of walking distance_ |
| 171 | + |
| 172 | + |
| 173 | +### 🐁 **Model Simulation** ### |
| 174 | + |
| 175 | +#### **Methodology** |
| 176 | + |
| 177 | +To sum up, our model construction, see the chart below, we have several steps before Picking Routes Creation using Wave Processing. |
| 178 | + |
| 179 | +At each step, we have a collection of parameters that can be tuned to improve performance: |
| 180 | +<p align="center"> |
| 181 | + <img align="center" src="static/img/cluster_analysis.png" width=100%> |
| 182 | + |
| 183 | +</p> |
| 184 | +<p align="center"><b>Methodology: </b>Model Construction with Parameters</p> |
| 185 | + |
| 186 | +#### **Comparing three methods of wave creation** |
| 187 | +<p align="center"> |
| 188 | + <img align="center" src="static/img/wave_creation.png" width=75%> |
| 189 | + |
| 190 | +</p> |
| 191 | +<p align="center"><b>Methodology: </b>Three Methods for Wave Processing</p> |
| 192 | + |
| 193 | +We’ll start first by assessing the impact of Order Wave processing by clusters of picking locations on total walking distance. |
| 194 | + |
| 195 | +We’ll be testing three different methods: |
| 196 | +- Method 1: we do not apply clustering (i.e Initial Scenario) |
| 197 | +- Method 2: we apply clustering on single-line orders only |
| 198 | +- Method 3: we apply clustering to single-line orders and centroids of multiline orders |
| 199 | + |
| 200 | +#### **Parameters of Simulation** |
| 201 | +- Order lines: 20,000 Lines |
| 202 | +- Distance Threshold: Maximum distance between two picking locations _(distance_threshold = 35 m)_ |
| 203 | +- Orders per Wave: orders_number in [1, 9] |
| 204 | + |
| 205 | +#### **Final Results** |
| 206 | +<p align="center"> |
| 207 | + <img align="center" src="static/img/cluster_final_results.png" width=100%> |
| 208 | + |
| 209 | +</p> |
| 210 | +<p align="center"><b>Test 1:</b> 20,000 Order Lines / 35 m distance Threshold</p> |
| 211 | + |
| 212 | +- Best Performance: Method 3 for 9 orders/Wave with 83% reduction of walking distance |
| 213 | +- Method 2 vs. Method 1: Clustering for mono-line orders reduce the walking distance by 34% |
| 214 | +- Method 3 vs. Method 2: Clustering for mono-line orders reduce the walking distance by 10% |
| 215 | + |
| 216 | +# Build the application locally 🏗️ |
| 217 | + |
| 218 | +Because the ressources provided by Streamlit cloud or Heroku are limited, I would suggest to run this application locally. |
| 219 | + |
| 220 | +## **Build a python local environment (recommanded)** |
| 221 | + |
| 222 | +### Then install **virtualenv** using pip3 |
| 223 | + |
| 224 | + sudo pip3 install virtualenv |
| 225 | + |
| 226 | +### Now create a virtual environment |
| 227 | + |
| 228 | + virtualenv venv |
| 229 | + |
| 230 | +### Active your virtual environment |
| 231 | + |
| 232 | + source venv/bin/activate |
| 233 | + |
| 234 | +## Launch Streamlit 🚀 |
| 235 | + |
| 236 | +### Install all dependencies needed using requirements.txt |
| 237 | + |
| 238 | + pip install -r requirements.txt |
| 239 | + |
| 240 | +### Run the application |
| 241 | + |
| 242 | + streamlit run app.py --server.address 0.0.0.0 |
| 243 | + |
| 244 | +### Click on the URL |
| 245 | + <p align="center"> |
| 246 | + <img align="center" src="static/img/launch_streamlit.png" width=50%> |
| 247 | + |
| 248 | + </p> |
| 249 | +<p align="center"><b>Instructions:</b> Click on the URL</p> |
| 250 | + |
| 251 | +> -> Enjoy! |
| 252 | +
|
| 253 | +# Use the application 🖥️ |
| 254 | +> This app has not been deployed, you need to use it locally/. |
| 255 | +
|
| 256 | +## **Why should you use it?** |
| 257 | +This Streamlit Web Application has been designed for **Supply Chain Engineers** to help them simulating the impact on picking route optimization in the total distance of their picking operators. |
| 258 | + |
| 259 | +## **Load the data** |
| 260 | + |
| 261 | +- You can use the dataset located in the folder |
| 262 | + In/df_lines.csv |
| 263 | +- You can build your own dataset following the step of ('Initial Step') above |
| 264 | + |
| 265 | +## 🔬 Experiment 1 |
| 266 | +<p align="center"> |
| 267 | + <img align="center" src="static/img/params_1.PNG" width=75%> |
| 268 | + |
| 269 | +</p> |
| 270 | +<p align="center"><b>Experiment 1:</b> Parameters</p> |
| 271 | + |
| 272 | +### **Step 1:** Scope |
| 273 | + |
| 274 | +As the computation time can increase exponentially with the size of the dataset _(optimization can be done)_ you can ask the model to take only the n thousands first lines for analysis. |
| 275 | + |
| 276 | +### **Step 2:** Fix the range of orders/wave to simulate |
| 277 | + |
| 278 | +In the picture below we ask the model to run a loop testing scenarios with the number of orders per wave varying between 1 to 10 |
| 279 | + |
| 280 | +### **Step 3:** START CALCULATION |
| 281 | + |
| 282 | +Click the button to start the calculations |
| 283 | + |
| 284 | +### **Final Results** |
| 285 | +<p align="center"> |
| 286 | + <img align="center" src="static/img/batch_results.png" width=75%> |
| 287 | + |
| 288 | +</p> |
| 289 | +<p align="center"><b>Experiment 1:</b> Final Resultss</p> |
| 290 | + |
| 291 | + |
| 292 | +## 🧪 Experiment 2 |
| 293 | +<p align="center"> |
| 294 | + <img align="center" src="static/img/params_2.PNG" width=75%> |
| 295 | + |
| 296 | +</p> |
| 297 | +<p align="center"><b>Experiment 2:</b> Parameters</p> |
| 298 | + |
| 299 | +### **Step 1:** Scope |
| 300 | + |
| 301 | +As the computation time can increase exponentially with the size of the dataset _(optimization can be done)_ you can ask the model to take only the n thousands first lines for analysis. |
| 302 | + |
| 303 | +### **Step 2:** START CALCULATION |
| 304 | + |
| 305 | +Click the button to start the calculations |
| 306 | + |
| 307 | +### **Final Results** |
| 308 | +<p align="center"> |
| 309 | + <img align="center" src="static/img/streamlit_picking_route.png" width=75%> |
| 310 | +</p> |
| 311 | +<p align="center"><b>Experiment 2:</b> Final Results</p> |
0 commit comments