Research Article
Directional Itinerary Planning for Multiple Mobile Agents in Wireless Sensor Networks
Algorithm 3
Orders of source nodes according to their decreasing distances.
Var i, j, l, t, m: integer; | Begin | for i :=1 to k do / k: number of neighboring nodes at the Sink / | for j :=1 to N-1 do / N: number of SNs in D[i] / | / D [i] contains the source nodes closest to the line Di / | m: = j; | for l := j+1 to N do | if T[i,l]@dis > T[i,m]@dis then m := l; / we compare the distance of two SN in D[i] / | end for; | if m <> j then | begin | t1 := T[i,m]@dis; / t1: memory cell contains the distance of SN number m in D[i] / | t2 := T[i,m]@id; / t2: memory cell contains the identifier of SN number m in D[i] / | T[i,m]@dis := T[i,j]@dis; / we overwrite T[i,m]@dis by the distance of SN number j in D[i] / | T[i,m]@id := T[i,j]@id; / we overwrite T[i,m]@id by the identifier of SN number j in D[i] / | T[i,j]@dis := t1; / we overwrite T[i,j]@dis by the distance of SN number m in D[i] / | T[i,j]@id := t2; / we overwrite T[i,j]@id by the identifier of SN number m in D[i] / | end; | end for; | end for; | End. |
|