|
Algorithm 1: Cross-layer optimization for low-power and lossy networks using iCPLA |
while the device is on do
set maximum retry limit
set maximum backoff stages
setCWmin = 0, CWmax = 31
set current reward = 0, (s, a) = 0, (s, a) = 0
BE = MIN (n_collisions, CSMA_MAX_BE)
measure CW using BE in (6)
calculate using CW in (7)
calculate using (8)
counter ++
if (counter = 5), then
counter = 1
=
end if
if, then
reward = positive
else
reward = negative
update reward table for r (s, a)
update Q-values table according to (2)
pick a random value to explore and exploit
if (exploit), then
find IP address
else (explore)
if (node = root node), then
root rank = 1
end if
if (parent = null), then
rank = max path cost
end if
if (parent != null), then
= (
end if
if, then
rank = base rank (128)
end if
return MIN
end while
|