Research Article

Optimization of Leach Protocol in Wireless Sensor Network Using Machine Learning

Algorithm 1

LEACH protocol Algorithm.
Let x = {x1, x2, …, xn} be the number of sensors deployed in the network.
Step 1: Calculate the energy required for the node to act as the cluster head.
Step 2: First, randomly select the cluster head from the nodes present.
Step 3: Next step onward iteratively calculate the Euclidean distance between the nodes.
Step 4: Now select the nodes having the same Euclidean distance using equation (3).
Step 5: After that, check the energy level of the node, which should be capable of doing the cluster head work.
Step 6: If it has energy capable of acting as a cluster head, elect it as a cluster head; that is, E ≥ ECH.
Step 7: Otherwise, reject it.
Step 8: Now add the nodes to that particular cluster head for a particular set of rounds.
Step 9: Number of rounds over or if the cluster head is deadly terminating the process.
Step 10: Once again, send a request message to update the Euclidean distance and energy level of the nodes.
Step 11: Repeat from step 3 until all the nodes are dead.