## 2 Materials and Methods
### Classical Algorithms
While increasing the number of generations and intermediate points typically yields more accurate paths, it also raises the computational overhead. Therefore, a compromise is made between the computational cost and solution accuracy, ensuring that the final path is both feasible and near-optimal within the assumed parameters. ```
1:Input: obstacle map map, start \((x_{p},y_{p})\), goal \((x_{k},y_{k})\), parameters \(\eta,\xi,d_{0},K\),
2: Compute the distance transform: \(d\leftarrow\texttt{bvdist}(\texttt{map})\). 3: Define \(\rho(x,y)=\frac{d(x,y)}{K}+1\). 4: The repulsive potential: \(U_{\text{rep}}(x,y)=\eta\left(\frac{1}{\rho(x,y)}-\frac{1}{d_{0}}\right)^{2}\) for \(\rho\leq d_{0}\), and 0 otherwise. 5: The attractive potential: \(U_{\text{att}}(x,y)=\xi[(x-x_{k})^{2}+(y-y_{k})^{2}]\). 6: Total potential: \(U(x,y)\gets U_{\text{att}}(x,y)+U_{\text{rep}}(x,y)+U_{\text{rand}}(x,y)\)
7: Compute the gradient: \((g_{x},g_{y})\leftarrow\
abla\big{(}-U(x,y)\big{)}\). 8: Initialize _route_ with \((x_{p},y_{p})\). 9:for\(i=1\) to max_isdo
10: If \(\|(x_{p},y_{p})-(x_{k},y_{k})\|\leq\textit{Tolerance}\), then break. 11: Retrieve \(\Delta_{x}=g_{x}\), \(\Delta_{y}=g_{y}\); move in the \(\Delta\) direction. 12: Append the new position to route. 13:endfor
14:Output: route. ```  
**Algorithm 4** Artificial potential field  
```
1:Input: obstacle map map, start \((x_{p},y_{p})\), goal \((x_{k},y_{k})\), parameters (scale, th)
2:Preprocess map:resize (imresize) by scale and apply morphological imdilate,imclose operations. 3:Scale coords:\(x_{p}^{\prime}\leftarrow\text{round}(x_{p}\cdot scale)\), \(y_{p}^{\prime}\leftarrow\text{round}(y_{p}\cdot scale)\); similarly, \((x_{k}^{\prime},y_{k}^{\prime})\). 4:Mark obstacles:for each cell \((i,j)\), if map\((i,j)>th\), then add \((i,j)\) to CLOSED. 5:Initialize OPEN:insert start node with \((g=0,\ h=\text{dist}(\text{start},\text{goal}),\ f=g+h)\). 6:Set \(x_{\text{node}}=x_{p}^{\prime}\), \(y_{\text{node}}=y_{p}^{\prime}\), \(\text{NoPath}=1\). 7:while\((x_{\text{node}}\
eq x_{k}^{\prime}\) or \(y_{\text{node}}\
eq y_{k}^{\prime})\) and NoPath\(=1\)do
8: Expand neighbors \(\{(x_{n},y_{n})\}\) not in CLOSED; compute \(g_{n}=g+\text{dist}(x_{n},y_{n})\). 9: Let \(h_{n}=\text{dist}((x_{n},y_{n}),(x_{k}^{\prime},y_{k}^{\prime}))\) and \(f_{n}=g_{n}+h_{n}\); update OPEN or insert new node if better \(f_{n}\). 10: Pick the node with the min \(f\) in OPEN; set \((x_{\text{node}},y_{\text{node}})\) to that node, and move it to CLOSED. 11: If no node can be picked (OPEN empty), set NoPath\(=0\). 12:endwhile
13:Path reconstruction:if the goal is found, backtrack the parents from \((x_{k}^{\prime},y_{k}^{\prime})\) to \((x_{p}^{\prime},y_{p}^{\prime})\). 14:Rescale path:\(x\gets x/scale\), \(y\gets y/scale\). 15:Append start/goal to ensure a full route: route \(\leftarrow[(x_{p},y_{p}),\ldots,(x_{k},y_{k})]\). 16:Output:route. ```  
**Algorithm 5**A* algorithm  
Particle swarm optimization (PSO) is inspired by the collective movement patterns of animals, such as flocks of birds. In this method, a population of particles (paths) is randomly generated. Each particle consists of two intermediate waypoints between the start and the target. In each iteration, the position of every particle is evaluated with the same objective function used in the GA-based solution, and the global best position (of the entire swarm), as well as each particle's personal best position, is updated. The movement of a particle is governed by its inertia, its tendency to move towards its personal best position, and its attraction to the best position in the neighborhood. If a particle crossesthe map boundary or is predicted to do so, its velocity is set to zero, and its position is clamped to the boundary. After each update, the objective function is recalculated, and better solutions replace the previous personal or global best positions. Once there is no significant improvement in the best result (less than \(10^{-6}\) m) for 15 consecutive iterations (the stall condition), the algorithm terminates.