Ant Lion Optimizer Based Clustering Algorithm for Wireless Body Area Networks in Livestock Industry

Wireless Body Area Networks (WBANs) are emerging in the livestock industry for remote monitoring of cattle using wireless body sensors (WBS). The random mobility of animals acting as nodes causes the network’s topology to change rapidly, originating from scalability and reliability issues. Stable transmission of acquired data to the base station requires an intelligent clustering mechanism that reduces the energy consumption and fulfills the network’s constraints. Several clustering techniques are available as a solution, but these techniques yield numerous cluster heads, resulting in more energy utilization. Higher energy utilization lessens the effective life of WBSs and increases monitoring costs. This paper presents a metaheuristic approach for selecting optimal clusters in WBANs to realize an energy-efficient routing protocol for livestock health and behavior monitoring. The proposed approach employs Ant Lion Optimizer (ALO) to select the optimal clusters for different pasturage sizes using sensors of different transmission ranges considering user’s preferences about cluster density. The proposed technique with ALO is compared with other recent techniques such as Ant Colony Optimization, Grasshopper Optimization, and Moth Flame Optimization. The comparison results show the proposed technique’s effectiveness in realizing energy-efficient protocols of WBANs for remote monitoring applications.


I. INTRODUCTION
The livestock industry plays a significant contribution to the economic development of a country, and the profit gains from this industry mainly depend upon the well-being and good health of the animals. As meat, wool and milk are on the rise due to the increasing population; the livestock industry has also expanded to cater to the emerging demands with new requirements and challenges. Among various challenges, animals' behavior and health monitoring is a big challenge for the livestock industry to ensure their well-being. Though monitoring is manually possible, data collection and animals [2]. Network formation takes place temporarily between humans or animals for resource sharing. Communication in WBANs can be classified into three major classes, which are Node to Node (N2N), Node to RBS (N2S), and hybrid communication (N2N-N2S). One node is selected as a Cluster Header (CH) responsible for sending information to RBS. The RBS contains infrastructure for data handling, processing, and storage. The general communication layout of WBANs in the livestock industry is shown in Fig 1. WBANs are generally dynamic since nodes come across numerous structural deviations caused by random motion [3]. The ad-hoc creation and destruction of communication links due to nodes' random mobility result in higher energy consumption. This consumption of energy resources reduces the life of WBSs and WBANs. The life span of a network can be enhanced by predicting the flow pattern of nodes. The extended life of WBANs will open large venues for their usage in commercial, multimedia, health, and behavior monitoring applications. In surveillance applications, the delays can be extremely risky; therefore, Quality of Service (QoS) is to be ensured during data transmission.
Scalability is another major issue that can damage the sustainability of the network. Load balance among CHs must also be considered for the network's life span [2], [4]. Communication of data is a resource-hungry process, especially in terms of energy. In biosensors, power loss during communication is much greater than the exact size of other networks.
Short transmission range of nodes and dynamic interruptions in network topology are other challenges in establishing a stable communication link. Energy is consumed in the reconstruction of the network topology. Routing is an additional burden that can seriously drain energy reserves. Since the nodes in WBANs are mobile, topology changes also occur at a comparatively faster rate, hence affecting the network's scalability. To keep the scalability of the network guarded and secured, grouping/clustering of nodes can be done in WBANs. The clustering-based routing algorithms play a vital role in effective communication and realizing the network's prolonged lifetime.
The development of reliable and efficient routing protocols for WBANs is a complicated task. It involves various attributes such as energy consumption, speed, direction, network lifetime, node density, change in network topology, quality of service, and the transmission range of WBSs. Specific challenges and uniqueness of WBANs are reviewed in [5]- [7] The clustering of nodes is one remedy among many others for addressing all the mentioned concerns. Clustering refers to the grouping of nodes to transfer data of WBSs to RBS. An intelligent clustering approach is bound to make a network more manageable, scalable, optimized, and balance the network load. In clustering, nodes of WBANs are categorized based on their similarities. Such similarities among the nodes can be obtained by different parameters like their position, the distance between nodes, bandwidth availability. There are two types of nodes within a cluster: CH and the other is cluster members. A CH, also known as cluster leader, is selected from the nodes as illustrated in Fig 1 considering the relative position and transmission range of the WBSs. The cluster size in BANs is directly dependent on the transmission range and residual energy of the node. In other words, nodes with more residual energy and more extensive transmission ranges result in bigger sizes of the clusters, and vice versa [8]. The process of node clustering must be performed intelligently because it directly affects the network's lifetime and, eventually, the quality of service. Since nodes spending more time as CHs will lead to decreased performance due to less residual energy. The clustering of nodes while considering different parameters is an NP-hard problem, and the selection of CH in clustering tends to play a critical role in this regard. The CH is responsible for forming and ending clusters, topology selection for maintenance, and resource provision to cluster members. CH also looks after the communication for both inside the cluster and other accessible clusters of networks. The network's overall performance can be determined by clustering stability, computed by the lifetime of clusters, CH change ratio, and conversion ratio of cluster nodes to CH.
Due to various parameters and dynamic nature, deterministic algorithms are not feasible for optimal node cluster selection in WBANs. Similarly, routing protocols modeled for WSNs and other ANETs are not suitable for WBANs as these are mobile or vehicular ANETs [9]. Several clustering algorithms based on metaheuristic techniques are available in this domain to serve as a solution, but these algorithms yield more CHs, resulting in more resource utilization. As an increase in the number of clusters causes more energy consumption, so the optimal selection of clusters with the optimal CHs is essential for the extended life of the ANET. This work relates to optimal clustering in WBANs for their energy-efficient and prolonged operation.

A. PAPER CONTRIBUTIONS
The main contributions of this work are the following: 1) It presents an optimal clustering algorithm for realizing the energy-efficient routing protocol of WBANs for behavior and health monitoring of animals in the livestock industry. 2) It maps the optimal cluster selection problem into a mathematical model as a multi-constraint optimization problem. User recommendations about cluster density and various constraints of the network are incorporated in the model.

3) A recent metaheuristic Ant Lion Optimizer (ALO) is
employed to solve the optimal clustering problem due to fewer parameters, more trusted convergence, and better search space exploration capabilities. 4) Various transmission ranges for different pasturage sizes and animal populations are considered for simulation purposes while selecting optimal clusters to reduce the energy consumption and extended life of WBANs.
The results obtained from ALO are compared with other metaheuristic techniques such as ant colony optimization (ACO), grasshopper optimization (GHO), and moth flame optimization (MFO) for performance evaluation.

B. PAPER ORGANIZATION
The rest of the paper is organized as follows. Section 2 presents a brief literature review highlighting some issues and challenges in WBANs and summarizes some prior works related to routing protocols in WBANs. The mathematical model for realizing energy-efficient routing protocol for WBANs is presented in Section 3. Section 4 describes ALO and its mathematical modeling, while Section 5 presents the proposed methodology. Section 6 includes simulation results and relevant discussion, while Section 7 concludes the paper.

II. LITERATURE REVIEW
Various techniques have been devised in the literature to address the issues and challenges of WBANs. Energy-efficient routing can be done through clustering, where all nodes of the network are grouped into various clusters. One leader node CH in every cluster is responsible for data collection from all other nodes in that cluster and later transmits it to the desired destination. CH facilitates direct communication links from sensing nodes to the sink of data is minimized. The selection of CH continues to be a significant overhead in Clustering-based Routing Protocols (CbRP) [19].
Wang et al. [20] suggested a clustering algorithm based on Ant Colony Optimization (ACO) for wireless sensors network having a mobile sink. The whole network is divided into different clusters, and each cluster has a CH for its management. The mobile sink is responsible for collecting data from these CHs. All the CHs remain alive for transmission of data to the mobile sink, which results in the depletion of their energy. This algorithm resolved this issue by selecting a node as CH only once.
A clustering-based algorithm for monitoring aquatic environments with a mobile sink was proposed in [21]. Particle Swarm Optimization (PSO) is used for cluster formation of sensing nodes, and these clusters move under the water surface for collecting information related to the aquatic environment.
In [22], an energy-efficient CbRP is proposed that focuses on efficient cluster formation in inter-BANs and intra-BANs communication and provides a security mechanism during cluster formation. It is very effective in security-critical environments such as defense applications where data transmitted between BANs and RBS must be secure. This protocol increases the network lifetime and provides enhanced security.
Latiff et al. [23] proposed a genetic algorithm (GA) based protocol for optimizing the base station's position. There is a restriction of a pre-determined location for calculating the position of the base station.
Another CbRP named CBBAP is proposed in [8]. The homogeneous body sensors are grouped into the cluster, and a gateway node is placed on the body's center. This gateway collects data from sensor nodes and then sends it to the sink. In this way, a power control mechanism is used for data transmission, and data is transmitted based on transmission distance. CBBAP focuses on energy efficiency, network lifetime, and throughput. SEA-BAN [24] is another type of CbRP. Apart from other clustering-based approaches, it also has the flexibility to switch between single hope and multi hope communication for data transmission. It balances a load of energy by its centralized operations. Its adaptive nature optimizes the routing based on the available energy and spatial information of nodes.
Authors in [25] presented a clustering-based energy-saving approach. In this approach, nodes are organized in a clustertree-based structure using centralized and clustering techniques. CH is selected based on the distance between nodes and their residual energy. The proposed approach focuses on creating a uniform cluster structure to reduce the transmission distance between nodes using the multi-hope method. So, in this way, energy consumption is minimized, and the network lifetime is extended.
In [26], an energy-efficient fuzzy-based adaptive routing protocol is proposed that considered the density of nodes deployed on the body. Its adaptive nature uses both clustering-based and direct transmission techniques based on the location and criticality of nodes. The selection of CH by a fuzzy logic system is made considering the residual energy in nodes, their priority, deployment density. The results show that this protocol improved network lifetime and stability compared to SEA-BAN [24].
Authors in [27] proposed a dual sink-based routing protocol DSCB to resolve the issues of SIMPLE [28] and DARE [29] protocols. SIMPLE and DARE protocols provide energy-efficient multiple hope communication, but the dis-connectivity issue remains unsolved due to a single sink. DSCB [27] solved this problem by introducing a dual sink approach. This protocol selects a node for sending data based on a cost function. This cost function is calculated based on residual energy, transmission power, and distance of the node from the sink. The results show that DSCB performs better in network lifetime, network stability, throughput, and endto-end delay than SIMPLE and DARE.
Jian et al. [30] designed an energy-efficient routing protocol based on artificial bee colonies for WBANs. The nodes in WBANs are tiny and have limited resources in terms of power and memory consumption. The authors considered energy consumption as a critical issue in this type of environment. The proposed algorithm focuses on the energy consumption problem and generates an optimal route for optimal energy utilization. These factors, such as residual energy, node level, the total cost of the path, and the given route's energy difference ratio, are used to describe the given path's optimality.
Kuila et al. [31] addressed the routing and clustering problems in wireless sensor networks through optimization methods. They formulated linear and non-linear programming models and then solved these models using PSO. The PSO-based clustering protocol focuses on each node's power consumption, whether it is CH or cluster member. This algorithm's main goal is to increase the overall network lifetime by reducing the difference between cluster members and CH. The selection of CH is based on its distance from other nodes and the node's residual energy. The routing problem is addressed using the PSO-based routing algorithm, where the main objectives are to minimize the transmission range between nodes and minimize the number of hop count in the routing path.
Authors in [32] proposed a clustering-based energyefficient protocol for BAN to BAN communication. The proposed network architecture consists of two mobile sinks, and the network area is divided into two regions. The BANs form clusters, and one BAN acts as a CH. The CH sends data to the base station through the nearest sink. A probabilistic function selects a node as CH based on its residual energy and geographical position. The simulation is done based on the different nodes and varying network sizes to show its superiority from the EDDEEC protocol [33].
Despite various techniques available in the literature, there is scope to apply the recent metaheuristic techniques with improved mathematical models for optimal clustering of WBANs. Optimal clustering of nodes considering user's preferences about cluster density and minimizing the energy burden is performed in this work using a recent metaheuristic ALO due to its simple structure, superior exploration, and convergence characteristics. The proposed technique will help realize the stable, efficient, and long-lasting WBANs for remote monitoring of cattle to fulfill the livestock industry's emerging needs.
In scheme [34], authors proposed a novel and efficient scheme based on cluster head selection to overcome the overhead of the WBANs along with maximizing the lifetime of the cluster. In this scheme, the nominated cluster head works like a socket among stack holders of the external network in tier-4 and cluster members of tier-1. Moreover, this scheme still suffered due to high jitter and latency.
In the scheme, [35] authors designed an efficient cluster-based routing information dissemination protocol to enhance the network lifetime of the WBANs with the utilization of minimal resources. Furthermore, it reduces the computational cost and communication overhead of direct communication to increase the overall performance of the networks in the user desirable way. Moreover, it is still suffered due to high packet loss and low throughput.
In the scheme, [36] authors proposed an efficient and reliable protocol to improve the QoS in WSN. Besides optimal utilization of sensor energy, an ant lion optimization algorithm is proposed here to maximize the network lifetime with best efforts services. Moreover, this approach is still suffered due to high overhead in storage and processing, which are not suitable for the resource-constrained environment of WSN.
In scheme [37] for resource-constrained WBAN, a new Energy-Efficient and Reliable Routing Scheme (ERRS) has been developed to improve the stability period and dependability. The forwarder node selection and forwarder node rotation procedures are two unique solutions in ERRS that improve the reliability and efficiency of the deployed nodes in their resource-constrained environment of WBANs.
In the scheme, [38] the difficulties of relay selection, clustering, and routing are addressed in this research to extend the lifetime of wireless body area networks. To create a hybrid data aggregation tree in the network, we first propose an efficient algorithm called ''Energy-aware Relay Selection and Cluster-based Routing (ERSCR).'' Relay selection, clustering, Cluster Head (CH) selection, and data transmission are all phases of ERSCR. It separates the biosensors into numerous clusters and assigns each cluster a different CH. Each biosensor sends information to its respective CH or relay node. An energy-balanced routing tree is then used to transport the aggregated data to the sink. For biosensor data routing, the suggested system incorporates both residual energy and distance. It not only lowers the network's energy consumption but also balances the energy consumption of different biosensors. To boost network performance, we improve the ERSCR algorithm and introduce the ''Joint Relay Selection, Clustering, and Routing (JRSCR)'' algorithm.
In the scheme, [39] Low energy clustering is becoming increasingly crucial as body area networks (BANs) become more widely used in various fields. In BANs, a clustering optimization technique is a crucial technique for ensuring that critical collected data is delivered in a reliable path and extending the lifetime of the BANs. Low energy clustering is a methodology that demonstrates how to lower the cost of network communication in BANs. One of the essential methods in investigating BANs, which has gotten much attention, is a careful low-energy clustering technique that includes monitoring capability limits. When constraints such as significant overall energy usage are considered, however, the traditional clustering method results in a high cost. As a result, a binary immune hybrid artificial bee colony algorithm (BIHABCA) is presented, a randomized swarm intelligence scheme employed in BANs motivated by immune theory and hybrid scheme. Furthermore, we devised a method that considers both the distance between nodes and the length of bits. Finally, we compared the energy cost optimized by BIHABCA to a shuffling frog jumping method, ant colony optimization, and simulated annealing in simulations with various numbers of nodes in terms of energy cost. The proposed BIHABCA method found the global optima and reduced the energy cost of transmitting and receiving data in BANs compared to the other three methods. This means that the proposed BIHABCA method finds the global optima and reduces the energy cost of transmitting and receiving data in BANs.
In the scheme, [40] authors proposed an improved method based on clustering for data collecting using ant lion optimization in WSN to improve the overall performance of the network in terms of high throughput and low delay. Moreover, the ant lion optimization algorithm is applied for clustering in WSN. Besides, this scheme is suitable for the WSN environment but is not optimal for WBANs due to its different nature.

A. ISSUES AND CHALLENGES IN REALIZING PROTOCOLS FOR WBANs
Due to these specific challenges and attributes, routing protocols modeled for WSNs and other ANETs are not suitable for implementation in WBANs. Various works highlight the unique issues and challenges in developing BAN routing protocols [2], [5]- [7]. Some works describing or coping with these challenges are discussed in this section.
To enhance the performance of WBSNs [41], a novel trustable and reliable communication protocol is designed that minimized the energy consumption of biosensor nodes along with privacy-related issues at the medical server-side when multiple stockholders want to access the medical records of the patients. The performance of this scheme is evaluated using MatLab, and for ranking purposes, a novel fuzzy logic method is applied to computes the ranking among the state-of-the-art schemes for efficiency purposes. However, interference and body fading occur in healthcare applications, affecting communication between nodes and gateways and lowering network dependability and fault tolerance. To resolve these issues, a novel energy-efficient fault-tolerant approach is proposed to improve the reliability of WBANs along with network performance [42]. In scheme [43], the authors proposed a novel technique to efficiently handle security and privacy in the resource-constrained environment of WBSNs. For this purpose, authors have proposed a generalized security technique that can adaptively work as an encryption mode, a signature mode, or a signcryption mode with a single algorithm to minimize the CPU cycles and transmission overhead. Besides, for the encoding process, fewer resources are consumed using the shorter key size of HECC. To cope with the reliable communication among heterogeneous approaches [44] deployed in WBSNs, authors applied the concept of certificate-less cryptography at the patient side. In contrast, public key infrastructure is applied at the MS side to avoid the key escrow and certificate management issues. Moreover, an online/offline signcryption mechanism is applied in this scheme to balance the load on sensing nodes, and hybrid blockchain is used to increase the security and privacy issues in WBSNs.

1) NETWORK TOPOLOGY
An appropriate network topology must be mapped to achieve an effective communication system since it directly impacts communication among devices. This is crucial particularly for BAN because of two reasons: (3) limited transmission range (4) rapid and unpredictable movement of bodies/nodes. In literature, single-hop communication and multi-hop communication is explained by most researchers. In the single-hop communication approach, data is sent directly to the destination node. However, in the multi-hop communication approach, more than one node is involved VOLUME 9, 2021 in sending the message. Therefore it is more complex and needs optimization. The clustering of nodes is one technique among many other methods to handle these issues [10], [11]. Therefore, the network topology is the main parameter that needs to be considered while designing a routing protocol for BANs.

2) TRANSMISSION RANGE
The limited transmission range of BANs nodes makes their routing more complicated. The choice of the next node in routing is much restricted due to the short transmission range. Therefore, a well-optimized routing protocol is required for the efficient transmission of packets in the network. Researchers have put forward some techniques like store and forward routing, communication with a line of sight, and non-line sight methods to deal with this issue. Consequently, while designing routing protocols for WBANs, this is another key issue to be considered [12].

3) RESIDUAL ENERGY EFFICIENCY
Residual energy efficiency refers to a challenge covering every node's energy utilization and impacts the entire network's overall life span. In WBANs, replacing or batteries of wearable sensors on nodes is difficult as it causes unease and inconvenience for the wearer. More energy is utilized when nodes communicate, and comparatively less energy is consumed when they collect data via sensing or processing them [13]. A lifetime of the network is fundamental for efficient communication. Whenever the first node of the network expires, it also reduces the network life span and confines the routing options. Therefore, BANs protocols must consider the alternate communication paths/routes to minimize the energy drainage [14], [15].

4) HETEROGENEITY OF DEVICES
In WBANs, the nature of nodes might be heterogeneous, and so are their attributes or specifications, including memory, processing capability, and power usage. This heterogeneity gives rise to some challenges concerning the quality of service (QoS) in BANs [16], [17]. This heterogeneity needs to be addressed as well during the development of routing protocols.

5) RESOURCE LIMITATION
In BANs, the limitation of resources, including energy sources, memory or storage, power, and processing capabilities, is rigorous. Bandwidth is also very constrained and limited because of interference and noise aspects [18].

6) TEMPERATURE AND OVERHEATING
When sensors are implanted in the human body, organs comprising sensitive tissues get highly affected due to the heat radiated by the sensors' circuitry. Transmission power must be kept at moderately low rates to avoid sensitive tissue damage in the human or animal body. This is another concern that makes BANs different from other ad hoc networks like mobile ad hoc networks, vehicular ad hoc networks, or WSNs.

7) PRIVACY AND SECURITY
Privacy and security of data in WBANs is the most crucial factor compared to WSNs or other ad hoc networks. Because the data being transmitted in BANs comprises critical medical information or monitoring data, protocols must consider all the privacy concerns. It continues to be a complicated task because of limited resources in BANs [18].

III. PROPOSED SCHEME
The proposed scheme depends on the following two models.

A. RADIO MODEL
In the radio model, we transfer patient data digitally in BSN to efficiently utilize the communication bandwidth. In our proposed scheme, we have applied a first-order radio model for estimating energy consumption. The model's significant components are E t (energy transmission), l (packet length), and d (distance transmission). The following Eq (1) is used for Data transfer in the resource-constrained nature environment.
Energy consumption is directly related to packet length l and d 2 distance, where E t (l, d ) is the ratio of used power by a biosensor in communication. The communication distance determines the amount of energy consumed; long-distance communications consume more energy, while short-distance communications consume less.
Eq (2) is applied to calculate the amount of energy consumed when receiving patient data. In E r (l) where packet length l and E elec are the energy requirements for receiving data by a sensor node. The amount of energy used per bit is calculated as follows; Because the distance d < d 0 so in our proposed approach we adopted the concept of the free space model: = fs = 10 PJ/bit/m 2 . Furthermore, fs is the power of the amplifier used in this model for efficient and reliable data delivery from source to destination node.
Let's estimate the rate of nodes in the network is N, and the expected number of CHs for a particular round should be k. After 'N /k' rounds, the algorithm ensures that all nodes become a CH an equal number of times and that the energy of all sensor nodes is approximately equal. Pr(t) is a probability function that predicts the probability that a node 't' would become a CH during the round 'r'.
Compared to existing techniques, simulation results show that the proposed clustering technique enhances network lifespan and performance and minimizes individual nodes' number.
The ants wander throughout the search space in various random walks that are influenced by Ant lion traps. Ant lions may construct pits proportional to their fitness, increasing their chances of catching ants.
An ant lion, which is designated as an exceptional ant lion, can catch each ant (ant lion with the highest fitness value).
If an ant's fitness is higher than the ant lion's, it is said to be caught by the ant lion.

B. MATHEMATICAL MODEL
The objective of this work is to minimize the energy consumed by the WBANs by selecting optimal CHs considering the users' preferences. Since all the nodes are mobile and move randomly, it is assumed that all the nodes have equal chances of getting all positions in search space and being selected as header nodes in normal conditions. This assumption asserts that all the nodes normally contain the same amount of residual energy. Let C = C 1 , C 2 , C 3 , . . . .,C N C represents the set of clusters consisting of N C clusters in WBANs. Let C i ∈C be the cluster i in the search space such that C i = n 1,C i , n 2,C i , n 3,C i , . . . . .,n M i −1,C i , n h,C i . Here M i denotes the number of total nodes including CH, n j,C i represents the node j in C i and n h,C i represents the CH in C i . Suppose that x j,C i and x h,C i denote the positions of node j and CH in C i as shown in Fig 2. To model the optimal clustering of nodes in WBANs as a multi-objective optimization problem, two objective functions are defined. The first objection function f 1 termed as the cluster density metric incorporates the users' preference about the number of members in a cluster. The delta difference objective is defined Eq (3) as; Here M i denotes the number of members in cluster i including CH and U d is a number describing the network user's desire for the density of clusters. The higher value of U d assigned by the user, the denser is the clusters formed and vice versa. Fewer values of the objective function f 1 represent that the number of clusters is somehow equivalent to the user's requirement. The condition f 1 = 0 represents the ideal scenario when cluster formation is precise as per the user's requirements.
The second objective function f 2 , termed as energy consumption metric, is defined to optimize energy consumption in WBANs. Let E WBANs denotes the energy consumed by all the clusters in WBANs for communicating data and E C i denotes the energy consumed by C i where i = 1, 2, 3, · · · , N C . Since the energy consumed in WBANs depends on the energy consumed in all the clusters, the objective function f 2 can be defined by Eqs (4)- (5). As the energy consumed in any cluster depends on the distance between CH and its associated member nodes, f 2 can be defined in terms of the cumulative sum of these distances in all the clusters. Lesser is the distance between CH and its members; lesser is the energy consumed in that cluster and vice versa. Energy E C i consumed in a cluster C i can be considered equivalent to summations of the distances between its CH and member nodes as shown in Eq (6).
The optimal clustering problem can be considered a minimization problem defined by the objective function in Eq (7). Minimization of the objective function meeting the constraints given in Eqs (8)-(10) results in optimal clusters to realize an energy-efficient protocol for WBANs. Less energy consumption results in the extended life of the network and thus reduces monitoring costs. Here x τ denotes the transmission range of the wireless body sensors, and N NC,max denotes the maximum number of nodes within the cluster. The symbols E R,hi and E Rth denote the header node's residual energy in ith cluster and the threshold value of residual energy of any node, respectively. The modulus operator (|· · · |) is used to evaluate the distance between two nodes. The constraint defined in Eq (8) ensures that the distance between the CH and other nodes remains within the transmission range. The constraint in Eq (9) ensures that the number of nodes within a cluster remains below a threshold value to ensure secure transmission and stable operation of WBANs. This upper limit assigned to nodes within a cluster by (9) will also control the temperature of CH within the tolerated range due to limited communication links and hence saving the animal body from experiencing the high temperatures due to hot spots. The constraint given by Eq (10) ensures that residual energy in chosen CHs is greater than the threshold value of residual energy for secure transmission.

IV. ANT LION OPTIMIZER
The optimization problem presented in the above section is dynamic with multiple constraints. In recent times, meta-heuristic techniques are prevalent in solving complex mathematical problems of various kinds, and nature [45]- [47]. Some of the prominent meta-heuristic approaches are ACO [48], GHO [49], MFO [50], PSO [51], GA [52], etc. The use of such algorithms is increasing rapidly as compared to deterministic and heuristic algorithms due to their flexibility, simple structure, local optima avoidance, and their deviation-free nature [53]. Most of the meta-heuristic approaches exploit the randomness of variables to find a solution. These methods start with random solutions, which are generally updated by taking inspiration from natural phenomena or biological objects like animals, insects, and birds to target the best solution [54].
In this work, we have used a recent ALO to solve the optimization model presented in section 3. ALO is chosen due to its fewer parameters, better search space exploration capabilities, higher local optimum avoidance rate, and more trusted convergence [55]. The inspiration of the algorithm and its mathematical modeling are presented below.  from their unique hunting ways like lions and their preferred prey ''ant''. An Ant Lion larva digs a cone-shaped trench in the sand by moving along a circular path and tossing out sand with its massive jaws. In the next step, larvae cover and hide at the bottom of the dugout trap. Larvae sit and wait for the insects or ants to be trapped. The cone-shaped pit is formed so that its edge is pointy, and insects fall right into the trap. After getting the prey trapped, the Ant Lion catches it. Sometimes, insects are not easy to catch and attempt to escape from the trap. On facing this scenario, Ant Lions smartly throw sand at the edge of the pit to slide their prey right at the bottom. Once the prey gets caught into the jaw, it is dragged under the soil and ingested. Leftover is disposed of, and Ant Lions alter the pit for the next hunt. The behavior of Ant Lions about trap size varies with the hunger level and shape of the moon. According to observations, Ant Lions dig comparatively larger pits in extreme hunger or when a full moon is seen. Their built-in lunar clock and adaptive behavior enhance their chances of survival. The inspiration of the ALO algorithm is taken from the hunting behavior of Ant Lion larvae. The following section presents the mathematical model of ALO.

B. OPERATORS OF ALO ALGORITHM
The ALO algorithm deals with the relation between Ant Lions and trapped ants. To map this interaction, ants are supposed to roam around the search space and in the meantime, Ant Lions must hunt them to become fitter. The random movement of ants for food search can be modeled by the following Eq (11); X (t) = [0, cumsum(2s(t 1 ) − 1), cumsum((2s(t 2 ) − 1), · · · , cumsum((2s(t n ) − 1)] (11) Here cumsum, t and t n denote the cumulative sum, time instant for random movement and max number of time instants. Time instants are analogous to iterations in this case so t n denotes the maximum number of iterations while s(t) represents a stochastic function which is defined in Eq (12) as; The function rand generates a random number uniformly distributed in [0, 1]. Random positions of ants are maintained in a matrix M Ant Eq (13), and are exploited during optimization. (2,2) . . . A (2,d) . . . . . . . . .
where each row denotes entries of d dimensions associated with an ant. Any entry A (n,j) denotes the variable j associated with ant n in the population. Here n shows the total number of ants while d shows the number of variables. Ants in ALO resemble particles in PSO or individuals in GA. Since the dimensions of an ant determine a specific solution's parameters, the matrix M Ant is responsible for saving potential solutions. To evaluate each ant (a potential solution), their fitness is calculated in matrix M OA given in Eq (14). (2,1) , A (2,2) , . . . , A (2,d) . . .
1) Ants travel randomly in nearly all dimensions of the search space. 2) Traps of Ant Lions have an impact on their random walks. 3) Pits are dug by Ant Lions directly proportional to their fitness (the more significant the fitness values, the larger are the pits dug). 4) Ant Lions are having more extensive trenches exhibit more probability of catching prey. 5) Every ant is likely to be caught by an Ant Lion or the elite (fittest Ant Lion) in any iteration. 6) Ants sliding towards Ant Lions are simulated by minimizing the range of random walks. 7) A case where ant tends to be fitter than Ant Lion implies that it is captured and kept underneath sand by Ant Lion. 8) Ant Lions are adaptive to reposition themselves to the most recent caught prey, and they develop their trenches to improve the catching strategy for the next prey.

1) P WALKS OF ANTS
The random walks simulation position kept within the range of search space dimensions using min-max normalization as given in Eq (17) [56].
Here a i and b i denote the minimum and maximum values of random walks of variable i respectively. d t i and c t i are maximum and minimum values of the variable i at iteration t.

2) TRAPPING IN ANT LION's PITS
In the previous section 4.2, it has been discussed that Ant Lion's traps impact random walks of ants. To map this assumption mathematically, the following equations are used.
Here Ant Lion t j represents the position of any Ant Lion j in iteration t. The symbols c t i and d t i denote the vectors of maximum and minimum values of all variables for ant i respectively during iteration t. c t and d t show vectors for maximum and minimum of all variables during iteration t respectively. An illustration of the random walk of ants in hypersphere around a specific Ant Lion modeled in Eq (18) and (19) is given in Fig 4 using a 2D search space.

3) BUILDING TRAP
A roulette wheel is used to map Ant Lion's hunting capability to assume that ants are trapped only in a single Ant Lion. The roulette wheel operator is employed to select Ant Lions based on their fitness, and hence it increases the probability of the fittest Ant Lions for catching ants.

4) SLIDING ANTS TOWARDS ANT LION
Ant Lions are adaptive to build traps following their fitness. Ant Lions throw sand to the pit's center to realize that the ant is trapped inside the trench. This mechanism slides down the prey, and the ant is unable to escape. This adaptive decrease in hypersphere's radius of the ants' random walks is mathematically modeled using the ratio I in Eq (20) and (21).

5) CATCHING PREY AND REBUILDING THE PIT
The hunting mechanism comes to its last phase when an ant reaches the trench's bottom and is caught within the Ant Lion's jaw. Ant Lion grabs the ant inside the sand and ingests its body. It is assumed that prey is caught when ants become fitter (goes inside sand) than its corresponding Ant Lion. An Ant Lion must update its position with the most recent hunted ant to boost its probability of catching new prey. The following Eq (22) is applied to model this mechanism.
Here Ant t i is the position of the ant i in the iteration t.

6) ELITISM
Elitism is a highly significant attribute of evolutionary algorithms that help keep and maintain the most optimal solution(s) obtained during the optimization process. In this work, the best Ant Lion obtained at any instant is supposed to be elite, and it affects the movement of ants in the later iterations. Therefore, it can be stated that ants randomly walk simultaneously around the elite and a specific Ant Lion selected by the roulette wheel as modeled in Eq (23).
R t A and R t E are random walks of Ant Lion and the elite respectively at any iteration t.

V. METHODOLOGY
The proposed methodology to realize an energy-efficient protocol for monitoring livestock is based on optimal clustering in WBANs using ALO. Various sizes of the grid (or pasturage) and several nodes (or animals) are considered in this work. The nodes' various parameters include their transmission range, speed, direction, location, and residual energy. Nodes with similar positions, less speed, and direction differences are included in one cluster in WBANs. Efficient clustering requires the inclusion of a node in a single cluster only. Since many combinations of clusters meeting the constraints given in expressions (8)-(10) are possible. Therefore, there is a need to select the optimal combination of clusters, resulting in less energy consumption and increased network life. Less energy consumption and a limited number of nodes associated with CH also ensure the tolerable temperature limits at the animal body. The main objective of the ALO is to select optimal clusters from their different possible combinations without violating the network constraints and user preferences. The algorithm's workflow starts with random initialization of ants and Ant Lions as nodes in the search space, as shown in  A mesh topology of the random nodes is constructed as done in [57], with each node acting as a vertex of the mesh. The internode distances of each animal are computed from other animals. The computed distances are then normalized to associate the animals in clusters described in the pseudo-code of Algorithm 1. The random ants and Ant Lions are stored VOLUME 9, 2021 using matrix M Ant and M AntLion respectively. The fitness function for each ant and Ant Lion is calculated, and matrices M OA and M OAL are used to store their fitness values, respectively. This fitness value decides whether an ant becomes fitter than an Ant Lion or not. An ant becomes the elite if it is fitter than an Ant Lion. If an Ant Lion becomes fitter than the elite, then the previous elite is also updated with this Ant Lion. The final elite, after meeting the termination criteria, is the required optimal solution giving optimal clusters.

VI. SIMULATION RESULTS AND DISCUSSION
This section deals with results from perspectives, including grid size, transmission range, and node number. The simulation parameters are listed down in Table 2.
The experiments are performed on MATLAB for various grid sizes, and results are compared with other approaches like ACO, GHO, and MFO. Clusters are generated against WBSs of numerous transmission ranges from 1m to 10m. The simulations are also conducted for different numbers of animals/nodes 50, 100, 150, and 200. The ALO exhibits the minimum value of objective function f in all simulation scenarios. The graphical results show the superiority in terms of cost reduction for various transmission ranges. We have considered the grid sizes from 100 m × 100 m to 400m × 400 m.

A. NUMBER OF CLUSTER HEADS VS. TRANSMISSION RANGE
The result presented in Fig 6 is for 100 m × 100 m grid size. According to these results, it can be analyzed that the proposed ALO is the most cost-effective approach for clustering. The 40 scenarios tested for 100 m × 100 m with different nodes using different metaheuristic techniques reveal that in 37 scenarios, ALO surpasses MFO, ACO, and GHO. In comparison, in the remaining three scenarios, the optimal clusters generated by ALO are equal to the number of optimal clusters produced by other techniques. It means ALO remains unbeaten. The three scenarios with a grid size of 100 m × 100 m, where a tie exists between ALO and other algorithms, are the following. ALO mostly outperforms other metaheuristic algorithms (MFO, ACO, and GHO) under the given conditions by giving a minimum number of clusters. The optimal clusters returned by ACO and GHO are more generous in number than ALO in all the trails, but occasionally MFO produces comparable results to ALO. For 50 nodes having a transmission range of 1m, both ALO and MFO generate an equal number of optimal clusters, as shown in Fig 7a. In the case of 150 nodes, optimal clusters produced by MFO are nearly equal to ALO using WBSs with transmission ranges of 8m, 9m, and 10m, but still, ALO outperforms, as evident from  by generating a slightly less number of optimal clusters as compared to MFO as lesser the number of clusters reduces the needed resources. Therefore, the proposed clustering algorithm employing ALO lessens the packet delay and the number of hopes for network communication, reducing the routing cost.
The same experiment is repeated using the ALO-based clustering algorithm for the pasturage size of 300m × 300m, and results are compared with other techniques. The comparison results in Fig 8 represent that ALO mostly outperforms the MFO, ACO, and GHO and returns fewer optimal clusters. Occasionally MFO produces comparable results, but in those cases, ALO still performs slightly better. For 150 nodes, 3m,7m, and 8m are the transmission ranges where ALO performs slightly better than MFO, as shown in Fig 8c. For the same 150 nodes, MFO produces better results than ALO for the 9m transmission range, but with the 10 m range again, ALO produces the same number of clusters as produced The results for 400 m by 400 m grid size are shown in Fig 9. It can be observed from the results that mostly ALO exhibits superiority and returns a lesser number of optimal clusters. Generally, as the nodes' transmission range is increased, more nodes are available to be attached with a specific CH, and thus optimal clusters generated are less in number. However, for the gid size of 400 m by 400 m with 100, 150, and 200 nodes, when the transmission range is increased beyond 8 m, no significant reduction in the number of optimal clusters are observed in all algorithms. For 200 nodes, the number of clusters continues to be the same for ALO. It becomes nearly constant after 8m, as shown in Fig 9d. There exists a unique relationship between the transmission range and several clusters. It must be noted that the number of clusters and transmission range parameters is in inverse proportion to each other. It implies that on decrementing the transmission range of WBANs, the number of clusters in the whole network grows due to availability to fewer nodes lying in the communication range of CH and vice versa.

B. NO. OF CLUSTER HEADS VS. GRID SIZE
Results also describe the relationship between the number of cluster heads and Grid size by taking various grid sizes ranges from 100×100 m to 400×400 m. It evident from Fig 6, Fig 7,  Fig 8, and Fig 9 that there exists a direct relation between the number of cluster heads and grid size. If we increase the grid size, the number of cluster heads also increases, keeping the transmission range and number of nodes constant. This is because more clusters are needed to cover the large areas. However, it is noteworthy that the proposed algorithm ALO produced a minimum number of optimal clusters compared to the mentioned algorithms. The randomness causes the overlapping of ALO with other mentioned algorithms (particularly MFO) on a few patches, but ALO usually generates more consistent solutions [58].

C. NO. OF CLUSTER HEADS VS. NO. OF NODES
Experiments also justify that for the same transmission range and grid size increase in network nodes, cluster Heads also increase. All the Graphs depict that for grid size 100 × 100 m to 400 × 400 m and transmission range (1 − 10), increasing the number of nodes also maximizes cluster heads.

VII. CONCLUSION
WBANs play a significant role in today's digital world, with a wide range of applications in various fields. Moreover, WBANs are a resource-constrained environment due to limited battery power, low processing capabilities, and less memory. In resource-constrained traditional approaches for data, transmission is not more optimal due to high energy consumption and cost. Therefore, a smart and energy-efficient clustering approach is needed for delay-less sensitive information transmission from source to destination in WBANs. As a result, the energy must be effectively managed to increase the network's lifetime and throughput. Cluster-based routing algorithms are efficient for improving network lifetime, maximizing network throughput, and reducing the network's burden to improve the overall performance of the networks for batter treatment and analysis. We have proposed a metaheuristic approach for selecting optimal clusters in WBANs to realize an energy-efficient routing protocol for livestock health and behavior monitoring. The proposed approach employs Ant Lion Optimizer (ALO) to select the optimal clusters for different pasturage sizes using sensors of different transmission ranges considering user's preferences about cluster density. The proposed algorithm is compared with other states of the art schemes such as Ant Colony Optimization, Grasshopper Optimization, and Moth Flame Optimization to evaluate the performance of optimal network selection using 100m × 100 200m × 200m, 300m × 300m, and 400m × 400m grid size respectively for 50, 100, and 150 nodes. Furthermore, it makes an original and significant contribution to ensure optimal cluster head selection to improve the lifetime of WBANs in the livestock industry.
ABDUL RAUF received the master's degree in computer science from the Capital University of Science and Technology (CUST), Islamabad, Pakistan, in 2020. He is currently working as a Network Engineer with CUST. His research interests include network security, cryptography, and data science. Researcher. Since 2017, he has been an Associate Professor with Aswan University, Egypt. He has been an Associate Professor with Prince Sattam Bin Abdulaziz University, Saudi Arabia, since 2019. His current research interests include 5G, B5G, 6G networks, cognitive radio networks, millimeter-wave transmissions, Li-Fi technology, MIMO systems, and underwater communication. He is also a technical committee member of many international conferences and a reviewer of many international conferences, journals, and transactions. He is also the General Chair of IEEE ITEMS'16 and IEEE ISWC'18.