Skip to main content
. 2019 May 26;19(10):2403. doi: 10.3390/s19102403
Algorithm 2 Build the longest barrier when heterogeneous transmitters’ order is given.
12. Input: T¯={{T11,T12,...,T1M1},...,{Tq1,Tq2,...,TqMq}}, R¯={R1,R2,...,RN}
13. Output: the optimal length of barrier len, the optimal BR placement order υ
14. σ=ϕ,τ=ϕ,υ=ϕ,len=0, m=M1+...+Mq
15. // Random generation of transmitter sequence STwith m transmitters′ set T¯
16. ST← Random( T¯) 
17. // Place m + 1 receivers into m + 1 segment areas (place one receiver per sengment)
18. // to construct an initial barrier τ for ST 
19. τ←InitBarrier(ST) 
20. len=Length(τ) // Initial length len of the initial barrier
21. For i←1:N−m−1
22.   For j←1:m+1
23.    Compute the location of receiver pijwhen placing one receiver in sequence ST
24.    Compute the increment of the barrier's length Lij 
25.   σ←σ∪{Lij}
26.   τ←τ∪{pij}
27.   End For
28.  L*←max(σ), p*←τ.index(L*)
29.  len←len+L*, υ←υ∪{ τ(p*) }
30.  σ.clear(), τ.clear()
31. End For
32. Return (len, υ)