| (1) initialize each , the detection probability of for |
| (2) initialize each task cumulative detection probability |
| (3) initialize number of assigned sensors to , |
|
| 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 |
| |
| (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 |
| |
| (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: |
| |
| (26) end if |
| (27) repeat |