(1) initialize each 𝑒 𝑖 𝑗 = 𝑒 𝑖 𝑗 , the detection probability of 𝑆 𝑖 for 𝑇 𝑖
(2) initialize each task cumulative detection probability 𝑢 𝑗 0
(3) initialize number of assigned sensors to 𝑇 𝑗 , 𝑛 𝑗 0
For leader of task 𝑇 𝑗
(4) advertise presence of 𝑇 𝑗 to each neighboring sensor 𝑆 𝑖
(5) for round = 0 to 𝑅   do
(6)      if   𝑛 𝑗 𝑁   then
(7)    among responding sensors 𝐺 , choose
     𝑖 a r g m a x 𝑖 { 𝑒 𝑖 𝑗 𝑆 𝑖 𝐺 }
(8)    update 𝑢 𝑗 𝑢 𝑗 + 𝑒 𝑖 𝑗
(9)    send accept messages and advertise new 𝑢 𝑗
(10)    else
(11)     done
(12)    end if
(13) end for
        For sensor   𝑆 𝑖
(14) wait for task requests
(15) among requesting tasks 𝑄 , choose
         𝑗 a r g m a x 𝑗 { 𝑒 𝑖 𝑗 𝑝 𝑗 𝑇 𝑗 𝑄 }
(16) send proposal to 𝑇 𝑗 including exact location
(17) if accepted then
(18)  𝑆 𝑖 is assigned to 𝑇 𝑗
(19) done
(20) else
(21)  listen to current 𝑢 𝑗 values for requesting tasks
(22) if no more tasks then
(23)    done
(24) end if
(25)  update detection probability based on new 𝑢 𝑗 's:
                𝑒 𝑖 𝑗 1 ( 1 𝑢 𝑗 ) ( 1 𝑒 𝑖 𝑗 ) 𝑢 𝑗
(26) end if
(27) repeat
Algorithm 1: Sensor assignment [8].