Bacteria Interactive Cost and Balanced-Compromised Approach to Clustering and Transmission Boundary-Range Cognitive Routing In Mobile Heterogeneous Wireless Sensor Networks

The improvement of stable, energy-efficient mobile-based clustering and routing protocols in wireless sensor networks (WSNs) has become indispensable so as to develop large-scale, versitale, and adaptive applications. Data is gathered more efficiently and the total path length is shortened optimally by means of mobile sink (MS). Two algorithms as bacterial interaction based cluster head (CH) selection and energy and transmission boundary range cognitive routing algorithm with novel approach for heterogeneous mobile networks are proposed in this study. The more reliable and powerful CH selection is made with the greedy approach that is based on the interaction fitness value, energy node degree, and distance to adjacent nodes in a compromised manner. The best trajectories, thanks to intersection edge points of the visited CHs, are obtained in the proposed routing algorithm. In this way, the MS entry to transmission range boundaries of the CH has been a sufficient strategy to collect information. As in energy model, we adopt energy consumption costs of listening and sensing channel as well as transmit and receive costs. Comprehensive performance analyzes have been seriously carried out via the Matlab 2016a environment. We validate that the proposed scheme outperforms existing studies in terms of several performance metrics as simulations.


Background
Through the advances of wireless telecommunications, the development of micro-electronics devices, and implementation of Internet of Things (IoT) in large scales, in the recent decade wireless sensor networks (WSNs) have attracted great attention owing to lots of applications, such as environmental surveillance, smart cities and battlefield, traffic monitoring, tracking medicine and logistic events, military target monitoring [1], health care tracking, and so more [2]. WSNs have handled with distributed sensor nodes in the network on behalf of computational and managament operations for implementing these applications [3,4].
In WSN applications, the clustering and routing mechanisms play an important role in energy efficiency and optimization issues [5]. Clustering refers to the division in the nodes in the sensor network into groups, called clusters, according to certain criteria and properties in order to more easily manage the operation of the network [6]. Each cluster has a cluster head (CH), which is selected according to certain algorithms, so that this node can collect data from other normal nodes and process and transmit them to the base station (BS) [7]. In this way, all of the nodes do not need to separately The proposed scheme and state-of-art studies have been conducted on performance analysis for many control variables and metrics. The performance results clearly emphasize that the proposed methodology has very high performance in terms of network life and energy consumption over improved ant colony algorithm (IACO) in the study [36], particle swarm optimization (PSO) based study that is presented in [37], novel chemical reaction optimization based unequal clustering and routing algorithm (nCRO-UCRA) that is proposed in [38], backbone integrated discrete firefly The proposed scheme and state-of-art studies have been conducted on performance analysis for many control variables and metrics. The performance results clearly emphasize that the proposed methodology has very high performance in terms of network life and energy consumption over improved ant colony algorithm (IACO) in the study [36], particle swarm optimization (PSO) based Sensors 2019, 19, 867 4 of 30 study that is presented in [37], novel chemical reaction optimization based unequal clustering and routing algorithm (nCRO-UCRA) that is proposed in [38], backbone integrated discrete firefly algorithm based mobile data transporter (BI-DFAMDT) that is presented in [31], and the starfish algorithm proposed in [33] study based bio-inspired and swarm optimization methods.
The major contributions of our study can be summarized, as follows: • we construct a heterogeneous WSN with mobile sink in order to minimize energy consumption and maximize the network lifetime; • we develop a CH selection algorithm based on bacterial foraging paradigm. CHs are dynamically selected from the advanced nodes according to the proposed algorithm. These method differs from the existing studies. In this way, we obtain more shorter mobile sink trajectory sets when compared to other works; • unlike other works, we combine the CH selection algorithm with proposed energy and transmission boundary range-aware routing algorithm developing the mathematically formulations; • the energy model of our study consists of listening channel and sensing energy consumptions consideration as well as transmission and receiving costs; and, • in this paper, we have implemented comprehensive simulation analyzes by measuring lots of performance metrics, including average advanced energy usage that we introduced.
The rest of the paper is listed as follows. Section 2 presents the literature survey with state of the art studies. Preliminaries with energy and network model subsections are ordered in Section 3. In Section 4, the proposed algorithms with their methodologies are explained in detail. Section 5 discusses performance analysis results and, consequently, the paper is concluded in Section 6.

Literature Survey
Many researchers have significantly contributed to studies in the literature. We offer readers the related studies implemented from year 2000 to today in a summary form.
The study [39] proposed a low energy adaptive clustering hierarchy, named LEACH, which selects CHs randomly in the network and provides load balance. However, LEACH-C [40] presents a centralized control algorithm that is improved version of LEACH. In this algorithm, BS knows all of the nodes' locations and the energy levels are determined in each round.
In a study, Ref. [41] recommends a SEP (Stable election protocol) algorithm, where each sensor node is in a two-level heterogeneous sensor network. The algorithm independently identifies CHs selection according to the first energy relative to the other sensor nodes of the sensor network.
The study [14] proposes a distributed energy efficient clustering method, called DEEC. In the CH, selection is considered to depend on the rate of the residual energy of the sensor node and the mean energy of the sensor network.
A meta-data based data aggregation scheme is presented for the clustered WSNs [10]. According to this study, CH acquires the data when the sensor nodes sense some events in the transmission range. CH processes the data and then sends it to the BS immediately. However, this operation was considered in a simple manner due to taking much time in the delivery of all data.
In [42], so as to gather more flexible routes for mobile collectors SenCar, a mobile data collector that is runs like a mobile BS travels the entire network, collects the data from all the nodes, and finally submits the data to the sink via heuristic approach.
The study [17] presents a line-based data dissemination protocol for WSNs using mobile sink. The algorithm is executed according to a line limit value to disperse the data that are acquired in the sense area.
In one study [43], the authors proposed an adaptive algorithm for networks that accommodate the traveling node, while taking into account bacterial mobility. The proposed algorithm is a technique that collects the vector as a linear combination of the last steps of neighboring nodes. This technique allows for bacteria to provide more nutrients. However, in this study, they have only presented a Sensors 2019, 19, 867 5 of 30 series of mathematical models expressing nutrient distribution for bacteria that have not considered the network model or representing sensor nodes.
In a study [20], an energy-efficient mobile-sink path selection strategy for WSNs is proposed. In the clustering model, a mobile sink travels CHs, named RPs, and then collects data from them. This algorithm provides an energy consumption balance although network delay increases due to the random mobile sink movement.
In [13], authors proposed an energy efficient routing algorithm for improving the network life time. The sink node in the network navigates as hexagon model based multi-hop transmission. The authors consider that the network is divided into some areas and CHs are elected in these areas. Although the algorithm is good at energy balancing, it nevertheless produces communication delay.
In one study [44], a bacterial foraging optimization based clustering algorithm was proposed. Thanks to the proposed algorithm, energy efficiency along with routing protocol is provided for long tours. However, the proposed algorithm was only compared with the LEACH and [45] PEGASIS protocols.
In [11], a mobile sink with intelligence improved energy efficient model is proposed and then compared with mod-LEACH and PEGASIS protocols.
In [46], authors proposed a novel routing method, called the sleep-wake energy balanced distributed (SEED) clustering method. Thanks to this algorithm, network is split into three energy fields. In this way, CHs in the clusters directly communicate with BS.
In one study [39], the authors proposed the improved ant colony algorithm (I-ACO), which was developed to produce more effective and accurate solutions to the classic traveler salesman problem (TSP). This algorithm combines swarm intelligence and local search manner. With the routing protocol generated, the trajectories were obtained. The proposed algorithm was compared to the existing greedy approach and particle swarm optimization (PSO) models.
In one study [26], the authors presented an energy efficient clustering and routing algorithm with artificial bee colony and metaheuristic approach. They proposed a multi-purpose fitness function using the linear programming formulation for CH selection. As for the routing problem, the transmission path is solved by the cost-based function that is calculated between the number of hops and the energy efficiency. The data in the network is collected in a distributed manner. In this study, routing discovery is designed in a very complex way. At the same way, it can be said that the node and packet load occur because the algorithm is not built on network mobility.
The paper [47] compared the sleep-aware energy efficient protocol named SEED with both the homogeneous and heterogeneous models belong to wireless sensor networks. This algorithm consists of several steps, including setup and CH selection processes. It can be said that these steps do not guarantee the energy balance and consider the packet delivery rate.
In one study [5], CH selection is performed according to its energy level and to the remaining energy. The sensor node with the minimum time delay comparing to others is selected as CH.
In one study [37], the authors proposed a clustering algorithm called EPMS, which was used for WSNs based on the particle swarm optimization-based mobile sink node. In this algorithm, CH selection was performed based on the remaining energy and location of the node. In the routing mechanism, the virtual clustering and mobile sink techniques are combined. The network area was divided into several regions and MS collected the data by visiting CHs. The disadvantages and shortcomings of this study can be listed, as follows. In CH selection, only the remaining energy and position of the node were observed. Node degree, load energy capacity, and fitness value criteria have not been evaluated. The WSN structure is homogeneous. In real life, heterogeneous network models are important. In the energy model, only the energy consumed for transmission and reception is considered.
In one study, the authors [38] presented a novel unequal clustering and routing algorithm (nCRO-UCRA) that is based on a chemical reaction to address the hot spot problem. The number of elements of the clusters close to the sink node is designed as more than other papers. CH selection Sensors 2019, 19, 867 6 of 30 was made according to the proposed cost function. As for the routing protocol, it is designed for the chemical and potential energy formulations. However, it can be said that CHs carry data into the sink node with the multi-hop method, increasing energy consumption and the possible packet delay. In one study, authors [31] proposed a bio-inspired decrete firefly algorithm (BI-DFAMDT) with the mobile data transporter (MDT) being represented by the mobile sink node. The trajectory length that was traveled by MDT was kept to a minimum with the nature-inspired metaheuristic approach. The travel time of MDT is minimized in data collection. However, we can say that MDT increases data delivery latency while gathering data from the all nodes as travelling in a non-cluster network.
A study [48] proposed a routing algorithm that constructs trajectories by MS in order to reduce the energy consumption and delay that are caused by the mobile sink node. In this sense, trajectory models have been designed with different transmission paths with the reduced delay path (RDP) algorithm. MS collect data from specific nodes using these trajectories.
In a study [49], the authors address the joint multi-purpose mitigatation problem by presenting both the clustering and routing problems with link quality base. They introduce a novel individual encoding scheme. Also, the energy consumption model is experienced under the real CC2420 energy radio. The study [33] proposed a routing protocol that consisted of ring canal and radial canal models inspired by the underwater starfish. The radial canal number and ring canal radius have been updated according to the transmission range of the sensor nodes, and the delivery of the data to the target is provided in a single-hop manner. Accordingly, the end to end delay time is reduced. In the network model, homogeneous sensor nodes are used. Since the positions of the nodes are known by GPS, it is thought that this can lead to generate disadvantageous results in energy consumption.
The purpose of study [30] is to evaluate the performance of artificial bee colony optimization algorithm (ABCO). The sensor node with the highest energy in a cluster is selected as CH in a limited period. All field can be re-configure depending on the rest of the CHs.
A study [50] proposed a distributed energy efficiency clustering algorithm in heterogeneous networks, named TBSDEEC. In this study, we formulate the threshold value as balanced and sampled with old value when CH selection in the cluster form. This algorithm outperforms other DEEC variants and the ABCO [30] algorithm in terms of energy efficiency. However, the study lacks network modelling details and data collection issues.
In this study, as stated in the problem definition and existing gaps section, it is necessary to eliminate the deficiencies of the existing studies that are mentioned in this section and to offer adaptive solutions to the WSNs for innovative and real applications. For this purpose, the algorithm framework that we proposed is subjected to performance by using IACO [39], EPMS-PSO [37], nCRO-UCRA [38], BI-DFAMDT [31], and starfish [33] routing algorithms.

Energy Model
In energy model, the difference of this study from most energy efficient WSN studies is to consider and analyze the energy consumption of the network in four categories.

•
Energy consumed during the transmission process. In previous studies, authors ignored the energy consumption analyzes in sensing and listening processes, because they claimed that the sensor nodes consumed less energy in these processes. However, as our contribution for the energy model, the energy consumption mentioned cases above, as well as the energy that is consumed for transmission and receiving has been taken into account. In this way, more realistic and accurate energy analysis has been done. The energy model of the transmission and receiving energy consumption that is used in this study is based on similar radio model, as used in our previous study [50]. Once it is sent or received, a bit of data to make energy consumption minimize according to distance for this model, the energy consumption of a sensor node for transmission, and processes E TX/RX is measured as Equation (1). Figure 2 illustrates the network energy consumption model. l is data size, E elec represents the energy depletion per bit of the node to electronically work the transmission or reception, e f s and e amp indicate the types of radio amplifiers for free space and multiple routes, respectively. E TX/RX (l, d) denotes the energy consumption in sending and receiving data for the l bits.
Sensors 2019, 19 FOR PEER REVIEW 7 Figure 2 illustrates the network energy consumption model. is data size, represents the energy depletion per bit of the node to electronically work the transmission or reception, and indicate the types of radio amplifiers for free space and multiple routes, respectively. / ( , ) denotes the energy consumption in sending and receiving data for the bits. We assume that the energy that is depleted for sending and receiving data are the same with each other. The reference distance ( 0 ) is computed, as Equation (2).
In this study, unlike our previous study, the acknowledgement of energy consumption was added to energy consumption. When the data is transmitted to a point, the acknowledgment message that the data is delivered is transmitted. Therefore, the energy that is consumed at this stage should be calculated. For a transmission from a case to the case -1; the average number of desired packet transmissions is calculated, as Equation (3).
where is the number of packets to transmit, is the probability value [0,1] of packet transmission, and is the number of waited transmissions. The number of acknowledgement transmissions can be expressed, as in Equation (4).

=
(4) In addition, acknowledgement energy consumption cost for a periyod can be given in Equation (5). Finaly, the total energy consumption is calculated, as in Equation (6). We assume that the energy that is depleted for sending and receiving data are the same with each other. The reference distance (d 0 ) is computed, as Equation (2).
In this study, unlike our previous study, the acknowledgement of energy consumption was added to energy consumption. When the data is transmitted to a point, the acknowledgment message that the data is delivered is transmitted. Therefore, the energy that is consumed at this stage should be calculated. For a transmission from a case i to the case i − 1; the average number of desired packet transmissions is calculated, as Equation (3).
where T p is the number of packets to transmit, p is the probability value [0,1] of packet transmission, and k is the number of waited transmissions. The number of acknowledgement transmissions can be expressed, as in Equation (4).
In addition, acknowledgement energy consumption cost E ack for a T periyod can be given in Equation (5). Finaly, the total energy consumption E T is calculated, as in Equation (6).  (7).
where A is a constant being aware cost and L cost is the listening cost. However, it is necessary to calculate the number of being aware N aw during a TDMA-cycle. Accordingly, the total listening cost in a period T for N sensor nodes, can be given, as Equation (8).
We assume that energy consumption during the sensing process is the same as the listening process. In this sense, energy consumption of sensing process E sens can be given in Equation (9).
Consequently, the total energy consumption for the above steps can be expressed, as in Equation (10). In this way, we take into consideration these energy consumption formulations in our study.

Network Model
In WSN scenarios in this article, different number of sensor nodes are randomly distributed to the network area in different sizes. The distance of a sensor node from the adjacent nodes can be calculated according to the received signal strength indicator (RSSI) parameter. In this study, mobile heterogeneous distributed clustered WSN was created. The WSN in our study has thre levels of heterogeneous structure, including normal, advanced, and super nodes. In the network, the selected nodes are selected from advanced nodes according to the proposed bacteria foraging based CH selection algorithm. Mobile Sink (MS) node, which collects data from selected CHs, has super node feature. We assume that super nodes have no energy limitation. These different nodes have different properties, such as data processing, communication, and transmission scope. The remaining nodes in the sensor network have the normal node property. Here, it is important to note that, in the proposed algorithm, each CH is an advanced node, but not every advanced node can be assigned a CH. This event is carried out by controlling the energy. Both non-CH and advanced nodes can transfer energy to other normal nodes and provide both a special network model and energy balance. In our study, a different number of sensor nodes were used in the scenarios in order to measure the energy efficiency and network life more accurately. In addition, network size is expressed in numbers in different scales and simulations were performed. Figure 3 shows the proposed clustering formation heterogeneous network model for 200 nodes that were distributed in a 250 × 250 m 2 network size. In the sensor network, CHs selected from advanced nodes are represented by square-plotted nodes, while others are normal nodes. energy efficiency and network life more accurately. In addition, network size is expressed in numbers in different scales and simulations were performed. Figure 3 shows the proposed clustering formation heterogeneous network model for 200 nodes that were distributed in a 250 × 250 2 network size. In the sensor network, CHs selected from advanced nodes are represented by squareplotted nodes, while others are normal nodes.

Overview of the Bacterial Foraging Model
Bacteria are single-cell microorganisms that collect food from the environment in which they are present for certain periods of time in order to survive and provide energy. Escherichia coil and M.
Xanthus are examples of these bacteria [43]. In the process of foraging nutrients, the bacteria act as chemotaxis against chemical impulses. In this sense, bacteria have the ability to act differently for

Overview of the Bacterial Foraging Model
Bacteria are single-cell microorganisms that collect food from the environment in which they are present for certain periods of time in order to survive and provide energy. Escherichia coil and M.
Xanthus are examples of these bacteria [43]. In the process of foraging nutrients, the bacteria act as chemotaxis against chemical impulses. In this sense, bacteria have the ability to act differently for specific purposes, called swimming and tumbling. Swimming refers to movement in a direction that is in the direction of locomotive effect, but tumbling refers to different random motion. As seen in Figure 4, it is known that the bacteria move in a flat direction and a fixed path, called swimming, and also move randomly in a unspecified direction, called tumbling, for the search of food at a new point [51]. ensors 2019, 19 FOR PEER REVIEW 9 pecific purposes, called swimming and tumbling. Swimming refers to movement in a direction that s in the direction of locomotive effect, but tumbling refers to different random motion. As seen in igure 4, it is known that the bacteria move in a flat direction and a fixed path, called swimming, and lso move randomly in a unspecified direction, called tumbling, for the search of food at a new oint [51]. Bacteria hide their attractive properties and, at the same time, transfer the chemicals to the nvironment. In this way, bacteria can detect each other in the environment. This effect can be hought of as nodes in the WSNs to transmit messages to each other [52]. Bacteria are found to be ctive for about one to three seconds to collect nutrients where food is dense. The nutrient density is elow a certain threshold and the nutrient is separated from the environment. Given these properties, acterial movements can be based on the travelling of the sensor node in WSNs.  In this study, the selection of cluster head (CH) in the heterogeneous cluster network was nspired by the foraging structure of the bacteria [44]. Table 1 presents the similarity and comparison etween the bacteria foraging and the WSN.  Bacteria hide their attractive properties and, at the same time, transfer the chemicals to the environment. In this way, bacteria can detect each other in the environment. This effect can be thought of as nodes in the WSNs to transmit messages to each other [52]. Bacteria are found to be active for about one to three seconds to collect nutrients where food is dense. The nutrient density is below a certain threshold and the nutrient is separated from the environment. Given these properties, bacterial movements can be based on the travelling of the sensor node in WSNs.

Bacteria foraging inspiration WSN
In this study, the selection of cluster head (CH) in the heterogeneous cluster network was inspired by the foraging structure of the bacteria [44]. Table 1 presents the similarity and comparison between the bacteria foraging and the WSN. Table 1. Similarity between bacteria life and wireless sensor network (WSN).

Bacteria Sensor nodes Food density
Objective function The density of nutrients in the region is not known by bacteria. The nodes do not know the cost function in advance.
Bacteria can detect the density of food at their location.
The nodes can only detect changes in the values of the cost function. Bacteria have a limited detection ability (which determines the local error signal) that they cannot assess the intensity, they are only aware of the sign.
When moving nodes, they are aware that only the cost function is increasing or decreasing.
When the nutrient density increases, the bacteria will work in this direction. Otherwise, it is affected by confusion and the bacteria performs tumble movement.
An i node follows the direction of its neighbors in the right direction. Otherwise, if none of the neighbors (including i) are in the correct direction, then the node i will change direction.

The Proposed CH Selection Algorithm
In the proposed CH selection algorithm, a new approach that is based on bacterial foraging belongs to methods, called as swarm optimization, computational intelligence, or metaheuristic, such as swarm optimization, genetic algorithm, ant, and bee colony algorithms is presented. In all proposed algorithms, BC(Bacterial Cell) and BBC(Best Bacterial Cell) represent the sensor node and CH, respectively.
In the proposed algorithm, some of the advanced nodes in the heterogeneous WSN have been assigned to the choice of CH, which can provide the best energy balance of the bacterial cells. In our algorithm, each bacterial cell (BC) was associated with a CH. The best BC can be assigned as CH. With this inspiration, it is possible to identify the best cell in the WSN in the determination of the best cell in terms of energy, degree, and balance load, in order to find bacteria in food and to assign the most appropriate advanced nodes as CH.

Vocabulary
In this sub-section, we describe some notations and their descriptions that were used in the algorithms with Table 2. Table 2. The some notations used in the algorithms.

Notation Symbols Notation Descriptions
Problem size Problem space Step size Random direction vector with the same number of dimensions. sn num The number of bacterial cells that represents sensor node in our algorithm.

E max
Initial energy of a sensor node L max Maximum sensor node load E remain Remaining energy of a sensor node L node Load of a sensor node D node Node degree of a CH D dist Euclidean distance between a sensor node and an CH within its range R Transmission range of a sensor node ∝ Used for trade-off between residual energy and node load β Used for trade-off between load distribution and energy consumption δ Using for control the number of CHs N neigh Neighbors of a sensor node that are within its transmission range N c The number of chemotaxis steps.

N s
The number of swim steps for a given bacterial cell P The number of dimensions on a given bacterial cells position vector.

N re
The number of reproduction steps.

N ed
The number of elimination-dispersal steps.

P ed
Possibility of elimination and dispersal of a bacterial cell.

Population
Bacterial population d attr The height of the repellant effect (magnitude of its effect) w repel Measuring of the width of the bacterial repellant effect The bacteria foraging algorithm consists of three basic steps, including chemotaxis, reproduction, and elimination-dispersal.

The Step of Chemotaxis
The process in which bacteria move and search for food to increase energy levels is called chemotaxis. Swimming and tumbling are methods of chemotaxis, which describe the movement in two different directions [53,54].

i.
Swimming: In every bacterial cell (BC) action, the bacteria numbered as {1,2, . . . , i} move and the bacteria {i + 1, i + 2, . . . , sn num } do not move. This manner is much simpler than synchronous decisions regarding swimming to simulate. Algorithm 1 shows the pseudo code of the swimming step.
. . , p, is a random number between −1 and 1. Here, the goal is to achieve the result of the swimming movement as seen in line 2 of the Algorithm 1. The counter value in the algorithm is used to calculate the value of the swim length. Line 3 of Algorithm 1 controls that the counter variable does not exceed the maximum swim step. The lines 5, 6, and 7 of the algorithm explain the direction in which the direction of the bacteria moves in the advantageous direction when a direction more advantageous than the previous direction (J previous ) is detected.
ii. Tumbling: In this sub step, each element ∆ m (i), m = 1, 2, . . . , p produces a random vector ∆(i) ∈ R p . We use the formula that is given in Equation (11) for bacterial tumbling movement.
Algorithm 1: An algorithm for the swimming method.
1:Input: sn num , N s , N c , N re , N ed , P ed . 2:Output: New value of the ϑ i (j + 1, k, l) after swimming movement. 3: counter = 0; /*for computing swim length*/ 4: while counter < N s do /*for not exceeding the maximum number of swim steps */ 5: if J(i, j + 1, k, l) < J previous then /* a more advantageous direction*/ 7: The formulations in these steps represent the chemotaxis movement of the bacteria, where ϑ i (j, k, l) represents j th chemotactic, k th reproduction, and l th elimination-dispersal steps in the i th bacterium. C(i) is the size of the randomly dispersal steps and ∆(i) denotes a vector in random direction between its element [−1, 1].
In order to be able to select the appropriate CH in the proposed algorithm, we need to take into account the cost of bacteria in the foraging method, which is inspired. The cost of a bacterium is reduced by its interaction with other bacterial cells. This interaction function IF(sn k ) is calculated in Equation (12), as follows: where sn k represents a sensor node (a bacterium cell (BC)), which is the m th component of the k th bacterium and sn i m is the m th component of the k th bacteria. The exponential interaction between these bacteria is taken into account. d attr and w attr are the attractive coefficients and h repel and w repel are the impulse coefficients. These expressions represent the height (effect size) and the width of the impulser, respectively. P is the number of dimensions in a given cell position vector [55][56][57].
Algorithm 2 presents the integrated Chemotaxis() method that will be used on line 7 of the Algorithm 3. The aim of this algorithm is to update the compatibility value of the bacterium with a random tumbling motion (see 8 th line).

Illustration 2:
In the 4th line of the Algorithm 2, the interaction function IF(sn k ) is used to calculate the compatibility value (BC f itness fitness value) during the life of the bacterium after the N c step. BC , and the new BC value is calculated in line 8 and 9 thanks to the RandomMoveDirection () random motion function. In the 14th line of the Algorithm 2, BC health is calculated as an indicator of how many nutrients that BC can acquire during life and how successfully it can avoid the harmful nutrients.

The Step of Reproduction
In this step, the first half of the bacterial population survives and the remaining bacteria are located in the same place as their parent and they are divided into two sub-blocks. After the N c steps, the fitness value for ith bacterium is expressed in Equation (13). J i health, is an indication of how many nutrients the bacteria can acquire during their lifetime and how successfully they can avoid harmful nutrients. C(i) is sorted and then compared according to the chemotactic parameter.
Illustration 3: Suppose that, if the ith bacterium that has the highest J i health die, then then the other block, with the other bacteria having the highest J i health , being divided into two blocks. Chosen BC Healths are updated according to Choosen = Choose BC Health (Population, sn num /2) statement. With the reproduction step, the rate of bacteria is kept constant after N c steps according to Equation (13).

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 ∈ [−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.  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 and 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, initial percentage is given as the optimal percentage when CH is selected. The 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 ∝ and 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 ( ) 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.
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 value that can create a balance and compromise between the node degree and the possible distance around the CH. Equation (15) shows the formulation. By selecting CH that is based on the minimum , both energy consumption and transmission delay are reduced.
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

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, δ initial percentage is given as the optimal percentage when CH is selected. The δ 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 ∝ and β 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.
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.
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 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. Figure 6 depicts the packet format that is transferred in the network and the description of the packet segments is given in Table 3. Thanks to this packet, the nodes can compute the COST value.  (14) and (15), respectively; 4: Population=InitializePopulation (sn num , Problem size ); 5: for l =0 to N ed do 6: for k = 0 to N re do 7: for j = 0 to N c do 8: Chemotaxis(Problem size , sn num , N s , Step size , d attr , w attr , h repel , w repel ); 9: for BC ∈ Population do 10: Broadcast the COST value as packet format defined in Figure 6 Figure 6. Packet format transferred in the network.

Illustration 6:
If the IF(sn k )(BC) interaction function is smaller than IF(sn k )(BBC), and if the obtained COST is less than the COST, then the new BBC will be found. Otherwise, the BC will be assigned to the BBC with the minimum BandC in the transmission range R.
On the 18th to 20th lines, that BC health values are listed based on the number of bacteria divided by the reproduction step (see 19 th line). On lines 22th to 24 th of the Algorithm 3, the new position of the BC is randomly assigned using the CreateBCInRandomPosition () function if the number 0 to 1 produced by rand () in the BCs that were included in the population is less than P ed . Finally, in the 28th line, the most appropriate BBCs have been found.
As opposed to exsisting other studies [58], many selection parameters are used with the proposed CH selection algorithm. In this way, the maximum energy efficiency is targeted. In addition, the heterogeneous WSN feature provides the intention to be selected from the advanced nodes of the CHs (see line 1 of Algorithm 2).

Proposed Energy-Transmission Boundary Range-Cognitive Routing Algorithm
The proposed transmission-aware single hop to MS algorithm is a trajectory algorithm that is generated by selected visiting CHs by MS based on the proposed CH selection algorithm in Section 4.2. The objective of this algorithm is that the MS can navigate all of the CH nodes and collect the necessary information. The collected data is transmitted to BS. An exemplary MS trajectory showing all of these processes is shown in Figure 7.
Sensors 2019, 19 FOR PEER REVIEW 15 produced by rand () in the BCs that were included in the population is less than . Finally, in the 28th line, the most appropriate BBCs have been found.
As opposed to exsisting other studies [58], many selection parameters are used with the proposed CH selection algorithm. In this way, the maximum energy efficiency is targeted. In addition, the heterogeneous WSN feature provides the intention to be selected from the advanced nodes of the CHs (see line 1 of Algorithm 2).

Proposed Energy-Transmission Boundary Range-Cognitive Routing Algorithm
The proposed transmission-aware single hop to MS algorithm is a trajectory algorithm that is generated by selected visiting CHs by MS based on the proposed CH selection algorithm in Section 4.2. The objective of this algorithm is that the MS can navigate all of the CH nodes and collect the necessary information. The collected data is transmitted to BS. An exemplary MS trajectory showing all of these processes is shown in Figure 7.  The important aspect of this proposed algorithm is to reduce the tour time and the length that MS travels. In this sense, the penetration of the MS into the transmission range of the CHs will be sufficient to acquire data, as seen transmission range points from Figure 7. This means that it does not need to enter the exact position of the CH in the clusters that have different sensor node numbers. Accordingly, in a delay-aware method, the MS trajectory will occur. Afterwards, MS delivers all of the collected and aggragated data (M_CDA) to the base station (BS). Thanks to BS, the data are saved as data or information to databases. Finally, someone who wants to view or use the data can accsess them from the computer or wireless channel. The pseudo-code of the proposed algorithm is provided in Algorithm 4. For route discovery CH(i) to MS, the routing packet format that is transferred in the network can be given in Figure 8 and a description of the routing packet segments is given in Table 4. The important aspect of this proposed algorithm is to reduce the tour time and the length that MS travels. In this sense, the penetration of the MS into the transmission range of the CHs will be sufficient to acquire data, as seen transmission range points from Figure 7. This means that it does not need to enter the exact position of the CH in the clusters that have different sensor node numbers. Accordingly, in a delay-aware method, the MS trajectory will occur. Afterwards, MS delivers all of the collected and aggragated data (M_CDA) to the base station (BS). Thanks to BS, the data are saved as data or information to databases. Finally, someone who wants to view or use the data can accsess them from the computer or wireless channel. The pseudo-code of the proposed algorithm is provided in Algorithm 4. For route discovery CH(i) to MS, the routing packet format that is transferred in the network can be given in Figure 8 and a description of the routing packet segments is given in Table 4.  The important aspect of this proposed algorithm is to reduce the tour time and the length that MS travels. In this sense, the penetration of the MS into the transmission range of the CHs will be sufficient to acquire data, as seen transmission range points from Figure 7. This means that it does not need to enter the exact position of the CH in the clusters that have different sensor node numbers. Accordingly, in a delay-aware method, the MS trajectory will occur. Afterwards, MS delivers all of the collected and aggragated data (M_CDA) to the base station (BS). Thanks to BS, the data are saved as data or information to databases. Finally, someone who wants to view or use the data can accsess them from the computer or wireless channel. The pseudo-code of the proposed algorithm is provided in Algorithm 4. For route discovery CH(i) to MS, the routing packet format that is transferred in the network can be given in Figure 8 and a description of the routing packet segments is given in Table 4.

CHofIP(i) MSiD
limitArea M_CDA Figure 8. The routing packet format transferred in the network.    1-2). First, starting from the first CH, when considering the MS, a path is created with the cruscal method, which is one of the minimum spanning tree algorithms. This path is assigned to the trajectory (line 3-4). As seen on line 5 of the Algorithm 4, trajectory edges are recorded in the edge section called limitArea. For the CH number, the first x value is 0. This x value in the boolean data type determines whether the MS is in the CH transmission range or not. Dist distance between CH and MS is measured (line [6][7][8]. If this distance is less than or equal to the transmission range R(i), then the x value is set to 1 and the trajectory boundary edge is assigned to the previously defined limitArea (line 9-11). These boundary edges describe the formation of a trajectory that may be sufficient by the joining of MS into the transmission range of the CH. This prevents delays resulting from navigating (delay-aware effect). Subsequently, if the value of x is 1, then the nearest called intersection point (IP) is assigned to the cluster (CHo f IP(i)), called the intersection point, which intersects the transmission  [13][14][15]. If CHo f IP(i) is the empty set, then CHo f IP(i) is included in IP and the cluster is merged (line [17][18]. Thus, a trajectory belonging to the MS will be found. Figure 9 presents a flowchart that explains the discovery of the MS trajectory.  Figure 9. A flowchart of MS trajectory discovery.

Simulation setup
This study, together with the proposed algorithms, was performed using the Matlab 2016a program, which runs on an Intel core i7 processor with a 3.40 GHz CPU and 8GB of RAM. Experimental results were obtained according to many network and simulation parameters. The simulation results were carried out on the basis of network dimensions of 250 × 250 2 and 500 × 500 2 represent scenario 1 and scenario 2, respectively. The rest of the parameters that were used in the scenarios are same with each other. In order to measure the sensor node density, analyzes were performed using a randomly distributed 200 to 1000 sensor nodes in the detection area. Two network scenarios that were used with these two network dimensions are considered. In the network model, heterogeneous network structure is designed as normal, advanced, and super nodes. Advanced nodes were used for the selection of CH. The MS node is designed as a super node without energy restriction. One-fifth of the total number of nodes is distributed as advanced nodes with two times the energy from normal nodes. The transmission ranges are 50 m and 80 m for normal nodes and advanced nodes, respectively. In the proposed bacterial foraging-based CH selection algorithm, 50 to 100 bacterial cells were distributed in the initial population, but the proposed algorithm showed better solutions when using 72 bacterial cells. The proposed algorithm was performed 100 times for 0.5 h simulation time. The average of sample data that were obtained to assess network and energy performances was taken into account in the graphs. Tables 5 and 6 provide a list of the network and proposed algorithm parameters that were used in the simulations. All of the algorithms used in simulations were tested under the same comparison conditions. Table 5. List of the network parameters.

Simulation Setup
This study, together with the proposed algorithms, was performed using the Matlab 2016a program, which runs on an Intel core i7 processor with a 3.40 GHz CPU and 8GB of RAM. Experimental results were obtained according to many network and simulation parameters. The simulation results were carried out on the basis of network dimensions of 250 × 250 m 2 and 500 × 500 m 2 represent scenario 1 and scenario 2, respectively. The rest of the parameters that were used in the scenarios are same with each other. In order to measure the sensor node density, analyzes were performed using a randomly distributed 200 to 1000 sensor nodes in the detection area. Two network scenarios that were used with these two network dimensions are considered. In the network model, heterogeneous network structure is designed as normal, advanced, and super nodes. Advanced nodes were used for the selection of CH. The MS node is designed as a super node without energy restriction. One-fifth of the total number of nodes is distributed as advanced nodes with two times the energy from normal nodes. The transmission ranges are 50 m and 80 m for normal nodes and advanced nodes, respectively. In the proposed bacterial foraging-based CH selection algorithm, 50 to 100 bacterial cells were distributed in the initial population, but the proposed algorithm showed better solutions when using 72 bacterial cells. The proposed algorithm was performed 100 times for 0.5 h simulation time. The average of sample data that were obtained to assess network and energy performances was taken into account in the graphs. Tables 5 and 6 provide a list of the network and proposed algorithm parameters that were used in the simulations. All of the algorithms used in simulations were tested under the same comparison conditions. The possibility intensity function for a normal distribution with mean µ, standard deviation σ, and variance σ 2 is given in Equation (16). ∝ is used for the trade-off between residual energy and node load. β is used for the trade-off between load distribution and energy consumption. As seen in Figure 10, after some simulation iterations, we set ∝ and β at 0.6 and 0.4, respectively.
We found these values in appropriate mean form, according to normal distribution. Additionally, we assume that δ is the same value as that of σ is 0.05 in the simulations. The possibility intensity function for a normal distribution with mean , standard deviation , and variance 2 is given in Equation (16). ∝ is used for the trade-off between residual energy and node load.
is used for the trade-off between load distribution and energy consumption. As seen in Figure 10, after some simulation iterations, we set ∝ and at 0.6 and 0.4, respectively. We found these values in appropriate mean form, according to normal distribution. Additionally, we assume that is the same value as that of is 0.05 in the simulations.

Performance Evaluation
To evaluate our study versus existing algorithms, the simulations were caried out in terms of performance metrics with their results being presented below. i.
Number of alive nodes in the network: The alive nodes metric is taking into consideration the first node's starting to die and all the nodes's dying. We have tested our proposed algorithm over the other protocols varying two scenarios, including scenario 1 and scenario 2 in terms of the number of alive nodes in the network. We have used 200 nodes that are distributed in the network. As seen in Figure 11a, the nodes starts to die after the 1224 th round, while using our algorithm in the scenario 1. This result validates that the proposed method outperforms the existing algorithms for longer rounds. This is because the proposed algorithm is able to utilize the network energy in a balanced manner. Additionally, as shown in Figure 11b, all of the algorithms provide less performance than before when we simulate them in scenario 2. However, our algorithm is still the best performance in comparing the other algorithms. We notice that it requires more sensor nodes deployed in the sensing area to continue for longer rounds in large-scale wireless sensor networks. ii. Total remaining energy of the network: By this performance metric, the total residual energy over the lifetime of the network is calculated. We have comprehensively simulated the performance of the proposed algorithm over the other algorithms in both scenarios in terms of the remaining energy of the network versus the number of rounds.
utilize the network energy in a balanced manner. Additionally, as shown in Figure 11(b), all of the algorithms provide less performance than before when we simulate them in scenario 2.
However, our algorithm is still the best performance in comparing the other algorithms. We notice that it requires more sensor nodes deployed in the sensing area to continue for longer rounds in large-scale wireless sensor networks. ii. Total remaining energy of the network: By this performance metric, the total residual energy over the lifetime of the network is calculated. We have comprehensively simulated the performance of the proposed algorithm over the other algorithms in both scenarios in terms of the remaining energy of the network versus the number of rounds.
We have used 200 nodes that were distributed in the network. It can be observed that, when using our proposed methods, the total energy of the network is completely consumed after longer rounds when compared with the existing protocols. For example, as shown in Figure 12(a) and Figure  12(b), the remaining energy of the proposed algorithm in 3200 th round is the highest value with approximately 40 J and 17 J in scenario 1 and scenario 2, respectively. It can be said that the nodes use up energy of the network rapidly in the large-scale networks. We have used 200 nodes that were distributed in the network. It can be observed that, when using our proposed methods, the total energy of the network is completely consumed after longer rounds when compared with the existing protocols. For example, as shown in Figure 12a,b, the remaining energy of the proposed algorithm in 3200th round is the highest value with approximately 40 J and 17 J in scenario 1 and scenario 2, respectively. It can be said that the nodes use up energy of the network rapidly in the large-scale networks. iii. Number of packets received by BS: By this performance metric, the total number of packets received by BS is taken into account. We have run the algorithms with respect to the number of packets received by BS varying from 200 to 1000 sensor nodes for scenario 1 and scenario 2. As seen in Figure 13(a), if our proposal protocol is used in the simulations, the total number of packets that are received by BS is almost 3.9 × 10 5 , 4.1 × 10 5 , 4.25 × 10 5 , 4.5 × 10 5 , and 4.8 × 10 5 for 200, 400, 600, 800, and 1000 nodes, respectively. According to Figure 13(b), the total number of packets received by BS considerably diminishes because of more packet losing in the scenario 2 than another. We observe the most and least data packets obtained by the BS in the proposed method and I-ACO. This is due to the fact that our algorithm developed as combine and mobile structure, and can be delivered the packets to the destination more accurately when compared to others. iii. Number of packets received by BS: By this performance metric, the total number of packets received by BS is taken into account. We have run the algorithms with respect to the number of packets received by BS varying from 200 to 1000 sensor nodes for scenario 1 and scenario 2.
As seen in Figure 13a, if our proposal protocol is used in the simulations, the total number of packets that are received by BS is almost 3.9 × 10 5 , 4.1 × 10 5 , 4.25 × 10 5 , 4.5 × 10 5 , and 4.8 × 10 5 for 200, 400, 600, 800, and 1000 nodes, respectively. According to Figure 13b, the total number of packets received by BS considerably diminishes because of more packet losing in the scenario 2 than another. We observe the most and least data packets obtained by the BS in the proposed method and I-ACO. This is due to the fact that our algorithm developed as combine and mobile structure, and can be delivered the packets to the destination more accurately when compared to others.
of packets that are received by BS is almost 3.9 × 10 5 , 4.1 × 10 5 , 4.25 × 10 5 , 4.5 × 10 5 , and 4.8 × 10 5 for 200, 400, 600, 800, and 1000 nodes, respectively. According to Figure 13(b), the total number of packets received by BS considerably diminishes because of more packet losing in the scenario 2 than another. We observe the most and least data packets obtained by the BS in the proposed method and I-ACO. This is due to the fact that our algorithm developed as combine and mobile structure, and can be delivered the packets to the destination more accurately when compared to others.  iv. Trajectory length travelled by MS: This is total routing path length visited by MS. We have experimented all of the algorithms according to trajectory length performance parameter varying from 200 to 1000 sensor nodes that were deployed randomly in the network.
Our proposal has generated the minimum travelling path among the existing algorithms due to the fact that the proposed energy-delay and the transmission aware routing protocol is able to determine the best routes for each period. Thanks to the single-hop communication of MS with CH, and visiting the CHs in their transmission range, the trajectory length is shortened. For instance, as illustrated in Figure 14a,b, the proposed algorithm achives the best results almost 0.6 × 10 4 and 1.15 × 10 4 path lengths for 200 nodes in scenario 1 and scenario 2, respectively. However, as the number of nodes increases, the travelling length extends in both scenarios. Additionally, Figure 14b depicts that the trajectory lengths for all of the algorithms are extremely higher values than that of presented in Figure 14a, because of the number of travelling and delivering packet hops in the large-size networks. We ran the proposed algorithm for 200 nodes in scenario 1 and obtained the best trajectory that was travelled by MS, as seen in Figure 15. We do not present the simulation graph of the mobile sink trajectory for scenario 2 to the readers, because the network graph is found as very complex visulation. Actually, we consider that presenting Figure 15 is sufficient in understanding the network model and the proposed methodology of our proposal combined scheme. presented in Figure 14(a), because of the number of travelling and delivering packet hops in the largesize networks. We ran the proposed algorithm for 200 nodes in scenario 1 and obtained the best trajectory that was travelled by MS, as seen in Figure 15. We do not present the simulation graph of the mobile sink trajectory for scenario 2 to the readers, because the network graph is found as very complex visulation. Actually, we consider that presenting Figure 15 is sufficient in understanding the network model and the proposed methodology of our proposal combined scheme.      v. Packet delivery delay: This is the latency time to deliver data from the source node to the destination node (MS). The lower value means it gives better performance. As shown in Figure 16a, Packet delivery delay decreases in all of the algorithms as the mobile sink speed is about 5 m/s. It occurs, owing to the fact that the sink motility significantly minimizes the hop number and the distance of the sent data packets to the BS. However, higher mobile sink speed leads to obtaining sink possition information. We note that the proposed scheme demonstrates the lowest packet delivery delay among the algorithms compared, as it is able to discover the shortest trajectories.
algorithms, as plotted in Figure 16(b). However, once the speed of the mobile sink increases more quickly, the throughput value decreases, owing to the fact that MS trajectories change rapidly. The throughput for our proposed algorithm is better than those of other protocols due to the best MS communication with CHs. In this way, MS could gather more accurate data from CHs and deliver it to the BS. vii. Packet delivery rate: This metric is the ratio of the number of received packets at the mobile sink to the send packets by source nodes. The higher value means that it gives better performance. As illustrated in Figure 17(a), the proposed protocol demonstrates the higher packet delivery ratio of 99% with increasing sink speed, especially between 4 and 5 m/s, and this ratio sharply decreases after the speed of the mobile sink increases. This performance validates the benefits of using appropriate mobile sink speed in the network.
viii. Functional overhead: By this performance metric, the number of data packets that is received by the MS is computed. As shown in Figure 17(b), the functional overhead of the proposed system is the lowest among the other presented algorithms. This originated because of the clustering of the network and routing to BS with best CH selection in the clusters. This vi. Throughput: This performance criterion means how accurately the data is transmitted and how accurate the data is delivered from the first bit to the last bit. We have assessed the performances of the algorithm for varying mobile sink speeds from 1 m/s to 8 m/s. The results clearly show that throughput increases with the mobile sink speed up to 5 m/s for all algorithms, as plotted in Figure 16b. However, once the speed of the mobile sink increases more quickly, the throughput value decreases, owing to the fact that MS trajectories change rapidly. The throughput for our proposed algorithm is better than those of other protocols due to the best MS communication with CHs. In this way, MS could gather more accurate data from CHs and deliver it to the BS. vii. Packet delivery rate: This metric is the ratio of the number of received packets at the mobile sink to the send packets by source nodes. The higher value means that it gives better performance. As illustrated in Figure 17a, the proposed protocol demonstrates the higher packet delivery ratio of 99% with increasing sink speed, especially between 4 and 5 m/s, and this ratio sharply decreases after the speed of the mobile sink increases. This performance validates the benefits of using appropriate mobile sink speed in the network.  (17). We have executed the presented algorithms by simulations according to the energy efficiency during the round iterations. Figure 18 x. Packet loss rate ( ): The goal of using this metric, calculated by a formula given in Equation (18), is informing the rate of packet losses due to the functionality of the implemented protocol. We have tested the worked algorithms in terms of packet loss rate versus the number of nodes. viii. Functional overhead: By this performance metric, the number of data packets that is received by the MS is computed. As shown in Figure 17b, the functional overhead of the proposed system is the lowest among the other presented algorithms. This originated because of the clustering of the network and routing to BS with best CH selection in the clusters. This protocol guarantees the single hop communication with BS. On the other hand, it can be observed that functional overhead increases fairly while mobile sink speed increases. ix. Energy efficiency (E e ): This metric is used for a performance measurement that observes the network life time. It is calculated via assessing the ratio of the total number of transmitted packets to the BS and the overall network's energy consumption during the simulation rounds. The formula of energy efficiency ratio E e is presented in Equation (17). We have executed the presented algorithms by simulations according to the energy efficiency during the round iterations. Figure 18a demonstrates that the performance results of the IACO, PSO, nCRO-UCRA, BI-DFAMDT, starfish algorithm, and our proposal scheme are given as the ordered level from the least to most energy efficient level. Although it has partially disrupted after the 3100th round, it has generally demonstrated stable energy efficiency. The proposed algorithm expends less energy thanks to the balanced CH selection algorithm and energy aware routing mechanism in the heterogeneous network. As seen in Figure 18(b), our proposed algorithm produces the least packet loss rate among the algorithms. As the number of nodes increases in the network, the packet loss rate also increases due to the events of packet collisions and uncorrect packet deliverations.
xi. Number of selected CHs and advanced energy usage rate (%): We also evaluate the advanced energy usage rate as the percentage in the network. We formulate this ratio with the abbreviated name , as given in Equation (19). Normally, CHs are selected from normal nodes because there is no heterogeneity in other algorithms. However, we used the other algorithms for the comparison terms to be equal. Thus, we distributed the same number of advanced nodes to the network area as our algorithm. We have calculated the number of selected CHs using the algorithms varying from 40 to 200 advanced nodes for scenario 1 (see Figure 19(a)) and scenario 2 (see Figure 19(b)). The higher this score, the more performance on behalf of the energy of the advanced nodes is proportionally used in the network. If more CH is selected than the existing advanced nodes, the energy of the advanced nodes is not wasted. As seen in Figure 19(a) and Figure 19(b), when using our proposed algorithm, the number of selected CHs is higher for both scenarios when compared to other algorithms.
However, in scenario 2, the number of selected CHs decreases because of the distance factor x. Packet loss rate (PLR): The goal of using this metric, calculated by a formula given in Equation (18), is informing the rate of packet losses due to the functionality of the implemented protocol. We have tested the worked algorithms in terms of packet loss rate versus the number of nodes.
As seen in Figure 18b, our proposed algorithm produces the least packet loss rate among the algorithms. As the number of nodes increases in the network, the packet loss rate also increases due to the events of packet collisions and uncorrect packet deliverations. xi. Number of selected CHs and advanced energy usage rate (%): We also evaluate the advanced energy usage rate as the percentage in the network. We formulate this ratio with the abbreviated name AEUR, as given in Equation (19). Normally, CHs are selected from normal nodes because there is no heterogeneity in other algorithms. However, we used the other algorithms for the comparison terms to be equal. Thus, we distributed the same number of advanced nodes to the network area as our algorithm. We have calculated the number of selected CHs using the algorithms varying from 40 to 200 advanced nodes for scenario 1 (see Figure 19a) and scenario 2 (see Figure 19b). The higher this score, the more performance on behalf of the energy of the advanced nodes is proportionally used in the network. If more CH is selected than the existing advanced nodes, the energy of the advanced nodes is not wasted. As seen in Figure 19a,b, when using our proposed algorithm, the number of selected CHs is higher for both scenarios when compared to other algorithms. However, in scenario 2, the number of selected CHs decreases because of the distance factor and the uncontrolable effect of selecting CHs (see Figure 19b). Tables 7 and 8 present the advanced energy usage results for scenario 1 and scenario 2, respectively. According to the results, it can be said that our proposal combined scheme has achieved 88.1 and 72.8 AEUR for scenario 1 and scenario 2, respectively.

Conclusions and Future Work
In this study, we offer several solutions for optimization problems, including multi-hop in CH selection and orientation in clustering. For this purpose, we propose two algorithms in this work. First, we present a bacterial interaction and foraging-based CH selection method. The main purpose of this protocol is to create the best set of CHs, when considering energy balance, node degree and energy level, distance, and cost function parameters with an integrated manner. Thanks to the designed CH selection algorithm, MS can collect data by single-hop as soon as it approaches within the transmission boundary range of CH. Hence, we get rid of the multi-hop challenge by this algorithm. Secondly, we propose a routing algorithm that can work dynamically with energy and transmission boundary range awareness, using the [CH 1 , CH 2 , . . . , CH n ] set that was obtained as a result of the first algorithm. Thus, MS learns the best trajectory that was obtained by visiting the all of the CHs in the most advantageous way. The MS detects CHs in the coverage areas, called intersection point, representing the path in our algorithm, and it adds this path to the route savings. The proposed scheme was simulated and compared with the IACO, PSO, nCRO-UCRA, BI-DFAMDT, and starfish algorithm by varying number of nodes, network sizes, and MS speeds. This study shows superiority over the competitive studies with respect to energy efficiency, packet loss rate, number of alive nodes in the network, total remaining energy of the network, number of packets received by BS, trajectory length travelled by MS, packet delivery delay, throughput, packet delivery rate, advance energy usage rate, and functional overhead performace metrics; this claim can be observed from the simulation results that were obtained from the Matlab 2016b software. It can be said that our study is more adaptive and applicable in real WSN scenarios. However, future work will be focused on fault tolerance and detection or time complexity issues that are not addressed in the designed network. We plan to develop new methods to overcome these problems.