## 4 Proposed CH Selection Algorithm Based Bacterial Foraging Paradigm
### The Proposed CH Selection Algorithm
#### 4.2.4 The Step of Elimination and Dispersal  
The bacterial foraging method removes some bacteria and destroys them. This operation is called elimination and dispersal. \(P_{ed}\) each value \(\in\ [-1,1]\), which is used after a reproduction event number \(N_{re}\), is possible to spread the bacteria in a wide area as a result of the elimination of some bacteria and avoid being trapped in a local area. Figure 5 shows the code block representing the elimination and dispersal step. **Illustration 4:** As seen from the Figure 5 for 1 to bacterial cells number (\(sn_{num}\)), if \(P_{ed}\) is bigger than the rand(), for instance, it generated 50 bacterial cells that were distributed population (\(P\)) in the sense area. Once this equality is not provided, some bacteria are dispersed according to reproduction event number \(N_{re}\) and the elimination number _ell_ is used in Figure 5.  
In contrast to the existing studies, in the proposed novel CH selection algorithm, the bacterial foraging method based method was used. In this sense, the previously designed algorithm has been developed. In addition, the \(COST\) and \(BandC\) formulations that are based on the remaining energy, degree, load, and distance to adjacent nodes of the sensor node representing the bacterial cell are considered together. Unlike other studies, in this study, \(\delta\) initial percentage is given as the optimal percentage when CH is selected. The \(\delta\) value does not have a direct effect on the final sets. It only limits the number of CH selection announcements. In this sense, it controls the CH number. The \(\propto\) and \(\beta\) coefficients are used in order to avoid delay by keeping the number of CH that is visited by MS. In this way, energy consumption is considered to be reduced. Each CH has a cost (\(COST\)) account and the selection is made according to this criterion. The selection is made based on both the remaining energy of the CHs and the node load. This cost is calculated as in Equation (14), below. \[COST=\delta(\propto\bigg{(}\frac{E_{remain}}{E_{max}}\bigg{)}+\frac{(1- \alpha)}{\delta}\bigg{(}\frac{L_{node}}{L_{max}}\bigg{)}) \tag{14}\]  
**Illustration 5:** Consider, according to Equation (14), that energy consumption is minimized. In addition, the algorithm avoids of sense overlap that is encountered in the network. As seen in Equation (14), the node load is used to prevent transmission delay. The goal is to reduce this value. Due to the fact that only the CH's transmit data to the MS, this reduces the communication overhead of the WSN. Some nodes can enter the transmission range of CHs. This event is described as sensed overlap. In this case, ties can be discarded between the selected CHs. CH is chosen based on the minimum \(BandC\) value that can create a balance and compromise between the node degree and the possible distance around the CH. Equation (15) shows the \(BandC\) formulation. By selecting CH that is based on the minimum \(BandC\), both energy consumption and transmission delay are reduced. \[BandC=\delta(\beta D_{node}+\frac{(1-\beta)}{\delta}D_{dist}) \tag{15}\]  
The proposed novel CH selection algorithm that is based on bacterial foraging is presented in Algorithm 3. The aim of this algorithm is to select the best CHs in the network as a result of different movements of bacteria. As shown in line 4, the population is created on the network. In line 8, there is the _Chemotaxis ()_ function that is described in Algorithm 2. The \(COST\) value that is calculated  
Figure 5: The code block representing the elimination and dispersal step. in Equation (14) is announced to the \(N_{neigh}\) that the neighboring nodes of the BCs belong to the population with broadcast message (see line 9, 10). The message packet format is formed as eight segments, including packet _id_, node _id_, CH _id_, _Eremain_, _Emax_, _Lnode_, _Lmax_, and _DATA_, which is subsequently sent.