# Optimization of Warehouse Operations with Genetic Algorithms
## 5 The Proposed Method
### Data Format and Problem Encoding
** & **0** & **1** & **2** & **3** & **4** & **  
```
1:Wiredhouse layout in the form of transition costs between neighboring locations (see Table 1)
2:The list of orders
3:The optimized product placement (PP) in the warehouse
4:Shortest order picking routes for each order for the optimized PP
5:With Dijkstra algorithm calculate the full matrix \(\mathbf{D}\) of transition costs between product locations
6:for\(k=1\)to\(numberOfProcessRestarts\)do
7:Generate the random population of \(W\) PPs
8:if\(numberOfProcessRestarts>1\)then
9:\(maxIterationPP=10\) else\(maxIterationPP=1000\)
10:endif
11:for\(n=1\)to\(maxIterationPP\)do
12: (Calculate the fitness of \(w\)-th PP)
13:for\(i=1\)to\(popSizePP\)do
14:if\(i\)-th PP is already in cache then
15: Retrieve \(costPP(i)\) from cache
16: Calculate the fitness \(fitnessPP(i)\) of \(i\)-th PP according to Equation (3)
17:else
18:for\(j=1\)to\(numOrdersWithDifferentItems\)do
19: Run Algorithm 2 to find the shortest route for the \(j\)-th order and its length \(lengthR(i,j)\)
20: Multiply \(lengthR(i,j)\) by the number of orders, which contain the same items \(N_{rep}(j)\)
21:endfor
22: Calculate cost of \(i\)-th PP as the sum of the lengths \(lengthR\) of the all order best routes
23: Calculate the fitness \(fitnessPP(i)\) of \(i\)-th PP according to Equation (3)
24: Update the cache
25:endif
26:endfor
27:for\(p=1\)to\(popSizePP\)do
28: Select parents for each child PP
29: Generate the child PP with the AEX crossover operator
30:endfor
31:if\(fitnessPP\) of the best PP has not improved for \(NBI_{PP}\) iterations then
32: break
33:endif
34: Sort the parent and child population of PPs
35: promote \(popSizePP\) PPs from best parents and best children to the next generation
36: Apply mutation and update the cache for each mutated PP, which is not already in cache
37:endfor
38:if\(numberOfProcessRestarts>1\)then
39: Save the current population of PPs and their \(fitnessPP\)
40:endif
41:endfor
42:if\(numberOfProcessRestarts>1\)then
43: set \(numberOfProcessRestarts=1\)
44: Restore the population of the best PP and continue the optimization from line 4
45:endif
46: Return the best PP and the corresponding set of the shortest order picking routes
```
1:The matrix \(\mathbf{D}\) of transition costs between product locations
2:The list of items in the \(j\)-th orders
3:The \(i\)-th product placement
4:The shortest route for the \(j\)-th order completion \(route_{min}(i,j)\)
5:The length of shortest route for the \(j\)-th order completion \(lengthR_{min}(i,j)\)
6:else
7:Generate the random population of \(popSizeR\) routes
8:for\(k=1\)to\(maxIterationR\)do
9:for\(m=1\)to\(popSizeR\)do
10:Calculate the length of each route \(lengthR(i,m)\)
11:endfor
12:if the length of the shortest route did not decrease for \(NBI_{route}\) iterations then
13: Return \(route_{min}(i,j)\) and \(lengthR_{min}(i,j)\)
14:endif
15:for\(m=1\)to\(popSizeR\)do
16: Calculate the fitness of the routes \(fitnessR(i)\) for the selection operator according to Equation (5)
17: Select parents for each child route
18: Generate the child route with the crossover operator
19:endfor
20: Apply mutation to routes
21: Sort the parent and the child routes
22:if the best route fitness has not improved for \(NBI_{route}\) iterations then
23: break
24:endif
25: promote \(popSizeR\) routes from best parents and children to the next generation
26:endfor
27: Update cache
28:endif
29:else
30: Determine the \(route_{min}(i,j)\) with the Nearest Neighbor Algorithm
31:endif
32:Return \(route_{min}(i,j)\) and \(lengthR_{min}(i,j)\)
```

**Algorithm 2** Order Picking Route Optimization Process

To calculate the remaining transition costs between each pair of locations (line 1 in Algorithm 1). any algorithm that can do this can be used, for example Dijkstra [20], [PERSON] [21] or Bellman-Ford Algorithm [22]. We use Dijkstra Algorithm, because it is the fastest one, especially for sparse graphs (as is the case here), where each vertex is connected only with few other vertices.