Binary Occupancy Maps for Field 1 and Field 2

A typical agricultural environment for the bale collection operation was modeled in 2D using binary occupancy maps. Bales are represented as occupied circle areas and once a bale is picked up, it is removed from the BOM. To take the collection vehicle size into consideration, the occupied areas were further inflated in the BOM. In Table 2, all BOM settings for both fields (simple and complex) are summarized.


**Table 2.** Binary occupancy map (BOM) setting for both fields.

Probabilistic Roadmaps

To further reduce the calculation intensity for the GA-simulations, static PRM was used (stationary nodes and connection lines) to generate the collision free paths. The same number of nodes and connection distance was used for both fields and the chosen PRM parameters are given in Table 3.

**Table 3.** Selected PRM settings for the simulation.


The quality of the PRM depends on the number of nodes and connection distance and also impacts the calculation intensity. For this study, 1000 nodes and 50 m in connection distance was evaluated as a suitable trade-off.

The "bale storage position, pick-up positions (also bale positions for traditional pickup vehicle), start- and end position of the vehicle" were pre-defined nodes and then another 1000 randomly generated nodes were added. PRMs for both fields were kept fixed, despite

the changes in map (e.g., when bales are picked up) to speed up the computation. However, PRM connection lines did not cross the bale areas even after being removed.

Figure 4 shows the PRM for field 1 (a) and field 2 (b).

**Figure 4.** (**a**) Static PRM for field 1. (**b**) Static PRM for field 2.

#### *2.2. Bales Collection Path Approaches*

Two approaches to generate the bale collection paths were studied. The idea was to imitate the bale collection approach of a farmer and compare it to a bale collection approach based on optimization.

#### 2.2.1. Nearest Neighbor Approach

One way of imitating how farmers collect bales, which was used for this study, is through the nearest neighbor approach. It was here assumed that a farmer will choose the nearest bales from its current position and then continue collecting one by one based on proximity. In the case of a traditional collection vehicle, the bale center is used as the collection position. On the other hand, for the AVN, the nearest bale is first derived and then the collection point around the bale that is closest to the Euclidian vector from the previous collection position to the current nearest bale center is derived. A straight-line path is used if no obstacles are intersected, otherwise a collision free path based on PRM is derived. This approach uses the MATLAB© built-in nearest neighbor search algorithm based on Euclidean distance between the set of points in free space. In case when there are obstacles in the space, it may result in false positive in comparison to the farmers' visual judgment in a real situation.

### 2.2.2. Optimization Approach

Optimization of the total distance travelled (fitness function) was carried out by use of a GA, which has good performance on finding the global optimum, has possibilities for parallelization, and can be applied to various types of problems. However, GA can become very calculation intensive and therefore, a lot of emphasis has been spent on simplifications, making each iteration as fast as possible.

Since the notion of an agricultural vehicle (see Figure 1) with neighborhood collection capability is used for this study, bales were collected not only in a certain order, but also from a point on a circle with a certain radius (corresponding to the crane length) surrounding the bales. Thus, a traveling solution is defined by a collection order and a set of points on the collection circumference (i.e., collection angles). Since the collection order is a permutation while collection angles are a set of constrained real numbers between 0 and 2*π* (not a permutation), it was decided to use two GAs. Hence, the first GA (GA1) was used to optimize the collection order represented as chromosome in the population of permutations of the bales' identities. For each collection order proposed by the first GA, a second GA (GA2) was then used to optimize the collection positions for each bale. To speed up the calculations, a discrete number of collection positions were defined from which GA2 had to choose. In this way, the number of possible combinations were significantly decreased, and integer representation was used for the chromosomes, which also contributes to computational efficiency. For both GAs, the built in "ga"-solver in MATLAB© was used. However, since GA1 is based on permutation chromosomes, custom functions for the initial population, crossovers, and mutations were developed (for GA2, default settings for these properties were used). To enable a comparison of the initial conditions, two different cases of population initialization were tested (i.e., randomized initialization and nearest neighbor initialization). Crossovers were conducted by flipping a random sized part of the chromosomes while the mutations were carried out by swapping two elements in the chromosome. After evaluating the performance by means of computational time and accuracy, the following settings were used for both GAs:


For GA1, vectorization (i.e., working with the complete population for each iteration instead of sequentially working which each chromosome in sequence) and no parallelization was used, while the opposite was used for GA2, thus enabling GA2 to evaluate different sets of collection angles in parallel, which is possible since there exist no dependencies between those solutions.

At the lowest computational level (i.e., for a suggested collection order and set of collection angles), the total travelled distance can be calculated. Here, between two subsequent collection points, a straight line path was derived if no collision in the occupancy map occurred. Otherwise, the PRM was used to find the shortest collision free path (within the pre-generated PRM network). To further improve the computational efficiency, all

simulated collection orders were stored together with the, for that order, optimized set of collection positions. For each new generation, this enabled an initial check of whether the suggested collection orders have already been optimized by means of collection angles or not. If not, a new optimization simulation is initiated, otherwise the already stored feasibility value is used.

A 20-core computer was used for the parallel computations, leading to a total simulation time for all set of parameters (field type, carrying capacities) of about 5 days.

#### **3. Results**

Simulations with the same set of parameters were carried out for both field 1 and field 2. The simulations included both the nearest neighbor and the optimization approaches. For the nearest neighbor, to enable a fair comparison, two different cases were studied. In the first case, notion of traditional vehicle without distance collection possibilities was modeled and referred to as the "benchmark". In the other case, the AVN notion was used and referred to as the "nearest neighbor with radius R" (referred as NNR). Additionally, the optimization approach was divided into two cases using the AVN notion. In the first case, random permutations of the pickup sequence were used for the initial population, which here is referred to as "random permutation initialization" (RPI). For the second case, the nearest neighbor collection sequence was included in the initial population, which is referred to as the "nearest neighbor permutation initialization" (NNPI). For each of these four cases, the three different carrying capacities 1, 10, and all bales were evaluated, leading to 12 different simulations for each field. The resulting paths for carrying capacity CC = 10 are shown in the main text while the paths for the remaining simulations can be found in Appendix A.

#### *3.1. Nearest Neighbor Approach*

Figure 5 shows the resulting paths for field 1 with CC = 10 of the benchmark-(U) and NNR case (L). Circle 'o' represents bales heuristically optimized pickup positions and dots '•' and '.' represents bales positions and discretized pickup position at reach radius respectively. By adding a reach radius, the traveled distance was reduced from 1750 m to 1590 m while the collection sequence remained.

Figure 6 shows the resulting paths for field 2 with CC = 10 of the benchmark-(L) and NNR case (R). By adding a reach radius, the traveled distance was reduced from 1470 m to 1300 m while the collection sequence remained.

### *3.2. Optimization Approach*

Figure 7a shows the resulting paths for field 1 with CC = 10 of the RPI case where 'x' represents bales optimized pickup positions. Figure 7b shows the corresponding fitness convergence where black dots '·'represent the best fitness in each generation and marker '+' represents the average population fitness value in each generation. Figure 7c shows the resulting path of the NNPI case with the corresponding fitness convergence (d). By incorporating a nearest neighbor optimization as guess in the initial collection sequence population, the travelled distance was reduced from 1470 m to 1360 m.

Simple Field 1

**Figure 6.** Resulting paths for field 2 with CC = 10 of benchmark-(L) and NNR (R).

**Figure 7.** Resulting paths for field 1 with CC = 10 of (**a**) RPI case (**b**) RPI convergence, (**c**) NNPI case and (**d**) NNPI convergence.

Figure 8a shows the resulting paths for field 2 with CC = 10 of the RPI case and the corresponding fitness convergence (b). Figure 8c shows the resulting path of the NNPI case with the corresponding fitness convergence (d). By incorporating a nearest neighbor in the initial collection sequence population, the travelled distance was reduced from 1490 m to 1230 m.

### *3.3. Results Compilation*

Results of the travelled distance for all simulations are compiled in Tables 4 and 5 where the two path planning approaches and their respective subcases are arranged in columns from left to right for the three different carrying capacities given in rows. For the optimization approach, solutions for CC = 1 had weak dependency on the collection order. Some deviations compared to NNR might occur due to the fact that the discrete collection positions do not necessary coincide with a straight line from the storage location to the bales. Hence the NNR with CC = 1 is an approximation for the optimized approach. Table 4 shows the compiled results of the travelled distance for field 1.

**Figure 8.** Resulting paths for field 2 with CC = 10 of (**a**) RPI case, (**b**) RPI convergence, (**c**) NNPI case, and (**d**) NNPI convergence.

**Table 4.** Compiled results for field 1.


It can be observed in Table 4 that an increasing carrying capacity for all three cases resulted in a significant distance reduction. Percentage reduction in the travelled distance in field 2 for the three carrying capacities are shown in Figure 9.


**Table 5.** Result compilation for field 2.

**Figure 9.** Travelled distance reduction for the three carrying capacities within each case for field 1.

Figure 10 shows a comparison of the path planning cases for two carrying capacities (CC = 1 will give approximately the same result for the different cases) by means of percentage reduction in the travelled distance. Black bars represent NNR over the benchmark, white bar with solid line borders NNPI over the benchmark and white bar with the dashed dotted border NNPI over NNR.

Table 5 shows the compiled results of travelled distance for field 2.

Percentage reduction in the travelled distance in field 2 for three carrying capacities are shown in Figure 11.

Figure 12 shows comparison path planning cases for two carrying capacities (CC = 1 will give approximately the same result for all cases) by means of a percentage reduction in the travelled distance. The black bar represents the NNR over benchmark, the white bar with solid line borders NNPI over benchmark, and the white bar with dashed dotted border is the NNPI over NNR.

**Figure 10.** Comparison of the travelled distance reduction for two carrying capacities among each case for field 1.

**Figure 11.** Travelled distance reduction for three carrying capacities within each case for Field 2.

**Figure 12.** Comparison of the travelled distance reduction for two carrying capacities among each case for field 2.

#### **4. Discussion**

In order to simplify the computational intensity in optimizing the path planning task for the bale collection operations, there have been a number of approximations made in the modeling, as described in the scope and modeling part of the paper. This includes neglecting vehicle kinetics, considering bale collection only, keeping the PRM network static, discretization of the collection positions, etc. The GA is also significantly dependent on settings for the optimization algorithm, which effects both the accuracy and calculation time. Convergence to an optimal solution is, for instance, highly dependent on the size of the initial population and number of generations. Apart from CC = 1, the benchmark approach will always underestimate the travel distance since the loading stage is excluded from the distance calculation (i.e., relative improvements by the AVN will also be underestimated). Although these approximations will affect the output in an absolute manner, it is plausible that the relative behavior will remain, which was therefore focused on in making conclusions.

Taking the modeling limitations into consideration, some key insights were gained by analyzing the simulation results. It was found that adding carrying capacity significantly reduced the traveling distance for the bale collection operations. There was an exponential decaying trend in the distance reduction with respect to the carrying capacity. Hence, the bale collection procedure can be significantly improved, even with a small carrying capacity added. Comparing the benchmark with NNR showed that NNR reduced the travelled distance by about 10–20% (depending on field type and carrying capacity). Comparing the nearest neighbor strategy with optimization, the collection order may change for optimization (whether this is generally true or not cannot be concluded by the data presented in this paper). As would be expected, the simulations showed that the optimization approach reduced the travelled distance compared to the nearest neighbor approach. Compared to the benchmark, this reduction was about 20–30% for field 1 and 15–25% for field 2 and compared to NNR, this reduction was around 10–20% for field 1 and around 5–10% for field 2. Thus, the relative travelled distance reduction for the optimized solutions was slightly higher for the regular simple field (Field 1) compared to the complex field (Field 2). These travelled distance improvements can be compared to the similar studies by [21,22], which showed a 6.0 and 6.8% reduction for similar cases, respectively. It should be noted that the convergence to optimal solution strongly depended on the choice of initial population. The results indicate that the nearest neighbor initialization is a better choice than randomly

permutated initialization independent of carrying capacities and field complexity (similar results for both fields).
