# Dynamic Path Planning for Unmanned Surface Vehicles with a Modified Neuronal Genetic Algorithm
## 4 Method
### Proposed Methodology
The common fitness function for a USV with three input sensors follows Equation (2):  
\[Fitness=\left(\overline{v}\times m_{\overline{v}}\right)+\left(D_{T}\times m_ {D_{T}}\right)+\left(\frac{a_{sens}+b_{sens}+c_{sens}}{3}\times m_{s}\right), \tag{2}\]  
where \((\overline{v})=D_{T}/(\sum t)\) denotes the average speed; \(m_{\overline{v}}\) is the average speed multiplier; \(D_{T}\) denotes the total distance traveled; \(m_{D_{T}}\) is the distance multiplier; \(a_{sens}\), \(b_{sens}\), and \(c_{sens}\) are the values of sensor a, sensor b, and sensor c; and \(m_{s}\) is the sensor multiplier. If the combination of these three variables shows different values, then the difference will be very small if it is in linear space (illustrated in Figure 7). If we apply the fitness function in exponential space, the slightly different output fitness values will be more visible because there is the influence of the power values \(p,\ q\), and \(r\). We also add an inverse of the time parameter so that agents that move in a short time obtain a greater fitness value. Therefore, the form of the proposed fitness function formulation will be as in Equation (3):  
\[Modified\ Fitness=\left[(\overline{v}\times m_{\overline{v}})^{p}+\left(D_{T} \times m_{D_{T}}\right)^{q}+\left(\frac{\sum_{i=1}^{n}Sensor_{i}}{n}\times m_ {s}\right)^{r}\right]\times\frac{1}{(T\times m_{T})}, \tag{3}\]  
where \(n\) denotes the number of sensor inputs, T is the execution time, and \(m_{T}\) is the time multiplier with a constant number. This proposed fitness function modification is expected to produce a GA that can reach a convergent solution more quickly with a shorter USV travel time. Figure 6: General framework for genetic algorithm in the path finding task. Repopulation (Generate New Population)  
As explained in the GA flowchart in Figure 6, if one of the networks in the initial population produces a solution that converges or fits the end function, then the learning process will stop. However, very rarely does the initial population produce convergent solutions. If this happens, then the next process is repopulation or generating a new population. The randomly generated population is evaluated or optimized with genetic operators including selection, crossover, and mutation. Following the application of these three operators, the updated population is assessed to determine whether or not the system has generated a convergent solution. If a convergent solution has not yet been achieved, the population will undergo further processing using the genetic operator to produce a convergent solution. 1. Selection  
The selection operator operates by choosing individual agents from the population, and this selection can be random or based on their fitness values [28]. In this stage, we organize and rank the population according to their modified fitness values using Equation (2). The top-performing individuals are chosen as parents to undergo further processing with the next genetic operator. In this study, we identify the best ten agents and the worst four agents for this purpose. Figure 8 illustrates the selection process of a USV as an agent based on the fitness value. Figure 8: USV selection process based on the fitness value (ranked from the best to the worst fitness value). Figure 7: Illustration of the difference in fitness values in linear and exponential space. Crossover  
In the crossover operator, a higher probability denoted as \(p_{c}\) is implemented compared to that of other genetic operators. This operator involves exchanging one array or segment of one chromosome with the corresponding segment from another chromosome, and this exchange occurs at a random location. The main purpose of this operator is to facilitate the merging or combination of convergent characteristics in a subspace and to generate expected solutions [23]. In the context of the USVs, this operator combines all of the network arrays and swaps the entire set of weights and biases between two parent chromosomes to create two offspring chromosomes.