## 2 Materials and Methods
### Classical Algorithms
In the tested configuration, the swarm size was 50, and each of the two waypoints was bounded between 0.01 and 0.91 of the map size. This approach effectively balances exploration (through random updates and a large swarm size) and exploitation (focusing on the best local and global positions), gradually converging to a near-optimal path solution. The pseudocode for the used approach is presented in Algorithm 7. ```
1:Input: binary map, start \((x_{p},y_{p})\), goal \((x_{k},y_{k})\), number of waypoints noPoints, population size popSize, max generations maxGen, penalty \(\mathcal{P}\)
2:Cost function distanceCostGA(\(\mathbf{x}\)): interpret each waypoint \((x_{i},y_{i})\in[0,1]^{2}\), scale to the map size, and build \(path=[\texttt{start};\)\((x_{1},y_{1}),\ldots,(x_{\texttt{noPoints}},y_{\texttt{noPoints}});\) goal\(]\); then, \(cost=\sum_{i=1}^{L-1}\texttt{subCost}(path_{i},path_{i+1})\). 3:subCost(\(p,q\)): subdivide the segment \((p\to q)\); each small step \(\Delta\) adds \(\Delta\) if properPoint is true; otherwise, \(\mathcal{P}\times\Delta\). 4:properPoint(\(r\)) checks whether \(1\leq r_{x}\leq\dim_{x}\), \(1\leq r_{y}\leq\dim_{y}\), and map\((r_{x},r_{y})=0\); returns false for obstacles/out of bounds. 5:Initialize the population \(P_{0}\) of random individuals with the size popSize
6:Evaluate distanceCostGA(\(\cdot\)) for each solution in \(P_{0}\); let best be the individual with the minimal cost. 7:for\(t=1\ldots\texttt{maxGen}\)do
8:\(\mathit{elite}\leftarrow\) top max\((1,0.05\cdot\texttt{popSize})\) solutions in \(P_{t-1}\)
9: Use stochastic uniform selection on \(P_{t-1}\) to pick parents. 10: Apply scattered crossover (with the probability CrossoverFraction = 0.8) to produce children. 11: Mutate the children with the gaussian mutation operator. 12: Form \(P_{t}\) by adding \(\mathit{elite}\) plus enough children to maintain size = popSize. 13:\(\mathit{currentBest}\leftarrow\arg\min_{x\in P_{t}}(\texttt{distanceCostGA}(x))\);
14:ifdistanceCostGA(\(\mathit{currentBest}\)) \(<\) distanceCostGA(\(\mathit{best}\)), then best \(\leftarrow\) currentBest
15:endfor
16:Reconstruct the final path: Scale the best waypoints to map the coords, prepend source, and append goal. 17:Output:path and cost. ```  
**Algorithm 6** Genetic algorithm  
The last classical algorithm employed in this study is the RRT\({}^{\star}\), as outlined in Algorithm 8. The Rapidly Exploring Random Tree-Star (RRT*) algorithm incrementally constructs a collision-free path in a grid map by growing a tree from the start position. At each iteration, a random point is sampled, biased with a 10% probability toward the goal to expedite the convergence. The algorithm identifies the nearest node in the tree, extends it by a fixed step size toward the sampled point, and verifies collision-free movement. If valid, the new node is added to the tree, and nearby nodes within a neighbor radius are evaluated to optimize the path costs through rewiring--reassigning parents to minimize the cumulative travel distance. This rewiring ensures asymptotic optimality by locally refining the tree structure. The process iterates until the goal is reached within a specified threshold or a maximum iteration limit is exceeded. RRT* balances exploration of the configuration space through random sampling with the exploitation of shorter paths via cost-aware rewiring, progressively converging to an optimal solution. The algorithm terminates upon reaching the goal or exhausting its iterations, after which the shortest path is reconstructed by backtracking the parent nodes from the nearest goal-proximate node to the start.