## 3 Algorithm Design
### PCFL and ACFL
```
1:if the mobile node \(n_{i}\) senses the request command of localization then
2:\(n_{i}\) sends the acoustic signal in the communication range
3:if\(n_{i}\) receives the acknowlegement signals from the task anchors then
4:\(n_{j}\) is named as the task anchor
5:\(\alpha^{\prime}_{ij}\) and \(k^{\prime}_{ij}\) are measured by AOA and the deployed pressure sensors respectively
6:\(d^{\prime}(n_{i},n_{j})=k^{\prime}_{ij}/\sin\alpha^{\prime}_{ij}\)
7:\(p^{\prime}_{ij}=k^{\prime}_{ij}/\tan\alpha^{\prime}_{ij}\)
8:endif
9:endif
10:while\(\{R^{at}_{j},G^{at}_{j},B^{at}_{j}\}\) is the RGB values for the task anchors

\(\{R^{gt}_{j},G^{gt}_{j},B^{gt}_{j}\}\) is the RGB values for the task anchors' projections do
11:\(H^{\mu}_{j}S^{\mu}_{j}V^{\mu}_{j}=(RGB\) to \(HSV)R^{\mu}_{j}G^{\mu}_{j}B^{\mu}_{j};k=p,a\)
12:\(H^{kt}_{ij}=H^{kt}_{j},S^{\mu}_{ij}=S^{kt}_{j},V^{\mu}_{ij}=(1- \frac{d^{\prime}_{ij}}{Range})\times V^{\mu}_{j},k=p,a;d^{t}_{ij}=p^{t}_{ij}\) or \(d^{t}_{ij}=d^{t}(n_{i},n_{j})\)
13:\(R^{kt}_{j}G^{kt}_{j}B^{\mu}_{j}=(HSV\) to \(RGB)H^{\mu}_{j}S^{\mu}_{j}V^{\mu};k=p,a\)
14:\(\lambda^{\prime}_{ij}=\frac{\left(d^{\prime}_{ij}\right)^{-1}}{ \sum_{n_{j},\in,\mathcal{L}}\left(d^{\prime}_{ij}\right)^{-1}},d^{ \prime}_{ij}=p^{\prime}_{ij}\) or \(d^{t}_{ij}=d^{t}(n_{i},n)\)
15:\(\{R^{\mu}_{i},G^{\mu}_{i},B^{kt}_{i}\}=\sum_{n_{j},\in,\mathcal{L}}\lambda^{ \prime}_{ij}\{R^{\mu}_{j},G^{kt}_{j},B^{kt}_{ij}\}\) \(k=p,a\)
16:endwhile
17:if\(S^{\prime}_{i}=\{(x,y,z)\big{|}\forall n^{\prime}_{j}\in B^{t}_{i},\forall \left(x-x^{\prime}_{j}\right)+\left(y-y^{\prime}_{j}\right)^{2}\leq\sqrt{ \left(R^{2}-\left(k^{\prime}_{ij}\right)^{2}\right)},z=z_{i}\}\)then
18:\(S^{\prime}_{i}\) is the set of the sampling area
19:endif
20:if\(\{R^{s_{i}t}_{i},G^{s_{i}t}_{i},B^{s_{i}t}_{i}\}\) is the RGB sequence of sample \(s_{k}\)then
21:\(\mu^{\prime}_{s_{i}M}=\sqrt{\left(R^{s_{i}t}_{i}-R^{ht}_{i}\right)^{2}+\left( G^{s_{i}t}_{i}-G^{ht}_{i}\right)^{2}+\left(B^{s_{i}t}_{i}-B^{ht}_{i}\right)^{2}}\) (\(i=p+1,...q;k=1,2,...m\))
22:\(\tilde{S}^{t}_{i}=\{s_{k}\big{|}s_{k}\in S^{t}_{i},\mu^{t}_{s_{i}M}\leq\mu^{t} \},n_{i}\in M\)
23:\(\tilde{\mu}^{\prime}_{s_{i}M}=\mu^{\prime}_{s_{i}M}\left(\sum\mu^{\prime}_{s_ {i}M}\right)^{-1},s_{k}\in\tilde{S}^{t}_{i}\)
24:\(x^{\prime}_{i}=\sum_{S_{k}\in S^{t}_{i}}x^{\prime}_{s_{k}}\tilde{\mu}^{t}_{S_{k }M},y^{\prime}_{i}=\sum_{S_{k}\in S^{t}_{i}}y^{\prime}_{S_{k}}\tilde{\mu}^{t} _{S_{k}M}\)
25:endif
```  
**Algorithm 1**The PCFL and ACFL algorithms. From Algorithm 1, it can be seen that PCFL and ACFL are two localization methods for mobile nodes (line 1). In UASNs, nodes communicate with each other using acoustic signals (line 2). If the mobile node receives the feedback signals from the anchors within communication range, then, the anchors are named as the task anchors to localize the mobile nodes (lines 3, 4). When the mobile node obtains the feedback signals (including the depth information and the locations of the task anchors),the geographic distance \(d^{\iota}(n_{i},n_{j})\) between the anchor \(n_{i}\) and the mobile node \(n_{i}\) can be obtained. At the same time, the distance \(p_{\bar{\mathit{g}}}^{\iota}\) between the mobile node \(n_{i}\) and the task anchor's projection \(n_{i}^{\prime}\) can be obtained too (lines 5, 6, 7). The RGB values for task anchors' projections (PCFL) and task anchors (ACFL) are assigned (line 10). The HSV values for task anchors' projections (PCFL) or for task anchors (ACFL) are calculated using the traditional convert algorithm RGB to HSV (line 11). Then the HSV values between the mobile node \(n_{i}\) and the task projection \(n_{j}^{\prime}\) (or task anchor \(n_{j}\)) can be calculated (line 12). The RGB values between the mobile node \(n_{i}\) and the task projection \(n_{j}^{\prime}\) (or task anchor \(n_{j}\)) can be calculated by the traditional convert algorithm HSVtoRGB (line 13). Then the proportion factor of distances weights \(\lambda_{\bar{\mathit{g}}}^{\iota}\) can be calculated (line 14).