# Salp Swarm Algorithm Optimized A* Algorithm and Improved B-Spline Interpolation in Path Planning
## 2 Path Planning Algorithm
### Improvement of the A* Algorithm
#### 2.2.2 Optimization Using the SSA
Using these optimal weight parameters, the heuristic function \(h(n)\) is determined and subsequently employed for path planning. The pseudo-code for the optimization of the A* algorithm using the SSA is shown in Algorithm 1 below. ```
0: Grid map \(G\), start point \(S\), end point \(E\), weight bounds \(\Omega_{bounds}\), population size \(N\), maximum iterations \(T\) Output: Optimal path \(P\), visited nodes list \(V\), optimal weight \(\Omega^{*}\)
1:BEGIN:
2:Initialization:  Define 8-neighborhood direction set \(D=\{(-1,0),(1,0),(0,-1),(0,1),(-1,-1),(-1,1),(1,-1),(1,1)\}\)  Initialize SSA population \(P=\{\Omega_{i}\mid\Omega_{i}\sim Uniform(\Omega_{bounds}),i=1,2,\ldots,N\}\)  Initialize optimal weight \(\Omega^{*}\gets argmin_{\Omega\in P}\mathit{Fitness}(\Omega)\)  Initialize optimal fitness \(F^{*}\gets Fitness(\Omega^{*})\)  Initialize iteration counter \(t\gets 0\)
3://SSA Optimization Process:
4:While\(t<T\):
5:For each\(\Omega_{i}\in P\) :
6:If\(Random()<0.5\) :
7:\(\Omega_{i}^{\prime}\leftarrow\Omega^{*}+Uniform(-0.3,0.3)^{3}\)
8:Else:
9:\(\Omega_{i}^{\prime}\leftarrow\frac{\Omega_{i}+\Omega^{*}}{2}\)
10:Clip \(\Omega_{i}\) to \(\Omega_{bounds}\)
11:\(Ft^{\prime}\gets Fitness\big{(}\Omega_{i}^{\prime}\big{)}\)
12:If\(F_{i}^{\prime}<F^{*}\) :
13:\(\Omega^{*}\leftarrow\Omega_{i}^{\prime}\)
14:\(F^{*}\gets F_{i}^{\prime}\)
15:\(P\leftarrow\big{\{}\Omega_{i}^{\prime}\big{\}}\)
16:Record current optimal fitness \(F^{*}\)
17:\(t\gets t+1\)
```  
**Algorithm 1**Improved A* Algorithm with the SSA Optimization```
18://A* Path Search:Use optimal weight \(\Omega*\) to execute A* algorithm:
19: Initialize open list \(O\leftarrow\{(f(S),0,S)\}\), parent map \(C\leftarrow\{\}\), cost map \(G\leftarrow\{S:0\}\), and visited nodes list \(V\leftarrow[]\)
20:While\(O\) is not empty:
22: Pop \((f,g,Q)\gets HeapPop(O)\)
23:If\(Q=E:\)
24:\(P\gets ReconstructPath(C,S,E)\)
25:Return\(P,V\)
26:Add \(Q\) to \(V\)
27:For each\((dx,dy)\in D:\)
28:\(Q^{\prime}\leftarrow(Q_{x}+dx,Q_{y}+dy)\)
29:If\(Q^{\prime}\) is out of bounds or \(G[Q^{\prime}]=1:\)
30:Continue
31:\(c\gets DiagonalDistance\) if \(\mid dx\mid+\mid dy\mid=2\) else \(1\)
32:\(g^{\prime}\gets g+c\)
33:If\(Q^{\prime}\
otin G\) or \(g^{\prime}<G[Q^{\prime}]:\)
34:\(G[Q^{\prime}]\gets g\)
35:\(C[Q^{\prime}]\gets Q\)
36:\(h\leftarrow Heuristic(Q^{\prime},E,\Omega^{*},G)\)
37:\(f^{\prime}\gets g^{\prime}+h\)
38:\(\text{Push}\left(f^{\prime},g^{\prime},Q^{\prime}\right)\) into \(O\)
39:Return\(None,V\)
40:END
```

**Algorithm 1**\(Cont\). Our work, compared with recent SSA-based path planning studies, demonstrates distinct focuses and innovations. Our proposed algorithm employs SSA to optimize the heuristic function weights of the A* algorithm, dynamically adjusting the weights by incorporating Chebyshev distance, Euclidean distance, and obstacle density to enhance search efficiency. [PERSON] et al. [29] improved the SSA for AUV path planning by introducing the Levy flight strategy and a nonlinear convergence factor to boost the algorithm's global search capability and convergence speed. Meanwhile, [PERSON] et al. [30] applied SSA to ground vehicle path planning, exploring a new application scenario for the algorithm. ## 3 Path Smoothing Algorithm

### B-Spline Interpolation Curve

B-spline is a mathematical method commonly used in computer graphics and data fitting. It consists of a series of control points, knot vectors, and a set of basis functions. The control points determine the shape of the spline curve, allowing shape adjustments by repositioning them. The knot vector defines the distribution of the spline curve in parameter space and determines the influence range of each control point on the spline curve. The algorithm utilizes a set of basis functions to construct the spline curve. By weighting the control points with the corresponding basis functions, a smooth interpolated curve can be obtained. The basis functions are computed using a recursive formula, defined as (7) and (8). \[k=0,B_{i,0}(t)= \begin{cases}1,&t_{i}\leq t\leq t_{i+1}\\ 0,&Otherwise\end{cases}