# Clustered Distributed Learning Exploiting Node Centrality and Residual Energy (CINE) in WSNs
## 3 CINE Solution
### Overview of CINE
After \(\tau_{w}\), a new competition will be triggered inside the cluster to identify which node will be the next CH. To this aim, the current CH transmits a COMPETITION_TRIGGER message. Upon receiving it, each cluster member \(j\) updates the estimate of the relevant values, i.e., its residual energy, \(rE_{j}\); its computing capabilities, \(P_{j}\); its centrality, \(C_{j}\); and the loss of the current ML model, \(L_{j}\), needed to estimate the penalty \(\mathcal{G}_{j}\). Similarly to the case of the initial competition, a node \(j\) will schedule the transmission of a COMPETITION_TERMINATION message containing the value of \(\mathcal{G}_{j}\), as well as its identifier inside at time \(\tau=\tilde{t}+\delta_{j}\) where \(\delta_{j}\) is a random variable with average proportional to \(\mathcal{G}_{j}\). Based on this choice, nodes with low penalty will answer before, and the best node will serve as the new CH for at most a time \(\tau_{w}\). Note that, as detailed in the following section, CHs in different clusters form a so-called _CH-network_. This network connects all CHs of different clusters according to a mesh topology. When a node \(q\) emerges as the new CH of the cluster \(\mathcal{Q}\), i.e, \(q=CH_{\mathcal{Q}}\), it sets a higher TX power and broadcasts a CH_NETWORK_NOTIFICATION message carrying its identifier, as well as the ID of the previous node that acted as CH for the same cluster \(\mathcal{Q}\). In this way, all CH nodes that receive this message will update their current list of CH-network members by considering node \(q\) as the new \(CH_{\mathcal{Q}}\). Correspondingly, they will update their cluster member list by now considering the previous CH as a simple cluster member. The procedure for cluster management is sketched in Algorithm 1. ```
1:/*Protocol initialization */
2:Clusters are defined at network set up
3:A random initial cluster head (ICH) is identified
4:ICH issues a COMPETITION_INITIATION message
5:Competition lasts for \(\tau_{c}\)
6:Each cluster member estimates \(\mathcal{G}_{j}=\phi(rE_{j},C_{j},P_{j})\)
7:At \(\tau\) each member \(j\) sends a COMPETITION_TERMINATION(\(j\))
8:Upon hearing COMPETITION_TERMINATION from other nodes -> desist from transmitting
9:For a time interval of \(\tau_{w}\), \(j\) is the new CH for the cluster
10:Set high TX power and CH_NETWORK_NOTIFICATION (\(j\)) to other CHs
11:/*End of initialization */
12:/*Regular operations for CH selection */
13:Set low TX power and Broadcast to other cluster members
14:if (\(t=n\cdot\tau_{w}\) OR (\(rE_{k}>rE_{Tthr}\)))
15:CH COMPETITION_TRIGGER
16:cluster member \(k\) ESTIMATE(\(rE_{k},P_{k},C_{k},L_{k}\))
17:cluster member \(k\) CALCULATE \(\mathcal{G}_{k}=\phi(rE_{k},P_{k},C_{k},L_{k})\)
18:cluster member \(k\) sends COMPETITION_TERMINATION(\(k,\mathcal{G}_{k}\)) at \(\tau\)
19:Upon hearing COMPETITION_TERMINATION from other nodes, desist from transmitting
20:Node \(k\) is the new cluster head
21:Set high TX power and CH_NETWORK_NOTIFICATION (\(k\)) to other CHs
22:/*End of Regular Operations */
```  
**Algorithm 1** Protocol-**Cluster Management**