# Automatic Vertical Parking Reference Trajectory Based on Improved Immune Shark Smell Optimization
## 3 Improved Shark Optimization Algorithm
### Refraction Mechanism  
Opposition Based Learning (OBL) was proposed by [PERSON] in 2005 [20]. By introducing reverse solutions, the search scope of the algorithm can be expanded, thereby improving its global optimization ability. The introduction of a reverse learning strategy in the early stage of algorithm iteration can achieve a significant improvement. With the increase in the number of iterations, the reverse solution will fall into a local optimal phenomenon. To effectively improve the global optimization performance of the shark optimization algorithm, the refractive optimization mechanism, based on the refraction principle, is combined into the shark optimization algorithm, and it is renamed the improved shark smell algorithm (ISSO). The refraction principle diagram is expressed in Figure 2.  
As can be seen from Figure 2, in the \(j\)-th dimension of the solution space (the value is between \(a_{j}\) and \(b_{j}\)), the \(x\)-axis is used as the dividing line. The part above the \(x\)-axis is considered the vacuum of nature, and the part below the \(x\)-axis is considered other media. Above the \(x\)-axis there is a light point \(X\), namely the incident point. An incident light is emitted from the incident point onto the intersection \(O\) with the x-axis, where the incident light length is labeled as \(H\). The incident light will undergo refraction at the point of intersection \(O\), resulting in refracted light with \(Y\) as the refraction point, and the refracted light length is labeled as \(H^{\prime}\). Thus, the formula for calculating the sine value of the incident angle \(\alpha\) and the refraction angle \(\beta\) can be given as  
\[\left\{\begin{array}{l}\sin\alpha=((a_{j}+b_{j})/2-X_{x})/H\\ \sin\beta=(Y_{x}-(a_{j}+b_{j})/2)/H^{\prime}\end{array}\right.. \tag{17}\]  
Further, the formula for calculating the refractive index \(n^{*}\) can be can be derived as  
\[n^{*}{=}\frac{\sin\alpha}{\sin\beta}=\frac{((a_{j}+b_{j})/2-X_{x})/H}{(Y_{x}-( a_{j}+b_{j})/2)/H^{\prime}}. \tag{18}\]  
We make \(f=H/H^{\prime}\), and after the equivalent replacement in the equation, we obtain  
\[Y_{x}=(a_{j}+b_{j})/2+((a_{j}+b_{j})/2-X_{x})/f/n^{*}, \tag{19}\]  
where \(Y_{x}\) and \(X_{x}\) are the x-axis components of the refraction point and the incident point, respectively.  
The refraction point location can be changed through tuning \(f\) and refractive index \(n^{*}\). When the current solution is trapped in the local optimum, the algorithm makes the current solution escape through the refraction optimization mechanism. The refraction optimization mechanism is as follows: after reverse learning, the inverse solution will be obtained; if the inverse solution is still far away from the optimum solution, the location of the candidate solution needs to be changed by repeated refraction operations until it is out of the local optimal solution. A schematic diagram of the specific position relationship  
Figure 2: The diagram of the refraction principle.  
between the refractive solution and the current solution in two-dimensional space is expressed in Figure 3.