# Path Optimization Using Metaheuristic Techniques for a Surveillance Robot
## 5 Simulation Results  
For each of the three scenarios (rooms), the three optimization algorithms have been implemented with Matlab software and their efficiency has been compared using the following metrics:  
1. Non coll. Time: Time it takes the algorithm to make the robot avoid obstacles. 2. Non coll. Iterations: Number of iterations it takes the algorithm to make the robot avoid obstacles. 3. Time 100%: Minimum time it takes to reach 100% coverage. 4. Iterations 100%: Number of iterations it takes to reach 100% coverage. 5. Best Dist. : Best trajectory distance (lowest). 6. Best %: Best percentage of coverage (maximum). The first two metrics are related to the obstacle avoidance objective (first part of the cost function). The next two metrics evaluate the time it takes the algorithm to reach full coverage of the space. In other words, they are used to compare the speed of the different methods. Finally, the best result in terms of distance, and the best percentage of coverage are obtained. The latter refers to the possible case in which a complete coverage could not be achieved, either because the space is too large, or because of the lack of waypoints in the trajectory. Furthermore, the evolution of the cost function for each scenario and optimization algorithm is also presented. In addition, the GA, PSO, and PS algorithms need an initial path on which to start the calculation. The criterion followed to implement it is that two starting restrictions are determined: a waypoint cannot be separated from the immediately preceding one by a distance greater than the sensor range, and the direction when traveling the path must be clockwise. Finally, another restriction has been imposed on the number of waypoints for each trajectory. The number of crossing points for each scenario is as follows: eight for the small room, twelve for the medium room, and thirty-two for the large and more complex room. Tables 2-4 show the metrics obtained for the different scenarios. The computer model used to obtain all these results has been a Dell Vostro 5471. It has 8 GB of RAM and an i7 8 th generation processor. The version of the simulation tool was Matlab 2020b. \begin{table}
\begin{tabular}{c c c c c c c} \hline
**Technique** & **Non Coll. Time** & **Non Coll. Iterations** & **Time 100\%** & **Iterations 100\%** & **Best Dist.** & **Best \%** \\ \hline GA & 0:05:48 & 115 & 0:05:48 & 115 & 8460 & 100\% \\ SP & 0:03:25 & 21 & 0:03:25 & 21 & 8350 & 100\% \\ PS & 0:03:03 & 6 & 0:03:03 & 6 & 6220 & 100\% \\ \hline \end{tabular}
\end{table} 
Table 2: Low-complexity room results. The best trajectories after eight hours of computation are shown in Figure 9 for each technique, GA (a), PSO (b), and PS (c). The initial trajectory is shown in blue and the optimized one in red. As expected in view of the quantitative results, the PS algorithm presents the best trajectory, without abrupt changes or any repeated displacements that worsen the efficiency. On the contrary, the solutions offered by the other two optimization algorithms present some of these inefficiencies. This result is reflected in the final trajectory time, which is considerably lower with PS than with GA or PSO. In summary, the qualities of the solutions generated are strongly linked to the solution search method applied. As the results reveal, particularly in the context of a low complexity environment, a local search algorithm like PS emerges as the most favorable option. This algorithm excels in situations where fine-tuning within a limited search space is critical to achieving optimal results. To show the validity of the proposal in a real-world environment, where LiDAR may be affected by noise in point cloud data, and the presence of moving objects could influence the robot's LiDAR mapping, the low-complexity environment was recreated in the laboratory. Figure 9(a) shows the real environment without the presence of external obstacles, and Figure 9(b) shows the mapping of the environment.