## 3 The Proposed Sensor Deployment Algorithms
### The Particle Swarm/Genetic Hybrid Algorithm
The flowchart of the PSGH algorithm is shown in Figure 3. Also, we design the pseudocode for the particle swarm/genetic hybrid algorithm. For clarity, the hybrid algorithm is divided into two parts: one part for the particle swarm Algorithm 1 and the other for the genetic Algorithm 2. The next step is to analyze the complexity of the PSGH Algorithm, for the PSO Algorithm, assuming the population size of the particle swarm algorithm is \(N_{1}\), the number of iterations is \(M_{1}\), and the algorithm's complexity is \(O(M)\), the overall algorithm complexity is as follows:  
\[O(K)=N_{1}\times O(M)+M_{1}\times N_{1}\times O(M) \tag{12}\]  
For the GA Algorithm, make the number of sensors provided by the particle swarm algorithm be \(m\), the population size of the genetic algorithm be \(N_{2}\), and the number of iterations be \(M_{2}\). Then, the complexity of generating the population is:  
\[O(I)=N_{2}\times\text{m} \tag{13}\]  
The complexity of iteration \(O(D)\) can be expressed as:  
\[O(D)=M_{2}\times\frac{N_{2}}{2}+M_{2}\times N_{2}\times m \tag{14}\]```
1: Initialize the population size of the particle algorithm P_N and the maximum number of iterations for the algorithm Max_Iter_P. 2: Generate sensor candidate locations Can_Pos. 3: Generate target locations to be monitored Goal_Pos. 4: Set the areas where deployment is not possible Prohibit_Pos
5:for i = 1 to P_N do
6: Generate the current individual position pos(i). 7: Generate the current individual velocity v(i). 8: Calculate the minimum deployment cost under the current sensor based on the cost calculation formula (fitness value solved by the geneticalgorithm): \(\textbf{F}=\alpha_{1}\textbf{f}_{1}+\alpha_{2}\textbf{f}_{2}+\alpha_{3}\textbf {f}_{3}+\alpha_{4}\textbf{f}_{4}\). 9:endfor
10: Obtain the best individual in the population and the optimal value. 11: Obtain the individual's historical best value. 12:for i = 1 to Max_Iter_P do
13: Update the velocity v of the population individuals. 14: Update the position pos of the population individuals. 15: Boundary value constraints. 16: Recalculate the minimum deployment cost (fitness value) for the currently updated population. 17:if Updated optimal value < The saved optimal value then
18: The saved optimal value = Updated optimal value. 19:endif
20:endfor
```

**Algorithm 1** Particle Swarm Optimization (PSO)

```
1: Obtain the population size of the genetic algorithm G_N. The number of sensors determined by the particle swarm algorithm P_m. The maximum number of iterations for the genetic algorithm Max_Iter_G. Mutation probability Pm. 2: Initialize the population Pos_initialize, Here, at each sensor candidate location, at most one sensor can be deployed. Obtain the initial population GA_Position and Minimum deployment cost (fitness value) Gen_fitness. 3:for i = 1 to Max_Iter_G do
4: Perform fitness value sorting and select the better parent individuals for genetic iteration preparation. 5:for j = 1 to G_N/2 do
6: Generate crossover gene positions crossover_gene. 7:for k = 1 to crossover_gene do
8: Crossover the better parent individuals GA_Position(j,k)<->GA_Position(j + 1,k). 9:endfor
10:endfor
12:for j = 1 to G_N do
13:if rand<P_m then
14: Execute the mutation operator function amd the constraint check function. else
15: Check whether the individuals after crossover satisfy the constraints. If not satisfied, regenerate the individual. 16:endif
17: Recalculate the fitness value. 18:if Updated optimal value < The saved optimal value then
19: The saved optimal value = Updated optimal value. 20:endif
21:endfor
```

**Algorithm 2** Genetic Algorithm (GA)The complexity of the genetic algorithm \(O(M)\) is as follows:

\[ \begin{array}{l}O(M)=O(I)+O(D)\\ \qquad\qquad=N_{2}\times m+M_{2}\times\frac{N_{2}}{2}+M_{2}\times N_{2}\times m\\ \qquad\approx M_{2}\times N_{2}\times m\end{array}  \tag{15}\]

Therefore, the complexity of the PSGH algorithm \(O(K)\) is given:

\[