**4. Ant colony optimization for grid map merging**

Given an MTM *T*, the objective function **Φ** to evaluate how two individual maps *M*<sup>1</sup> and *M*<sup>2</sup> are well overlapped for the merged map optimization can be defined as follows:

$$\Phi(\mathbf{M}\_1, \mathbf{M}\_2, T) = \sum\_{\mathbf{x} = a\_1}^{a\_2} \sum\_{y = b\_1}^{b\_2} \mathbf{M}\_1(\mathbf{x}, y) \cdot [\mathbf{T} \, \mathbf{M}\_2(\mathbf{x}, y)] \tag{3}$$

where *a*<sup>1</sup> ≤*x*≤*a*<sup>2</sup> and *b*<sup>1</sup> ≤*y*≤ *b*<sup>2</sup> are the whole ranges of the *x* and *y* coordinates of *M*<sup>1</sup> and *M*2. Because *T* includes sinusoidal functions for map rotation, the objective function **Φ** has nonlinearity and thus is hard to be solved in a closed form.

Therefore, the optimization of **Φ** for grid map merging needs to be considered with sampling-based optimization such as MCO (Monte-Carlo Optimization) [9], PSO (Particle Swarm Optimization) [10] and ACO (Ant-Colony Optimization) [11]. They require commonly much computation due to their own iterative property. Instead, they are easy to implement regardless of the complexity or nonlinearity of the objective function. Thus, it is a reasonable approach to apply sampling-based optimization methods to the merged map optimization. This paper applies the ACO to the merged map optimization because the ACO requires the relatively smaller number of samples than the MCO and the PSO in the case of the merged map optimization. The ACO is a probabilistic technique for solving computational problems which can be reduced to finding good paths through graphs. Artificial ants locate optimal solutions by moving through a parameter space representing all possible solutions. Real ants lay down pheromones directing each other to resources while exploring their environment. The simulated ants similarly record their positions and the quality of their solutions, so that in later simulation iterations more ants locate better solutions [12].

The ACO needs to be modified to be applied to the merged map optimization. Because an even slight variation in the rotation angle causes a largely different map merging result in grid map merging, the concept of pheromones in the ACO cannot be properly applied to finding the optimal rotation angle. Therefore, each sample in a search space consists of *x* and *y* translations except for a rotation angle. Besides, since the search space for *x* and *y* translations may be largely different, the search space for the ACO for grid map merging needs to be divided into two areas which contains the possible configurations of *x* and *y* translations respectively as shown in **Figure 5**.

**Figure 5.** *The modified search space for the ACO for grid map merging.*

In general, the *i*-th ant moves from state *q* to *r* with probability as follows:

$$p\_{qr}^i = \frac{\left(\tau\_{qr}\right)^a \left(\eta\_{qr}\right)^\beta}{\sum\_{x \in allowed \ q} \left(\tau\_{qx}\right)^a \left(\eta\_{qx}\right)^\beta} \tag{4}$$

where *τqr* is the amount of pheromone deposited for transition from state *q* to *r*. 0≤*α* is a parameter to control the influence of *τqr*, which was set to 1 in this work. *ηqr* is the desirability of state transition *qr*, which is typically set to the reciprocal value of the distance. 1≤*β* is a parameter to control the influence of *ηqr*. *τqz* and *ηqz* represent the trail level and attractiveness for the other possible state transitions.

In the original ACO, the distance is the Euclidean distance between states. But, it needs to be redefined for grid map merging. In other words, the distance is not the Euclidean distance between the nodes but a new metric to evaluate how two individual grid maps are well overlapped. For a candidate tour of the *i*-th ant, *<sup>Λ</sup><sup>i</sup>* <sup>¼</sup> *<sup>q</sup><sup>i</sup> j* ,*ri k* n o where *<sup>q</sup><sup>i</sup> <sup>j</sup>* and *ri <sup>k</sup>* are respectively the *j*-th and the *k*-th sample in the areas for *x* and *y* translations, the new metric **Ψ** is defined similarly to Eq. (3) as follows:

$$\Psi(\Lambda\_i) = \frac{1}{\sum\_{\mathbf{x}=\bar{a}\_1}^{\bar{a}\_2} \sum\_{\mathbf{y}=\bar{b}\_1}^{\bar{b}\_2} \mathbf{M}\_1(\mathbf{x}, \mathbf{y}) \cdot \left[ \mathbf{T} \left( q\_j^i, r\_k^i, \mathbf{0} \right) \check{\mathbf{M}}\_2(\mathbf{x}, \mathbf{y}) \right]} \tag{5}$$

where *M*~ <sup>2</sup> is the transformed *M*<sup>2</sup> by a direct or indirect grid map merging algorithm. *a*~<sup>1</sup> ≤*x*≤*a*~<sup>2</sup> and ~ *b*<sup>1</sup> ≤*y*≤ ~ *b*<sup>2</sup> are the whole ranges of the *x* and *y* coordinates of *M*<sup>1</sup> and *M*~ <sup>2</sup> after conducting the grid map merging algorithm. In this work, since the rotation angle is not a target of the merged map optimization with the ACO, the rotation angle in *T* is set to 0.

The global pheromone is updated as follows:

*Grid Map Merging with Ant Colony Optimization for Multi-Robot Systems DOI: http://dx.doi.org/10.5772/intechopen.98223*

$$
\pi\_{qr} \leftarrow (\mathbf{1} - \rho)\pi\_{qr} + \sum\_{i}^{N\_{\text{ant}}} \Delta \pi\_{qr}^{i} \tag{6}
$$

where *τqr* is the amount of pheromone deposited for a state transition *qr* . *ρ* is the pheromone evaporation coefficient. *Nant* is the number of ants. Δ*τ<sup>i</sup> qr* is the amount of pheromone deposited by the *i*-th ant, which was set to 1*=***Ψ**ð Þ *Λ<sup>i</sup>* .
