Self-Administered Information Sharing Framework Using Bioinspired Mechanisms
Algorithm 3
Determine the time-to-live of a SP.
(1)
Process 1: assign contained energy to each prey (node)
(2)
for all the node in the network do
(3)
Set the minimal number of hops to the closest exit at node to an extremely large value
(4)
When an ACK has arrived, extract the number of hops to the exit in the route which has been brought back by this ACK
(5)
ifthen
(6)
Then
where represents the number of hops to the exit in the route brought back by the latest ACK
(7)
Assign the contained energy of node :
(8)
end if
(9)
end for
(10)
Process 2: optimise the time-to-live of a SP
(11)
for all the node in the network do
(12)
Calculate the average number of hops from the obtained paths in the mailbox
(13)
for all the SPs sent from node do
(14)
Set the total obtained energy to 0 initially
(15)
When a SP reaches a new node
(16)
(17)
/ If the traversed number of hops of the current SP is larger than or equals to /
(18)
ifthen
(19)
if current node is not an exit node then
(20)
/ is the contained energy of the current node, is the average handling time, which is set to 1 (one hop), is the average energy obtained from the current path, which can be calculated by , is the average searching time, which is also 1 (one hop), and term which depicts the average searching time to discovery a prey is set to 0 /