A Novel Improved Bat Algorithm Based on Hybrid Parallel and Compact for Balancing an Energy Consumption Problem

: This paper proposes an improved Bat algorithm based on hybridizing a parallel and compact method (namely pcBA) for a class of saving variables in optimization problems. The parallel enhances diversity solutions for exploring in space search and sharing computation load. Nevertheless, the compact saves stored variables for computation in the optimization approaches. In the experimental section, the selected benchmark functions, and the energy balance problem in Wireless sensor networks (WSN) are used to evaluate the performance of the proposed method. Results compared with the other methods in the literature demonstrate that the proposed algorithm achieves a practical method of reducing the number of stored memory variables, and the running time consumption.


Introduction
Metaheuristic algorithms are one of the most main potential tools for solving complex optimization problems. Metaheuristic algorithms have been applied successfully to optimization problems in the fields of engineering, biology, and finance [1][2][3]. The Bats Algorithm (BA) is a novel meta-heuristic search algorithm [4], which simulates the behavior of the bats species for searching prey. Preliminary studies show that it is very promising and could outperform existing algorithms [5][6][7]. BA utilizes a population of bats to represent candidate solutions in a search space and optimizes the problem by iteration to move these agents to the best solutions. The general steps of this algorithm are described in the next section. In addition, the original BA can solve problems with continuous search space, while several versions of the algorithm are also proposed in the literature to solve problems with continuous and discrete search spaces. An Evolved bat algorithm (EBA) is used for numerical optimization and the economic load dispatch problem [8,9]. A hybrid between BA and Artificial bee colony (ABC) is used for solving numerical optimization problems [10]. In addition to continuous BAs, several discrete BAs have also been proposed in the literature. A binary BA (BBA) was proposed to solve the feature selection problem [11], where its solution is restricted to be a vector of binary positions using a sigmoid function. A similar BBA algorithm with a multi v-shaped version of the transfer function was adopted to solve large scale 0-1 knapsack problems [12]. Another version of BA was discretized for job shop scheduling problems [13]. However, BA has not considered the saving variable memory, and it has not been given the selected parameters of the algorithm based on the objective function, so the optimal performance will not be very effective in removing the hot spot problem.
Moreover, the rapid growth in the field of integrated circuits (IC) and Information technology (IT) has led to the development of cheap and compact size sensor nodes of Wireless sensor work (WSN) [14]. WSN is a promising and emerging technology, and it is an essential part of the Internet of Things (IoT) infrastructure for collecting relevant information in the target environment. WSN is composed of a set of a vast number of sensor nodes that are operated in an ad-hoc fashion to observe and interact with the physical world. WSN has been widely applied in a variety of fields of industry, traffic control, healthcare, and home automation [15,16]. However, the sensor nodes are limited in computing capability and storage capacity of the computing unit, in communicating the range and radio quality of the communication unit, in sensing the coverage and accuracy of the detecting unit, and in the available energy of power units [17,18]. Because of the limited memory and the constrained power, fully functional WSNs must be maintained and kept stable by the sound design employed network.
The clustering method in WSN is one of the most outstanding energy efficient ways of saving the energy network. The clusters are generated by arranging the sensor nodes into groups. A cluster has Node members (NM), and a Cluster head (CH) that are selected among NM. Clustering provides various advantages like energy efficiency, lifetime, scalability, and less delay. However, clustering can lead to a hot spot problem. Further, the unequal clustering technique is utilized for load balancing among CHs to prevent the network from developing a hot spot issue [19]. In uneven clustering, the cluster size varies proportionally to the distance to the base station (BS). Figure 1 shows the architecture of solving the unequal clustering in WSN. The size of the clusters would be reduced regardless of whether it is closer to BS. of the transfer function was adopted to solve large scale 0-1 knapsack problems [12]. Another version of BA was discretized for job shop scheduling problems [13]. However, BA has not considered the saving variable memory, and it has not been given the selected parameters of the algorithm based on the objective function, so the optimal performance will not be very effective in removing the hot spot problem. Moreover, the rapid growth in the field of integrated circuits (IC) and Information technology (IT) has led to the development of cheap and compact size sensor nodes of Wireless sensor work (WSN) [14]. WSN is a promising and emerging technology, and it is an essential part of the Internet of Things (IoT) infrastructure for collecting relevant information in the target environment. WSN is composed of a set of a vast number of sensor nodes that are operated in an ad-hoc fashion to observe and interact with the physical world. WSN has been widely applied in a variety of fields of industry, traffic control, healthcare, and home automation [15,16]. However, the sensor nodes are limited in computing capability and storage capacity of the computing unit, in communicating the range and radio quality of the communication unit, in sensing the coverage and accuracy of the detecting unit, and in the available energy of power units [17,18]. Because of the limited memory and the constrained power, fully functional WSNs must be maintained and kept stable by the sound design employed network.
The clustering method in WSN is one of the most outstanding energy efficient ways of saving the energy network. The clusters are generated by arranging the sensor nodes into groups. A cluster has Node members (NM), and a Cluster head (CH) that are selected among NM. Clustering provides various advantages like energy efficiency, lifetime, scalability, and less delay. However, clustering can lead to a hot spot problem. Further, the unequal clustering technique is utilized for load balancing among CHs to prevent the network from developing a hot spot issue [19]. In uneven clustering, the cluster size varies proportionally to the distance to the base station (BS). Figure 1 shows the architecture of solving the unequal clustering in WSN. The size of the clusters would be reduced regardless of whether it is closer to BS.  In contrast, the cluster size would be increased if the distance between the BS and CH is great. The cluster size is directly proportional to the length of CHs from BS. Unequal Clustering permits all CHs to pay the same amount of energy so that the CHs near BS spend equal energy to the CHs farther from BS. So, uneven grouping eliminates the hot spot problem by balancing the load efficiently. Due to the dense deployment and unattended nature of WSN, it is hard to recharge node batteries. The efficient energy and maximize network lifetime is a primary design goal in deployed WSN.
Several traditional approaches had dealt with unequal clustering, e.g., the probabilistic, deterministic, and heuristic approaches [20]. However, if the scale network is vast, traditional In contrast, the cluster size would be increased if the distance between the BS and CH is great. The cluster size is directly proportional to the length of CHs from BS. Unequal Clustering permits all CHs to pay the same amount of energy so that the CHs near BS spend equal energy to the CHs farther from BS. So, uneven grouping eliminates the hot spot problem by balancing the load efficiently. Due to the dense deployment and unattended nature of WSN, it is hard to recharge node batteries. The efficient energy and maximize network lifetime is a primary design goal in deployed WSN.
Several traditional approaches had dealt with unequal clustering, e.g., the probabilistic, deterministic, and heuristic approaches [20]. However, if the scale network is vast, traditional methods would require a long time for computation and the accuracy would decrease. The metaheuristic algorithm is the preferred method that can apply to address the hotspot problem adequately [21]. Challenges to the optimization applications have also arisen somehow from the limited hardware resource due to the cost, storage or space size. A compact optimization algorithm would decrease the variables of candidating solutions, but it still obtained good results [22].
In this paper, we extend our previous conference papers [7,23] by hybridizing the parallel with the compact techniques for the numerical optimization problems and balancing the energy consumption problem in WSN. The logic behind extending works includes a hybrid parallel and compact, an added weight to control the probability of sampling for the perturbation vector, and selected parameters for the balancing the energy consumption problem of WSNs. The parallel processing considers the diversity of communication strategies. The compact technique considers improving the built probability model. The poor sampling individuals in the subgroups have been replaced with the better sampling competition agents according to the fitness evaluation.
The rest of the paper is organized as follows: Section 2 provides a brief review of BA and a statement hotspot problem in WSNs. Section 3 presents analysis and a design for hybrid parallel and compact BA (pcBA). The simulation test and results are discussed in Section 4. A solution to the balanced energy consumption problem in WSN is figured out in Section 5. Section 6 summarizes the conclusion.

Bat-Inspired Algorithm
The inspiration for the Bats algorithm (BA) [4] was drawn from the echolocation of the species called the microbats for searching prey. The update solutions of BA were constructed based on three primary characteristics, which included echolocation, frequency, and loudness. The echolocation of Bats is used to locate the prey. The frequency is used to send out the variable wavelength. The loudness is used to search for the victim. Solutions of BA are adjusted according to evaluate objective function by using certain parameters, e.g., frequencies, loudness, and the pulse emission rates of the bats. Formulas for updating the positions and velocities of BA in d-dimensional search space are as follows.
where f i is the frequency for adjusting velocity change; f min and f max are the minimum and maximum frequency of the bats emitting the pulse; β is a generated vector randomly based on distributed Gaussian ∈[0, 1]. A frequency assigned initially for each bat in a uniform range ∈[ f min , f max ]. BA updates the vectors of the bat's location and velocity x, and v in the d-dimensional search space.
where t is the current iteration, x best is the global best location. Generating a new location of the bats in exploiting the phase strategy is formulated as.
where ε is a random variable in the range ∈ [−1, 1], and it indicates the weight for the loudness of the bats at the current generation. The loudness of bats A is defined as. where α is a variable constant. The symbol denotes the rate of the pulse emission r and ∈[0, 1]. The pulse emission rate is calculated as.
where γ is a variable constant. This rate r is considered in the process to switch the global and local search. If a random number is greater than r, a local search with a random walk is triggered.

Statement Problem in WSNs
Balancing energy consumption for a hierarchy WSN is done using a practical clustering approach for the hotspot issue in WSN [19]. The wireless radio transceivers in WSN depend on the various parameters, e.g., distance, energy consumption, the distance between the transmitters. Its receiver obeyed the attenuated transceiving power that decreased exponentially with the increasing distance. Dissipated energy of CH includes the power of aggregating the sensed information, transmitting the aggregated signal to the base station BS, and receiving signals from the nodes. If a data message is a number of l bits, the energy consumption of a node would be formulated as follows.
where E t (i) consumed is the consumed energy of CH i (i CH); n is member nodes in a round t. The distance from the CH to the BS is set to d i to BS . The distance of the member node to CH is set to d n to CH . The sensor nodes are connected to CH are set to m n . Member nodes only need to transfer data to the CH once during a round. Presumably, the distance to the CH is small, so the energy dissipation follows the Friis free space model (d 2 for lost energy). Since BS is the far distance from the nodes, presumably the consumed energy follows the multi-path model (d 4 for lost power). Parameters of consumed energy for communication include the initial power for the nodes E j , the radio electronics dissipates for receiving and transmitting units E ele , the amplifier energy E mp and E fs , and the energy of data aggregation E DA [24]. The average dissipated energy for round t is calculated as: The remaining power of cluster nodes for the round is defined as: where E t+1 (i) res is residual energy for the round (t + 1). The average residual power for round t is calculated as: The obtained residual energy for standard deviation is defined as: Average energy consumption of the network for around the denoted µ(E consumed ) in Equation (8) is minimized to save energy in the cluster nodes. To balance the energy load of nodes, we use Equations (9)-(11) for minimizing the standard deviation of residual energy δ(E res ) in WSN. The average residual energy and number of received items are optimized to prolong the sensor network's lifetime by applying a clustering evaluation model for measuring the performance.

Methodology of Parallelized Compact BA (pcBA)
This section presents an improved BA based on hybridizing the parallel with the compact for the numerical optimization problems and balancing the energy consumption problem in WSN. The improvement BA is an extension of our previous works [7,23] that considered two techniques of parallel and compact. The parallel with a communication strategy is significant for computations that exchange information with other groups, share the computation load, and enhance the diversity of individuals [25,26]. The compact technique can offer an effective way of using a saving variable memory. An efficient compromise is used to present solutions of search space for the advantages of population-based algorithms without requirements of storing actual populations of solutions. The compact algorithm simulates the behavior of population-based algorithms by employing the replacement of a community of solutions with its probabilistic representation.

Parallelized Bats Algorithm
The parallel method with communication strategies in the metaheuristic algorithm is proven to have faster convergence and more accuracy than the original algorithm [25][26][27]. The processing parallel plays a significant role in computational optimization, which is a carried computational form that operates both in the same direction and simultaneously [23,27]. To build a parallel structure, several subpopulations are created by dividing the population in ways that could evolve separately over iterations, and the best agents are selected to continually search the next generation according to the measured fitness. The communication scheme in parallel processing exchanges their properties among groups, e.g., moving, copying, immigrating, or replacing randomly. A promising region would swap with weak areas within the solution space, and exploration of a promising area is carried out in the searching space. if random ≤ ω then // Stategy1-neighboring groups 3: for i = 1 to m do 4: replace the worst(G i ) with best random from (G i , . . . G m ) 5: else // Stategy2-the best to all 7: endfor 10: endif 11: else // Stategy3-a pair swapping 12: replace worsts(G 1 ) with best(G 2 ) 13: replace worsts(G 2 ) with best(G 1 ) 14: endif The communication strategies suggested include the best to all, neighboring groups, a pair swapping, etc. The procedure with the best to all has the most excellent agents among all subpopulations migrate to every group, mutate them by replacing the worst bats in each of these groups and update them after the period exchanging time of running. The strategy with the neighboring groups is to move the best bat of one group to its surrounding groups, then replace some poorer bats after the

Compacted Bat Algorithm
The estimated distribution algorithm (EDA) process uses a probabilistic representation to get fewer stored variables, instead all the population of solutions was stored in the metaheuristic algorithms while still getting the same obtained result of optimization [28]. The compact method uses the principle of EDA to simulate the operations of the metaheuristic algorithm [7,29]. A probabilistic model was used to represent the operations of the population-based algorithm in a compact one. In this case, a real population considered as a virtual population in the compact algorithm. The virtual community is configured by probability density functions (PDFs) [30] based on EDA. Not all of the population of a solution was stored in memory, but it generated a few new solution candidates based on probability distribution stored in the memory. An attracted new candidate solution is being iteratively biased toward a promising area of an optimal solution. The likelihood of a population of individuals in an algorithm represents the probability vector of each component learned from previous generations. The structure of this vector was called the Perturbation Vector (PV) [29]. These principles were applied to the improvement of memory saving variable for compact BA.
Different from the population-based algorithms such as BA, the compact technique considered population as "virtual community" by expressing the encoded data structure of a probabilistic vector. A real-valued prototype vector represents the probability of each component being described in a candidate solution. The specified probability for each element in new candidate solutions was maintained in the optimum process. The optimization processing objective of the compact algorithm is to simulate the behavior of Bats of BA, but it was used with a much smaller stored variable memory. PV generates a candidate solution probabilistically from the vector. Competing for components toward the better solutions is reflected in the updated probability vector. The created trial solutions stayed to be allocated in boundary constraints. PV is a matrix for specifying the two parameters of mean µ and standard deviation σ values in the PDF of each design variable. It can be defined as: where t is the time steps.
A truncated Gaussian (PDF) for µ and σ values are within the interval of (−1, +1). The PDF normalizes the amplitude of area equal to 1. We use PV(µ i , σ i ) to generate the candidate solution, where x i in the compact method. The solution is corresponding to the virtual bats based on the associated Gaussian of µ and σ as the following expressed PV.
where P i (x) is the probability distribution of PV that is associated to the µ and δ in a truncated Gaussian PDF. This is the corresponding value of the PDF to variable x i . The error function indicated as er f is found in reference [31]. PDF could have found to be corresponding to the Cumulative Distribution Function (CDF) by constructing Chebyshev polynomials [32]. The arranged codomain of CDF is from 0 to 1. The described CDF is a real-valued random variable X in a value given distribution at ≤ x i . The value of the newly calculated candidate x i is a value of its inversed CDF.

Parallel Compact Bat Algorithm
This subsection presents an implementation of a hybrid of the parallel and compact methods for BA. Construct parallel, whole population split into several subpopulations, and the communication scheme are all triggers among the subpopulations. The subpopulations run in parallel and evolve independently based on BA optimization. The communicating subgroup is carried out, e.g., the most excellent bats among the subgroups immigrated to another subset and were replaced with the weakest bats according to a measured fitness, and the subgroups were updated over the period. In the phase of deployment compact, we figure out the pact to the subgroups based on probability vectors through the competition. The hybrid of the parallel and compact process is described through the illustrations in Schemes 2-7.
We extended a couple of improvements for the perturbation vector through the process of sampling and updating PV. New candidates are generated by learning and sampling from explicit probabilistic models that forward to promising solutions in search space. To control the probability of sampling of µ i in PDF, a parameter τ as a weight is suggested from between left [-1, µ i ] and right [µ i , 1]. Thus, PV can be computed into two sides of the left and right as follows: The new sampling extended approach for PDF is for generating new candidates of the group depicted in Scheme 2.
It means the PV scheme will generate the agents of x randomly.

Scheme 2 Perturbation Vector (PV) for generating new solutions
Input: parameter µ, σ of probability vector, dimension d, and τ Output: A new candidate x 1: for i = 1 to d do 2: Generated r ∈ [0, 1] randomly in uniform distribution 3: if r < τ then 4: Generating (13) 7: end if 8: end for Scheme 3 shows the initializing PV scheme as the pseudo code of compact BA (cBA). The best bat x best is computed based on the learning scheme of a sampling trial bat. If the temporary new solutions are better according to the evaluated fitness, x is then updated. k is a large constant, e.g., k is set to 10. Two design variables of winner and loser compete together to find out who is the better one according to the evaluated fitness value. The winner is moved toward a promising area in a searching space based on the comparison between two design variables for bats of the subgroup. A newly selected candidate is assigned to evaluate the given objective function. Determining a winning solution is employed based on the comparison of the chosen candidate agents. Scheme 4 displays the competing scheme for the winner/loser.

Input:
The objective function f and solutions x a , x b Output: winner or loser winner assigned to x a 3: loser assigned to x b 4: else 5: winner assigned to x b 6: loser assigned to x a 7: end if Moreover, the elements µ t+1 i and σ t+1 of the updating PV for the new solution for the winner and loser are expressed over the differential iterations. A typical parameter called virtual population Np is not strict variable corresponding to the population size variable as in a population-based algorithm.
where t is current iteration, and i = 1, 2, . . . N p . Regarding σ values, the update rule of each element is given: Another improvement for updating PV, the values of µ t+1 i and σ t+1 i are modified with a control parameter for expressing the maximum value of perturbation. A parameter ϑ is added as a weight control of the expressed the perturbations maximum value.
where β i and α i are random number distributed in [-1, 1], and distributed in [0, 1], respectively. Evaluate fitness function with selected location x compared with x best to obtain a winner for the next generation. Current location x maintained in following steps of the scheme. Scheme 5 shows the updating PV scheme.

Scheme 5
Updating PV for new candidates i 5: Improving for µ t+1 i and σ t+1 via Equations (16) and (17) with τ set to 0.01 6: end for Select best by Compete scheme via Scheme 4 6: [winner, loser] = compete(x, newx); 7: F new =f (newx); 8: Update PV scheme µ t+1 , σ t+1 , via Scheme 5 9: Global best update 11: [winner, loser] = complete(newx, x best ); 12: if (F new <F min ) 13: x best = winner; F min =F new ; 14: end if 15: The steps of the parallel compact BA algorithm are described as follows. For the first step, initialized population is divided into G subgroups, objective function f and period of R for executing the communication strategy that the bats are assigned to. For the second step, the compacted subsets are evaluated, the communication scheme activates, and assessed results are compared to find the current best solution. For the third step, the termination is checked for the terminating condition, go to the second step if the termination condition is not met, otherwise it records the best bats and obtains the value of the function f(x).
Scheme 7 shows the overall pseudo code for pcBA, in which G is subpopulations; n is the number of bats in each group; m is the number of groups; R is the exchanging period, and cBA is a compact scheme. Scheme 7 Pseudo code for Parallel and Compact Bats Algorithm-pcBA 1: Step 1. Initialization 2: generate G 1...m m ≤ N p subgroups, each G has n bats 3: assign period exchanging time R, counter t = 1 4: solutions x t i j in the j-th subgroup with n j bats, i = 1,2, . . . ,n; j = 1,2, . . . m 5: Step 2. while termination is not satisfied do 6: for j = 1 to m do 7: cBA(G i ) according to Scheme 6 8: end do 9: if(mod(t,R)==0) then 10: Communication (G 1...m ); according to Scheme 1 11: Find the current best solution x best 12: t = t + 1 13: end while 14: Step 3. Output the best solutions found

Experiment with Numerical Optimization Problems
To evaluate the performance of the proposed pcBA, fifteen optimal numerical problems selected as benchmark functions [33]. Table 1 lists the initialized range, number of variables as the dimension of the space search, and the max iteration for fifteen test functions. The experimental results of the proposed pcBA are compared with the various version of other algorithms of BA, e.g., BA [4], parallel BA (pBA) [23], and compact BA (cBA) [7], as shown in Table 2. Table 3 depicts the obtained results of the proposed pcBA compared with popular metaheuristic algorithms in the literature, e.g., Particle swarm optimization (PSO) [34], Differential evolution (DE) [35], Grey wolf optimizer (GWO) [36], and Genetic algorithm (GA) [25]. Table 4 displays the comparison of the proposed algorithm with four other compact algorithms in the literature, e.g., rcGA [37], cDE [38], cABC [39] and cFPA [40] regarding solution quality and time running. The obtained results of minimized outcomes are averaged for sequences of each testing function with the initialized range, the dimension, and max iteration in Table 1.

Name Test Functions Range Dimension Iteration
Rosenbrock Ackley 30 2000 Rastrigin Quartic Noisy x 2 i − 10 cos(2πx i ) + 10 ±5. 12 30 2000 Shubert Dixon & Price 30 2000 Michalewicz 12 30 2000 Schaffer N.2 30 2000 Matyas    Parameters setting for the algorithms occurs as follows. Virtual and real population size N of the mentioned algorithms set to 80. The dimension of the solutions space-D is set based on the problem dimension requirements listed in Table 1. Full iterations for each function are set to 2000. Several runs for each testing function are set to 25. Some of the subgroups m are set to 2, 4, and 8. An exchanging period R is established in a loop of 20 times current iterations. The further setting is referenced in reference [6]. The final results are taking average of the outcomes from all runs.
The compared results of the proposed pcBA with various bats algorithms, e.g., the BA, cBA, and pBA, are shown in Table 2. A parameter r is a ratio that is a paired comparison between pcBA and other algorithms respectively, i.e., pcBA and BA, pcBA and cBA, and pcBA and pBA. The other column values are the mean outcomes of the runs for the functions, respectively. The denoted r is symbols of '+' '-' and '~' means the 'better' 'worse' and 'approximate' measurements of the deviation with respect to their outcomes, respectively. The highlighted numbers are the best results among them in each function (each row of the table). If the pcBA is better (smaller the value for minimized, or bigger for maximized problems) than the others: BA, cBA, and pBA, then r is the symbol '+'. Similarly, the symbols "-" and "~" are for the 'worse' and 'approximated' cases. Visibly, almost all the highlighted cases belong to pcBA for testing the benchmark functions. Table 3 compares the performance for fifteen numerical optimization problems of the proposed pcBA with the other popular metaheuristic algorithms such as DE, PSO, GWO, and GA. The highlighted numbers are the best results of the obtained average outputs among them in each function. Table 4 shows the compared performance quality optimization between pcBA and the other compact algorithms such as cABC, cPFA, cDE, and rcGA. The highlighted numbers are the best results of the obtained average outputs among them in each function. As observed in Tables 2-4, the most highlighted number and the symbol "+" of better points belong to the proposed algorithm. That means the proposed approach offers a competitive algorithm.   Figure 2 illustrates the comparison of executing time of the proposed pcBA with the BA, PSO, GWO, cBA, and pBA algorithms for the first eight functions. Clearly, all cases of the time consumption for testing functions of the pcBA are smaller than the other algorithms, but the shortest running time belongs to cBA. The results of the fast processing speed are that some memory-stored parameters of cBA and pcBA are smaller than the stored solutions in the population-based algorithms. Figures 3-5 show the compared the best score results of the proposed pcBA with rcGA, cDE, cABC, cFPA, and cBA for three selected testing functions f 7 (x), f 8 (x) and f 9 (x) over 25 runs outputs in the same iteration of 2000. Clearly, the cases of these testing functions on the pcBA (indicated red curve) shows a comparatively faster convergence than other algorithms. It says the accuracy of the proposed pcBA is improved significantly. Figure 2 illustrates the comparison of executing time of the proposed pcBA with the BA, PSO, GWO, cBA, and pBA algorithms for the first eight functions. Clearly, all cases of the time consumption for testing functions of the pcBA are smaller than the other algorithms, but the shortest running time belongs to cBA. The results of the fast processing speed are that some memory-stored parameters of cBA and pcBA are smaller than the stored solutions in the population-based algorithms.

Applied pcBA for Optimally Balanced Energy Consumption
The unbalanced energy consumption in WSN with multihop communications is one that causes the hotspot problem. The energy consumption of CH nodes closer to BS is increased more than the others because of the massive traffic flows. In this section, we apply the pcBA for optimally balanced energy consumption in deployment WSN. We utilize adjustable parameters of loudness of the bats in BA and a distance coefficient ratio in the objective function for dealing with the mentioned hotspot issue. The loudness A i of BA can vary for responding to distances in clustering criterion for unequal clustering in WSN. The optimized total communication distances from the cluster members to CHs, and CHs to BS in WSNs provide the saving energy increase. The sequence of experiments consists of steps: modeling the objective function, describing proper agent representation, setting up a mapping solution model, and comparing results.

Objective Function
In designing and deploying sensor networks, a prolonging the lifetime is a core demand. A crucial factor in extending the WSN lifetime is to reduce the energy consumption of its entire network. The power consumption of WSNs is affected directly by the clustering criterion problem. The employed heuristic clustering approaches by evaluating the fitness function is one of the most efficient ways to deal with this issue. The objective function has also evaluated the WSN performance. This objective function consists of the mean consumed energy for round t in Equation (8) and the standard deviation of residual energy in Equation (11). Each sensor node member is connected to the one closest CH after the CHs are decided. Equation (1) is used to get E t (n) consumed with CH node (i CH, x i = 1) or the non-cluster head node (i non − CH, x i = 0).
where ω is the weight of average consumed energy and standard deviation of residual energy. Table 5 tabulates an example of the residual energy of round 11-12, and the power consumption of round 11 for the ten node network example. Assuming we get node 4, with the µ(E consumed ) = 0.000204, µ(E res. ) = 0.4986160, δ(E res. ) = 0.000237, the obtained result of the applied function in Equation (18) is 0.0002205 (with ω is set to 0.5) for the ten nodes network. Table 5. An example of the residual and consumed energy of 11-12 round of the ten nodes network.

Balancing Load Clusters
The hot spot problem in WSN prevents from figuring out the balancing load based on the layout of uneven clustering. The partitioned clusters in the network have different sizes. The closer clusters to BS are the hotter cluster because the traffic relay load of the CHs near BS that suffered heavier than those CHs are farther away from BS. To avoid this problem, we figure out the adjustable parameters are not only related to the objective function but are also related to the optimization algorithm. Two possible coefficients need to be adjusted: the first is changing the distance applied to the objective function, and the second is adjusting the loudness of the optimization algorithm. For the objective function of constructing unequal clusters, each CH needs to adjust its equal cluster distances. Let's R c be the distance adjustment factor, used as follows: where d CH j is the distance from node CH j to the BS, and R c is a ratio adjusting parameter. This R c is calculated as: where d max and d min are the maximum and minimum distance from the CHs in the network to the BS; R max is the maximum value of competition radius; α is a weighted factor whose value is in [0, 1]; E res. is the residual energy of CH j . Balancing the load of WSN based on clustering formation by updating Equation (7), and performing the optimal objective function by Equation (18) with the assistance of different distances Equations (19) and (20). Figure 6a depts the comparison of the applied pcBA for balancing energy consumption in WSNs with the BA, PSOTVW, and PSOTVAC approaches. It is seen that the applied pcBA outstands performance the other approaches in terms of coverage rate. Additionally, an adjusted distance of CHs to BS is applied to the pcBA for the objective function that obtained the better than nonadjusted length, as shown in Figure 6b. For the optimization algorithm, we assigned the variable of loudness A i of BA as in Equation (5) to correspond to the radius of the changing cluster size by bias iteration. We expressed the loudness of BA mathematically the time-varying through the following equation: where MaxIteration is number of the maximum iteration, Iter is the current time steps, and A max , A min are constants set to 0.5 and 0.25, respectively. The time varying loudness is mathematically represented in Equation (21) of pcBA for the hot spot problem in WSN. Figure 7a shows the comparison of some nodes alive for WSNs of advanced pcBA with PSOTVAC, PSOTVIW-WSN, and LEACH methods; and Figure 7b depicts the adjusted pcBA-WSN with unadjusted pcBA-WSN for a different loudness parameter.
where and are the maximum and minimum distance from the CHs in the network to the BS; is the maximum value of competition radius; α is a weighted factor whose value is in [0, 1]; . is the residual energy of CHj. Balancing the load of WSN based on clustering formation by updating Equation (7), and performing the optimal objective function by Equation (18) with the assistance of different distances Equations (19) and (20). Figure 6a depts the comparison of the applied pcBA for balancing energy consumption in WSNs with the BA, PSOTVW, and PSOTVAC approaches. It is seen that the applied pcBA outstands performance the other approaches in terms of coverage rate. Additionally, an adjusted distance of CHs to BS is applied to the pcBA for the objective function that obtained the better than nonadjusted length, as shown in Figure 6b. For the optimization algorithm, we assigned the variable of loudness Ai of BA as in Equation (5) to correspond to the radius of the changing cluster size by bias iteration. We expressed the loudness of BA mathematically the time-varying through the following equation: where is number of the maximum iteration, is the current time steps, and , are constants set to 0.5 and 0.25, respectively. The time varying loudness is mathematically represented in Equation (21)

Structured Model Solution
The model solution is structured as follows: a two-dimensional (x-y axes) coordinate system, generating nodes randomly with its corresponding coordinates, initial clustering with the binary CHs property, calculating distances nodes to CH, CHs to BS, and finally optimizing load balancing by applying pcBA. Table 6  Each node can communicate with others by using r transmission range. Node i can receive the signal of node j if node i is in the transmission range r of node j.

Structured Model Solution
The model solution is structured as follows: a two-dimensional (x-y axes) coordinate system, generating nodes randomly with its corresponding coordinates, initial clustering with the binary CHs property, calculating distances nodes to CH, CHs to BS, and finally optimizing load balancing by applying pcBA. Table 6 shows an example of the position of nodes in a network area. A modeled WSN is a graphs G with N nodes distributed randomly in desired areas.  Each node can communicate with others by using r transmission range. Node i can receive the signal of node j if node i is in the transmission range r of node j. Table 7 indicates the attribution of existing CHs in the WSN. This is the integer model with a binary decision variable if CH j = 1, it is the selected CH in WSN, and CH j = 0, otherwise it is the not selected CH. The initial values of communication energy parameters is referred to in reference [41]. In the target network, there are N deployed nodes in a n × n grid space where a test platform is established, where nodes were randomly distributed between (x = 0, y = 0) and (x = n, y = n) with N set to 100, 200, 300 and 400 node networks. The objective function is in Equation (18) to be repeated in generations of 2000 by different random seeds with 25 runs. Table 8 displays the initial values of the parameters for setting the experiment for optimally balancing energy consumption.  Figure 8 shows the detailed steps of processing in applied pcBA for balancing load in WSN.  Figure 8 shows the detailed steps of processing in applied pcBA for balancing load in WSN.

Experimental Results
We can figure out the optimization problem by minimizing the objective function in Equation (18). The experimental results of the applied pcBA are compared with two cases for PSO: the timevarying inertia weight (PSO-TVIW), and time-varying acceleration coefficients (PSO-TVAC) [21] and the BA [42] by regarding solution quality and speed. The obtained result is averaged from the outcomes from all runs. Figure 6a indicates four of the curves of the pcBA − WSN , BA − WSN , PSOTVIW − WSN and PSOTVAC − WSN methods for minimizing the objective function in Equation (18). Apparently, pcBA-WSN is as good as BA-WSN and faster than the PSOTVIW-WSN and PSOTVAC-WSN approaches regarding convergence. With the support of adjustable parameters in Equations (19)- (21), the size of clusters is varied based on responding to these variables to avoid the unbalanced load problem in WSNs. Figures 6 and 7 show the results of the efficiently adjusting parameters. Figure 7 compares the performance qualities in two cases of the selected parameter of Step 1: Initialize parameters: subgroups G, pulse rate , the loudness i , are set to random; define pulse frequency , as search range.
Step 2: Assign min to fitness( ), with -the best solution by means of perturbation vector PV; Generate solution from ; assign exchanging time R, counter t =1 Step 3: Update velocities v t and locations according to updating rule of BA; if it is selected best solution; assign the function value new to fitness( +1 ).
Step 4: Compare +1 and , let be the one with winner, and the other one is loser.
Step 5: Update PV, if (mod(t,R)==0 ) then Communication ( 1.. ); Find the current best solution Step 6: Accept a new solution if the solution improves ( less than ), then updating global best to +1 and assign function to Step 7: If it is not meet the termination condition go to step 3.
Step 8: Output the global best solution

Experimental Results
We can figure out the optimization problem by minimizing the objective function in Equation (18). The experimental results of the applied pcBA are compared with two cases for PSO: the time-varying inertia weight (PSO-TVIW), and time-varying acceleration coefficients (PSO-TVAC) [21] and the BA [42] by regarding solution quality and speed. The obtained result is averaged from the outcomes from all runs. Figure 6a indicates four of the curves of the pcBA − WSN, BA − WSN, PSOTVIW − WSN and PSOTVAC − WSN methods for minimizing the objective function in Equation (18). Apparently, pcBA-WSN is as good as BA-WSN and faster than the PSOTVIW-WSN and PSOTVAC-WSN approaches regarding convergence. With the support of adjustable parameters in Equations (19)- (21), the size of clusters is varied based on responding to these variables to avoid the unbalanced load problem in WSNs. Figures 6 and 7 show the results of the efficiently adjusting parameters. Figure 7 compares the performance qualities in two cases of the selected parameter of loudness of applied pcBA for adjusted cluster size with none of the selected altered loudness setting. Visibly, the average fitness values of the pcBA method in the case of adjusting A i for optimal WSN are better than the regular case of convergence for removing the hotspot problem. Table 9 compares the performance quality and running time for optimizing the objective function Equation (18) in WSNs of four methods of the pcBA − WSN, PSOTVAC − WSN, PSOTVIW − WSN, and the BA − WSN. Clearly, the average value of pcBA for the objective function is faster than those obtained by other approaches of PSO. The applied pcBA for optimizing the clustering WSN is not as different as convergence much of using BA. However, the total time consumption of pcBA method is fastest at only 2.045 min due to working memory variables being smaller. The obtained results are the average of the outcomes from all runs and are compared with a variety of versions of BA, and others in the literature. In other experiments, the performances of applied pcBA can be compared to previous methods (LEACH, LEACH-C [24,41], and HEED [43]), as illustrated in Table 10, in which FND and LND are the first nodes die, and the last nodes die respectively. Apparently, the overall performance of the applied pcBA results in a longer lifetime of the nodes than other methods.   Figure 10 shows the applied pcBA performance for 200 nodes in WSN regarding some nodes alive in comparison with those obtained from LEACH, LEACH-C, HEED methods. Obviously, the figure of the proposed pcBA is better than those obtained from LEACH, LEACH-C in both cases of Sink at the root (0, 0) and at the center.  Figure 10 shows the applied pcBA performance for 200 nodes in WSN regarding some nodes alive in comparison with those obtained from LEACH, LEACH-C, HEED methods. Obviously, the figure of the proposed pcBA is better than those obtained from LEACH, LEACH-C in both cases of Sink at the root (0, 0) and at the center.
(a) (b) Figure 9. Comparison of consumed average residual energy of the applied pcBA for WSN with LEACH, LEACH-C, HEED methods. (a) Comparison of consumed average residual energy of the applied pcBA for WSN with LEACH, LEACH-C, HEED methods; (b) The space objective function. Figure 10 shows the applied pcBA performance for 200 nodes in WSN regarding some nodes alive in comparison with those obtained from LEACH, LEACH-C, HEED methods. Obviously, the figure of the proposed pcBA is better than those obtained from LEACH, LEACH-C in both cases of Sink at the root (0, 0) and at the center.

Conclusions
In this paper, we proposed pcBA, a new optimal method based on a hybrid of the parallel and compact techniques for the Bats algorithm (BA) for optimization problems and applied it to an energy balance problem in Wireless sensor networks (WSN). The implementation of hybrid technology shows significant advantages from each of the test algorithms and achieves improved collaboration in the optimization algorithm. These methods avoid the optimum local issue in compound constrained optimization problems and allow fast convergence and memory saving. Additionally, we improved the compacting technique by using a controlling weight for adjusting the balance of the probability vector, and we enhanced the parallel techniques by making a communication strategies dynamic. In the simulation section, a set of the selected optimization problems and balanced energy consumption methods in WSNs are used to evaluate the accuracy, executing the time and the saving

Conclusions
In this paper, we proposed pcBA, a new optimal method based on a hybrid of the parallel and compact techniques for the Bats algorithm (BA) for optimization problems and applied it to an energy balance problem in Wireless sensor networks (WSN). The implementation of hybrid technology shows significant advantages from each of the test algorithms and achieves improved collaboration in the optimization algorithm. These methods avoid the optimum local issue in compound constrained optimization problems and allow fast convergence and memory saving. Additionally, we improved the compacting technique by using a controlling weight for adjusting the balance of the probability vector, and we enhanced the parallel techniques by making a communication strategies dynamic. In the simulation section, a set of the selected optimization problems and balanced energy consumption methods in WSNs are used to evaluate the accuracy, executing the time and the saving memory variable of the proposed algorithm. The compared results with BA and the other algorithms in the literature show that the proposed algorithm outperforms its competitors. Also, for balancing the energy consumption problem in WSNs, the result indicates that the proposed approach provides an effective way of utilizing the saving memory variable.