## 3 Localization Algorithm
### The Dynamic Reference Selection-Based Self-Localization Algorithm
#### 3.2.2 The Dynamic Reference Selection Scheme  
Based on the prediction-based self-localization algorithm, we can predict the mobility pattern of any mobile node in DUANs. According to the predicted mobility pattern, we can estimate the node's position directly.  
\[\widehat{\Gamma}_{j}(k+1\mid k)=F\times\left[\begin{array}{c}X_{j}(k)\\ v_{j}(k)\\ a_{j}(k)\end{array}\right] \tag{12}\]  
According to Equations (12) and (5), we can get the dynamic reference selection scheme expressed as (13).  
\[\begin{array}{ll}\min\limits_{\begin{subarray}{c}\Gamma_{i}(k+1\mid k)\in \Gamma(k+1\mid k)\end{subarray}}&\sum\limits_{j=1}^{i-1}\sum\limits_{j=i+1}^{ M}b_{ij}(k+1\mid k)^{T}(I-A(k+1\mid k)(A(k+1\mid k))^{T}A(k+1\mid k))^{-1}A(k+1 \mid k)^{T})b_{ij}(k+1\mid k)\\ s.t.&A(k+1\mid k)=\begin{bmatrix}-\hat{x}_{i}(k+1\mid k)&-\hat{y}_{i}(k+1 \mid k)&-\hat{z}_{i}(k+1\mid k)\\ 2(\hat{x}_{2}(k+1)-\hat{x}_{i}(k+1\mid k))&-2\hat{y}_{i}(k+1\mid k)&-2\hat{z}_ {i}(k+1\mid k)\\ 2(\hat{x}_{3}(k+1)-\hat{x}_{i}(k+1\mid k))&2(\hat{y}_{3}(k+1)-\hat{y}_{i}(k+1 \mid k))&-2\hat{z}_{i}(k+1\mid k)\\ -(\hat{x}_{i}(k+1\mid k))^{2}-(y_{i}(k+1\mid k))^{2}-(\hat{z}_{i}(k+1\mid k)) ^{2}+\Delta t_{i}^{2}(k+1)\\ \hat{x}_{2}(k+1)^{2}-(\hat{x}_{i}(k+1\mid k))^{2}-(\hat{y}_{i}(k+1\mid k))^{2 }-(\hat{z}_{i}(k+1\mid k))^{2}+\Delta t_{i}^{2}(k+1)\\ \hat{x}_{3}(k+1)^{2}-(\hat{x}_{i}(k+1\mid k))^{2}+\hat{y}_{3}(k+1)^{2}-(\hat{ y}_{i}(k+1\mid k))^{2}-(\hat{z}_{i}(k+1\mid k))^{2}+\Delta t_{3}^{2}(k+1) \end{bmatrix}\\ \Gamma_{i}(k+1\mid k)=F\Gamma_{i}(k\mid k)=\begin{bmatrix}\hat{X}_{i}(k+1\mid k )\\ \hat{\theta}_{i}(k+1\mid k)\\ \hat{x}_{i}(k+1\mid k)\end{bmatrix}\\ \Delta t_{n}^{i}=d_{ij}^{2}-d_{nj}^{2}&n=1,2,3\\ d_{ij}=\parallel X_{i}(k+1\mid k)-X_{j}(k+1\mid k)\parallel&I=1,2,3,i\end{array} \tag{13}\]  
Combining the dynamic reference selection scheme and the prediction-based self-localization algorithm, we can get the dynamic reference selection-based self-localization algorithm. The self-localization procedure is shown as follows:  
1. [leftmargin=*,noitemsep,topsep=0 pt]
2. Anchors select the initial optimal reference node according to Equation (5);
3. Each unknown ordinary node predicts its own mobility pattern and position according to the range measurements as in Equation (9) and sends them to the anchors ;
4. Anchors receive the predicted mobility patterns and positions obtained above, set them to be the prior information and then update the reference selection dynamically according to the predicted information as in Equation (13);
5. If the reference selection remains unchanged, the previous predicted mobility patterns will still be used to estimate the drifted nodes' positions continually. If the reference selection changes, we will re-estimate the mobility patterns and re-predict the drifted nodes' positions again according to Equation (9).  
As described above, we can see that the dynamic reference selection-based self-localization algorithm can increase the localization accuracy with both insufficient anchors and varying topology which is more appropriate for the drifted underwater acoustic networks.