Research Article
A Proficient Bee Colony-Clustering Protocol to Prolong Lifetime of Wireless Sensor Networks
Algorithm 1
Pseudocode of clustering.
| Begin | | //Initialization// | | (1) | Base station broadcasts beacon | | (2) | All nodes calculate Euclidian distance | | | //Cluster head selection phase// | | (3) | Generate the initial population | | (4) | Set cycle to 1 | | (5) | Repeat | | (6) | For each sensor | | (7) | Launch artificial bee colony algorithm | | (8) | Select CHs | | (9) | Cycle = cycle + 1 | | (10) | Until Maximum Cycle Number | | (11) | End For | | | //cluster-member recruitment// | | (12) | Set CH cycle to 1 | | (13) | Repeat | | (14) | For each CH | | (15) | Set Hop Cycle to 1 | | (16) | Repeat | | (17) | For each CH broadcast REQUEST message; | | (18) | If (non-CH node neighbours receive REQUEST message) | | (19) | Then, non-CH node neighbours send ACCEPTED message to CH; | | (20) | End if | | (21) | Hop Cycle = Hop Cycle + 1 | | (22) | Until Maximum Hop Cycle Number | | (23) | End For | | (24) | CH cycle = CH cycle + 1 | | (25) | Until Maximum CH cycle Number | | (26) | End For | | | End |
|