## 3 Materials and Methods
### Definitions  
Before describing the proposed algorithms, the problem must be defined. The main purpose of 3D path planning is to find an optimum (or nearly optimal) path between the source (start) and the destination (target) stations. The path planning function is defined as outlined in Equation (1).  
\[f(source,\ destination)\to Trajectory \tag{1}\]  
Source and destination denote the relative coordinates of the source and destination positions on the map. Each path has a cost during movement from source to destination. There are different parameters used to define a cost between two points. In most studies, the cost is considered as the consumption of energy, Euclidean distance, and velocity [20; 21]. For example, the position matrix determines how many stations robots travel from the source to destination. This matrix is defined using Equation (2).  
\[Positions=[p_{1}\,,p_{2},p_{3},p_{4}\dots p_{D}] \tag{2}\]  
where pi represents the position coordinates of each station that our robot takes on the map. In order to find an optimized trajectory, the proposed algorithms try to minimize cost (length of trajectory in our experiment). The cost of the trajectories is calculated using Equation (3), where \(i\) and \(j\) denote the current and next stations.  
\[Cost_{(i,j)}=\sum_{i=s}^{j=D}distance_{i,j}+CurrentPower_{i} \tag{3}\]  
Based on Equation (3), the cost of each founded path is obtained by the sum of distances between tuples from source to destination. Drones can be blended with metaheuristics so they can carry out their mission efficiently. In this regard, not only the distance parameters of the drones but also the remaining power amounts of drones are taken into account in the fitness function, which is defined to be more realistic. Therefore, the result from the metaheuristic algorithm can be used in real environments when applied to mobile robots. Random and optimized trajectories are used for UAV movement from source to destination, as shown in Figure 2. Here, the UAV moved through different stations. In path planning methods, usually, either the robots randomly move or costly processes are undertaken in finding an optimized path, but in this study, we tried to find the most efficient optimized path. This process is performed gradually between both stations. In this way, the UAV tries to find a path between two points. To optimize randomly created paths and to find the best possible trajectory, a method is proposed in this section with a minimum computational cost. Thanks to this method, robots can also actively avoid obstacles. In the final phase, the sum of all tuples' costs is calculated, and the cost of the path is obtained. The purpose of this study was to find the best path between the start and target stations of each UAV.  
Typically, the first step in path planning is to represent the workspace as a map. In the maps, many obstacles were used to make the mobile robots' tasks of finding the path realistic and complex. The challenge was to avoid various obstacles and to reach the position of the destination. In this study, a large-scale map was prepared to evaluate  
Figure 2: The randomly created and optimized trajectory. (**a**) Randomly Created Path; (**b**) Optimized Created Path.  
the proposed algorithms. The boundary of this map is shown in Figure 3a. In addition, three mobile robots with different start and destination stations were used, and their three-dimension points are given in Figure 3b. In this paper, it was assumed that the number of obstacles was quite high in order to make our proposed methods applicable in real areas. The number of obstacles was considered to be 150. Therefore, the coordination of some of the obstacles is presented in Figure 3c, and the full list is presented in Supplementary File 1. The problem of avoiding and managing obstacles is one of the most important aspects of path planning. The used mechanism includes two main steps and algorithms that take place sequentially, which were inspired by [47].