## 4 Multi-Sensor Detection with Particle Swarm Optimization
### Decorrelation Detection with Particle Swarm Optimization at Cooperative Sensor
\begin{split}\hat{\boldsymbol{d}}\_PSO_{s,n}=&[\hat{ \boldsymbol{d}}_{1}^{\,\,1},\cdots,\hat{\boldsymbol{d}}_{s}^{\,\,1},\cdots, \hat{\boldsymbol{d}}_{s}^{\,\,1}]^{T}\\ =&[\hat{\boldsymbol{d}}\_PSO_{s,n}^{\,\,1},\cdots, \hat{\boldsymbol{d}}\_PSO_{s,n}^{\,\,\,1},\cdots\hat{\boldsymbol{d}}\_PSO_{s,n}^{\,\, \,1}]\\ =&\left[\begin{array}{ccccc}\hat{d}_{1}^{\,\,1} (1)&\cdots&\hat{d}_{1}^{\,\,1}(m)&\cdots&\hat{d}_{1}^{\,\,1}(M)\\ \vdots&&\vdots&&\vdots\\ \hat{d}_{k}^{\,\,1}(1)&\cdots&\hat{d}_{k}^{\,\,1}(m)&\cdots&\hat{d}_{k}^{\,\, 1}(M)\\ \vdots&&\vdots&&\vdots\\ \hat{d}_{k}^{\,\,1}(1)&\cdots&\hat{d}_{k}^{\,\,1}(m)&\cdots&\hat{d}_{k}^{\,\, 1}(M)\end{array}\right]\\ \end{split}  \tag{23}\]  
Thus, the estimated channel coded frame \(\hat{\boldsymbol{b}}_{i}^{\,\,1}\) of source sensor \(S_{i}\) can be obtained at cooperative sensor \(P_{i}\) by decoding the time-frequency coded frame \(\hat{\boldsymbol{d}}_{i}^{\,\,1}\) according to Figure 4. Based on the above analysis, the basic procedure of D-PSO algorithm for a cooperative sensor \(P_{i}\) (\(l=1,\cdots,K\)) of the time-frequency coded cooperative MC-CDMA WSN can be given by the following steps:  
(1) Convert the received signal vector \(\boldsymbol{r}_{\boldsymbol{s},\boldsymbol{\rho}_{i}}\) into frequency-domain signals \(\boldsymbol{y}_{\boldsymbol{s},\boldsymbol{\rho}_{i}}\) through serial-to-parallel converting and Fast Fourier Transform (FFT), then block and regroup \(\boldsymbol{y}_{\boldsymbol{s},\boldsymbol{\rho}_{i}}\) to get the detection vector \(\boldsymbol{y}_{\boldsymbol{s},\boldsymbol{\rho}_{i}}^{\,\,m}\) of the \(m\)-th symbol;  
(2) Apply D-MSD to \(\boldsymbol{y}_{\boldsymbol{s},\boldsymbol{\rho}_{i}}^{\,\,m}\), and set its output \(\hat{\boldsymbol{d}}\_D_{\boldsymbol{s},\boldsymbol{\rho}_{i}}^{\,\,m}\) as the initial position of the first particle of D-PSO algorithm, _i.e._, \(\boldsymbol{X}_{t,l}^{\,\,m}=\hat{\boldsymbol{d}}\_D_{\boldsymbol{s},\boldsymbol {\rho}_{i}}^{\,\,m}\) ;  
(3) Update the position and velocity of each particle of the \(m\)-th symbol vector according to Equations (18) and (19);  
(4) Update the local best position \(\boldsymbol{pbest}_{\boldsymbol{\rho},i}^{\,\,m}\) and global best position \(\boldsymbol{gbest}_{i}^{\,\,m}\) of the \(m\)-th symbol vector with Equations (20) and (21);  
(5) Renew the iteration number, \(i=i+1\) and return to step (3). When the iteration time arrives at \(\textit{Max\_dt}\), D-PSO algorithm outputs the multi-sensor detection result \(\hat{\boldsymbol{d}}\_PSO_{s,n}^{\,\,m}\) with particle swarm optimization. In the iterations of the D-PSO algorithm, each particle adjusts its position continuously according to the objective function to gradually converge to the global best position. Since the D-PSO algorithm utilizes the output of D-MSD to provide a good initialization for the particle swarm, particles can quickly converge to the global best position. Though the complexity of D-PSO algorithm with O (\(N_{p}\times\textit{Max\_dt}\)) is slightly higher than that of D-MSD algorithm with O (\(K\)), it is much lower than that of O-MSD algorithm with O (\(2K\)). However, the simulation results in section 5 show that the BER performance of D-PSO algorithm is much better than that of D-MSD algorithm.