| Initialize signals with a constant value of energy and deploy in a specified area. |
| Initially, assign 10% of n signals to cluster nodes at random. |
| For i: 1 to n |
| Calculate distance (F1) = di, m + 1 |
| Minimum distance = Euclidean distance value from signal i to BSm + 1 |
| If (minimum distance > distance) |
| Node.id = i |
| End if |
| For j: 1 to m (total number of CH) |
| Calculate distance (F2) = djm (distance from signal j to CHm) |
| If (minimum distance > distance) |
| Minimum distance = distance |
| Node.id = j |
| End if |
| Store the distance in an array (A) which maintains values for clusters |
| A (Node.id).sum = A (Node.id).sum + minimum_distance |
| A (Node.id).num = A.(Node.id).num + 1 |
| End for |
| End for |
| For k: 1 to m (total number of CH) |
| Calculate distance (F3) = dk, m + 1 |
| If (minimum distance > distance) |
| Minimum distance = distance |
| Cluster.id = k |
| End if |
| Store the distance in an array (A) which maintains values for clusters |
| A (cluster.id).sum = A (cluster.id).sum + minimum_distance |
| A (cluster.id).num = A(cluster.id).num + 1 |
| End for |
| Calculate the total energy |
| Fitness function value for each node |
| For i: 1 to n |
| Fitness (clustering) = (0.25 ∗ F1) + (0.25 ∗ F2) + (0.25 ∗ F3) + (0.25 ∗ F4) |
| End for |
| Stop |