Combinatorial Optimization-Based Clustering Algorithm for Wireless Sensor Networks

As node energy of wireless sensor networks (WSN) is limited and cannot be supplemented after exhaustion, clustering algorithm is frequently taken as an effective method to prolong the lifetime of WSN. However, the existing clustering algorithms have some drawbacks, either consuming excessive energy as a result of exchanging too much controlling information between nodes, or lacking a comprehensive perspective in terms of the balance among several conflicting objectives. In order to overcome these shortcomings, a novel combinatorial optimization-based clustering algorithm (COCA) for WSN is proposed in this paper. Different from the above mentioned algorithms which take clustering as a continuous optimization problem, COCA solves the clustering problem from the perspective of combinatorial optimization. Firstly, the clustering of WSN is abstracted into a combinatorial optimization problem. ,en, the binary particle coding scheme of cluster head is proposed, which is based on the corresponding relationship between nodes and particle position vectors, and the fitness function is designed according to the parameters used in the process of cluster formation. Finally, the binary particle swarm optimization algorithm is applied to implement the clustering. COCA is validated under different scenarios compared with three other clustering algorithms. ,e simulation results show that COCA has better performance than its comparable algorithms.


Introduction
As a key part of the Internet of ings (IOT) [1,2], wireless sensor network (WSN) has been widely utilized in many fields such as industry, agriculture, military, environmental monitoring, transportation, smart home, and so on [3][4][5][6][7][8]. WSN is composed of a large number of sensor nodes which are deployed in the surveillance area. Each sensor node with limited computing, storage, and communication capabilities is usually powered by batteries. In most cases, it is difficult to replace the batteries after node deployment. Once the battery power is exhausted, the sensor node will die, and the network lifetime will be over after a large number of nodes died. To overcome the shortcomings, research on the schemes of saving node energy and prolonging network lifetime becomes a key issue in the field of WSN [9,10]. e clustering technology can reduce the energy consumption of nodes and prolong the lifetime of networks [11,12]. A WSN network can be divided into several subsets which are called clusters by using the technology of clustering. e nodes in the same cluster are adjacent to each other geographically. In each cluster, one node is selected as the cluster head (CH), and other nodes act as the members of the cluster. Instead of communicating with the base station (BS) directly, the members send their sensed data to the CHs in which the data is aggregated and sent to the BS [13,14]. e earliest proposed WSN clustering algorithm is lowenergy adaptive clustering hierarchy (LEACH) [15]. Compared with the previous planar routing algorithms, LEACH can make the network lifetime longer [16,17]. However, LEACH selects the CHs only according to the result of the comparison of a random number generated by the node and a predefined fixed threshold, which makes the number of clusters and the election of CHs very random. LEACH does not guarantee the best clustering scheme from the point of view of the energy balance of the whole network.
Since the emergence of LEACH, a lot of WSN clustering algorithms have been proposed. ere are several kinds of clustering algorithms based on different clustering criteria such as network structure, communication model, topology, and reliable routing. In this paper, we classify clustering algorithms into two categories, i.e., independent and cooperative, according to whether the BS participates in the process of clustering. Independent clustering algorithms run on network nodes without the BS's participation, and control information is exchanged among nodes. Independent clustering algorithms include HEED [18], PEGASIS [19], EECS [20], EEMC [21], TEEN [22], ECO-LEACH [23], NR-LEACH [24], and ECCR [25], etc. In cooperative algorithms, the BS participates in the process of clustering, and all or part work of clustering is done by the BS. A small amount of control information is exchanged between the BS and network nodes. e cooperative algorithms include LEACH-C [26], PDOPR [27], UC-GA and KC-GA [28], PSO-ECHS [33], approaches in [34][35][36], etc. e abovementioned two kinds of clustering algorithms both prolong the lifetime of the network to some extent, but there are still some shortcomings in terms of the working mechanism. Independent algorithms run on each node, and a large amount of control information needs to be exchanged among nodes, which leads to additional energy consumption. Although the cooperative algorithms reduce the energy consumption of control information exchange, they still cannot get the best clustering result from the perspective of the whole network because there are multiple parameters affecting the clustering and these parameters are mutually conflicting. In particular, with the development of evolved nature inspired algorithms, some clustering approaches employ them to improve clustering performance in recent years [33][34][35][36].
To reduce the node energy consumption and prolong the network lifetime, we propose a combinatorial optimization-based clustering algorithm (COCA) which runs on the BS for WSN from the point view of combinatorial optimization in this paper. We abstract WSN clustering into a combinatorial optimization problem and employ binary particle swarm optimization (BPSO) algorithm to solve it. In [33][34][35][36], continuous particle swarm optimization (PSO) is employed for WSN clustering, the position component of the particle is a real number in a certain interval, and the corresponding relationship between particle position and CHs is established by using a transforming formula. In contrast, COCA applies binary PSO for clustering in which the position component of the particle is either 0 or 1 in binary space. Furthermore, COCA directly determined that whether the node is a CH based on the value of the particle position component: if the value is 1, the node corresponding to the component is elected as a CH; contrastively, if the component value is 0, the corresponding node is selected as a member of a cluster.
e main contributions of this paper are as follows.
(1) Based on the objective and procedure, the clustering of WSN is abstracted into a combinatorial optimization problem (2) A novel binary particle coding scheme is designed to present the selection of CHs (3) After the CHs are elected, the constraints between parameters which affect clustering are considered comprehensively. en the fitness function is designed, and the clustering process is implemented by using BPSO As the main innovation and contribution, COCA establishes a direct correspondence relationship between the binary value of particle components and the role of whether nodes act as a CH. After determining how to use binary coding to represent whether a node is a CH, COCA can be implemented not only by using BPSO but also by applying other swarm intelligence algorithms discrete version. Because BPSO has the advantages of a few parameters, simple implementation, and fast convergence, we employ BPSO to solve the WSN clustering problem based on combinatorial optimization. e rest of this paper is organized as follows. In Section 2, related works are discussed. In Section 3, the concept of combinatorial optimization and BPSO is presented firstly; then the network and energy consumption model of WSN are introduced. Section 4 describes the proposed algorithm COCA in detail. In Section 5, the simulation results are shown to demonstrate the effectiveness of COCA. Finally, conclusions are drawn in Section 6.

Related Work
In order to elaborate the principle of COCA clearly, the classical LEACH and other representative WSN clustering algorithms proposed in recent years are summarized briefly as follows.
In LEACH [15], the lifespan of WSN is divided into a number of periods called rounds. Each round consists of two phases: cluster setup phase and stable phase. In the cluster setup phase, each node generates a random number r in the interval [0, 1] and compares r with a threshold T(n). e calculation of T(n) is shown in the following equation: where p represents the percentage of CHs in the network, r stands for the number of the current round, n denotes a sensor node, and G is the set of nodes that never acted as CH in the last p −1 rounds. If r is less than T(n), the node will take the role of CH. Otherwise, it will be a member node. After being elected, each CH broadcasts its own packet information to the network. When other nodes receive the broadcast information from CHs, they decide to join a cluster according to the received signal strength. Subsequently, the member node sends the request packet to the CH to which they belong. If the request is agreed by the CH, the time division multiple address (TDMA) slice is allocated to the member node to prevent communication conflicts between nodes in the same cluster. After the clustering is completed, the stable phase begins. In the stable phase, the member node sends the sensed data to its CH, and the CH aggregates the received data and transmits them to the BS. e core idea of LEACH is to select different nodes as CHs in a random way so that the energy consumption can be spread over different nodes as much as possible to prolong the network lifetime. However, LEACH uses a random algorithm to select CH without considering the residual energy of nodes. In the process of clustering, LEACH only takes the distance between member nodes and CH into account and does not consider the size of clusters and the distance between CHs and the BS. Consequently, some CHs will die early because of overload, which reduces the network's lifetime.
In [24], a node ranked-LEACH (NR-LEACH) for WSN was presented by Al-Baz and Sayed. In NR-LEACH, the clustering is divided into two stages: cluster setup and stable communication. Node rank (NR) algorithm is used to select the CHs in the setup stage. e NR algorithm calculates the rank of each node through a number of iterations based on the received signal strength, residual energy, and the number of connections with other nodes. After all, nodes calculated the rank, the node that has the highest rank is selected as the CH. NR-LEACH considers the influence of more than one factor on clustering when CHs are selected. However, when member nodes choose different clusters to join, NR-LEACH does not consider the influence of different attributes of member nodes on clustering.
In [25], Hosen and Cho proposed an energy centric cluster-based routing protocol for WSN (ECCR). ECCR divides the whole network into several static grids, and all nodes in each grid constitute a cluster. Each node calculates its rank according to the residual energy and the average distance to other nodes in the cluster. In the first round, each node broadcasts its rank value and residual energy information to other nodes in the same cluster. e node which has the largest rank value is elected as the CH. If the rank of some nodes is equal to the rank of other nodes, the node with the largest residual energy is selected as the CH. From the second round, the CH of the current round selects the node with the largest rank as the CH of the next round. In the clustering procedure, the residual energy of nodes and the average distance to other nodes are taken into account, which makes the lifetime of the selected CHs longer. However, the nodes number and membership of clusters remains unchanged throughout the whole lifetime of the network, which will lead to the premature death of some clusters and affect the overall performance of the network.
In [29], Hai et al. put forward a novel fuzzy clustering scheme for 3D WSN called FCM-3 WSN. In FCM-3 WSN, firstly, the authors established a mathematical model of clustering in 3D WSN which takes into account the network energy consumption, communication constraints, and the characteristics of the 3D network. en the Lagrange multiplier method is utilized to calculate the cluster centers and the membership matrix of the model which is used to cluster the network.
In [30], Shen et al. proposed a new energy efficient centroid-based routing protocol (EECRP) for WSN. In EECRP, the conception of "energy centroid" is introduced. At the beginning of clustering, all nodes send their location and energy information directly to the BS. e BS calculates the average energy and the maximum communication distance of the whole network. en, according to the given proportion, some nodes are randomly selected as CHs, and CHs' ID are sent back to the network. On the basis of information from the BS, all nodes know who is CH in the network. e remaining nodes join a cluster whose CH is the nearest to them. At the end of each round, the CH calculates the energy centroid of the cluster and selects the member node whose distance is the closest to the energy centroid and the remaining energy is above the average energy of the cluster as the CH of the next round. e EECRP utilizes the position changing of the energy centroid to balance the energy consumption of nodes in a cluster and prolongs the lifetime of the network. However, the nodes (including the CH and cluster members) of a cluster remain unchanged throughout the whole network lifetime. When the CH is rotated, some nodes will probably die prematurely, because the energy consumption of nodes in different clusters cannot be balanced while it is balanced in a single cluster.
In [31], Zhang et al. presented an improved LEACH algorithm for WSN to optimize the election of CH. In the initialization stage, the BS broadcasts the initialization message to the whole network. After receiving the initialization message, all nodes estimate the distance from themselves to the BS according to the received signal strength and then save the information of adjacent nodes in a table. In the setup phase, the nodes located in the communication radius of the BS communicate with the BS directly, while others are clustered for effective data transmission. When the CH is being elected, the formula which is used to calculate the threshold in the original LEACH is modified to make the residual energy of nodes, the average energy of networks, the distance between nodes, and the BS play an important role in the calculation of the threshold. In the stable phase of clustering, single-hop and multi-hop communication are both utilized to transmit data from CHs to the BS. If the distance between a CH and the BS exceeds the communication radius, the CH chooses another CH, which is closer to the BS, as the relay node. Although the improved LEACH considers the energy and distance of the node, it still relies on a completely random mechanism to select the CH. It is not guaranteed to select the most suitable node as the CH from more than one node that meets the qualification.
In [32], a new energy efficient multihop routing technique (MR) is put forward by Alnawafa and Marghescu. In MR, nodes are divided into three categories: CHs, member nodes, and independent nodes (IN). INs are the nodes that communicate directly with the BS without joining any cluster. e round of MR is composed of four phases: initial, announcement, tables preparation, and routing. In the initial phase, the clustering process is completed. In tables Mathematical Problems in Engineering preparation phase, member nodes calculate their level based on the distance to corresponding CHs, and the CHs judge their level according to their distance to the BS. Each cluster member that is located at the second level, CHs and INs which are located at the second or more level, establish their own routing table, respectively. In the routing phase, member nodes in the second level communicate with CH, and CHs communicate with the BS according to their routing table, respectively. In MR, an accurate routing mechanism is proposed which greatly reduces the energy consumption of sensed data transmission. However, MR algorithm does not consider the size of the cluster area and the distance from the CHs to the BS, and MR sets the number of members the same in different clusters, so that the energy consumption of different clusters is unbalanced and some nodes are prone to die prematurely.
In [33], Rao et al. proposed a PSO-based energy efficient cluster head selection algorithm for WSN (PSO-ECHS). In PSO-ECHS, the following parameters are taken into account: the distance from the nodes to the CH, the distance from the CHs to the sink and the influence of the residual energy on the clustering performance, and a linear combination of these parameters are used as the fitness function of particles. Furthermore, PSO-ECHS takes the coordinates of the candidate CH as the position vector of the particles. However, after updating the position of the particles, the position component cannot correspond to the coordinates of the nodes precisely. erefore, PSO-ECHS selects the node which is the nearest to the position component of a particle which has the global optimal value as the CH. is approximate approach cannot enable the final clustering scheme to the optimal.
In [34], Azharuddin and Jana presented a PSO-based approach for energy-efficient and energy-balanced routing and clustering in WSN. In the routing algorithm, the authors build a tradeoff between energy efficiency and energy balance. In the clustering algorithm, the energy consumption of CHs and cluster member nodes are both taken into account. When applying PSO to cluster the WSN, the coding scheme of particles is as follows: the dimension of particles is the same as the number of network nodes, and the position component of each dimension of particles is a random number r which obeys the uniform distribution in the interval (0, 1]. An integer k is obtained from r through a transformation formula, and k is taken as the ID of a CH to which the node corresponding to the particle position component belongs. In addition, a fitness function is designed to minimize the energy consumption of data transmission and balance the residual energy in the transmission path.
In [35], Kuila and Jana put forward energy efficient clustering and routing algorithms for wireless sensor networks: particle swarm optimization approach. In this approach, the particle encoding scheme for clustering is the same as that of [34], but the objective of the fitness function is to make the CH have the longest life and the cluster members have the shortest average distance to the CH.
In [36], Wang et al. suggested an improved routing scheme with special clustering using the PSO algorithm for heterogeneous WSN (EC-PSO). In the first stage of EC-PSO, CHs are elected according to geographical location. When the network is running for a period and the energy of nodes is not equal to each other, EC-PSO is applied to cluster the WSN again. EC-PSO employs PSO to find the energy center of the network, and the node near the energy center is selected as the CH. In addition, EC-PSO uses a protection mechanism to prevent low-energy nodes from becoming CHs. In EC-PSO, the encoding scheme of the particle is that the dimension of the particle is equal to the number of CHs, and the position component of particles is a 2-tuple which contains the coordinates of the energy center. During the iteration, the node that is the nearest to the energy center is elected as the CH. e particle position components in EC-PSO are also continuous real numbers.

Preliminaries and System Model
A lot of algorithms are proposed to solve combinatorial optimization problems [37], such as simulated annealing, tabu search, greedy randomized adaptive search procedure (GRASP), variable neighborhood search (VNS), and BPSO [39]. As BPSO has the characteristics of a few parameters, quick convergence, and easy to implement, we employ BPSO to cluster the WSN. In this section, a brief introduction to combinatorial optimization and BPSO is given firstly, and then the network model and energy consumption model of WSN are described.

Overview of Combinatorial Optimization.
Many problems in engineering can be transformed into optimization problems. e so-called optimization problem is to select the best one among a plurality of sets of variables to meet a particular need. Combinatorial optimization is a branch of optimization algorithms which is devoted to discovering the optimal grouping, order, or arrangement of discrete events with mathematical methods.

Overview of Binary Particle Swarm Optimization.
As BPSO is developed from continuous PSO; therefore a brief look at PSO and BPSO is taken, respectively, as follows. PSO [38] is a swarm intelligence algorithm that simulates the foraging behavior of birds. For PSO, a potential solution to an optimization problem is represented by a particle, and the number of particles is called population size. Each particle has a position vector In the D-dimensional space, the particles fly to the individual extreme points they have experienced and the global extreme points that the whole population has experienced, and the optimal solution of the optimization problem is obtained in this way.
When particles fly in a D-dimensional space, the d-th dimensional position and velocity vector of the i-th particle in the k-th iteration can be expressed by using the following equations, respectively: where w is the inertia factor which is utilized to keep the balance between the optimal personal and optimal global function value, c 1 and c 2 indicate learning factors which are applied to represent the summary of the experience of individual particle and whole population, r 1 and r 2 are two random numbers between 0 and 1, and PB and GB are the optimal personal and optimal global fitness function value, respectively. Continuous PSO is usually used to solve continuous optimization problems. However, some problems are finally abstracted as a combinatorial optimization one. Hence, Kennedy and Eberhart proposed BPSO in 1997. For BPSO, the continuous vector of particle position in continuous PSO is replaced by a discrete vector whose component is either 0 or 1 in binary space. For BPSO, the particle velocity vector updating formula is the same as that of the continuous PSO as shown in equation (3). However, the position vector is updated as follows: where S is calculated by using the following equation: In equation (5), the S function is the commonly used fuzzy function in neural networks which is called Sigmoid.
For BPSO, the probability that a particle is set to 0 or 1 is as follows:

Network Model.
We assume the network model of WSN used in this paper has the following properties.
(1) e nodes are randomly deployed in a square area of L * L. e initial energy of nodes is equal to each other, and the nodes cannot move after deployment (2) e BS is located at the center of one edge of the WSN area with infinite energy. e BS knows the location and initial energy of nodes. COCA runs on the BS (3) e BS can calculate the residual energy of the network node according to the number of the data packets sent by the node (4) e member nodes of a cluster can adjust their transmission power according to their distance to the CH (5) After a cluster is constructed, the CH uses TDMA to allocate time slots to member nodes for transmitting data (6) Single-hop communication is utilized

Energy Consumption Model.
To calculate the energy consumption of a single node as well as the whole network, we make use of the energy consumption model in [15]. e energy consumption of a node sending l bits is as follows: where l is the number of bytes sent by a node (CH or member), d denotes the distance of data transmission, E Elec indicates the energy consumed by the sensor circuit to process one-bit data, ε fs represents the energy consumption coefficient of the wireless channel in free space transmission model, ε mp stands for the energy consumption coefficient of the wireless channel in multipath attenuation transmission model, and d 0 is a threshold which is expressed as follows: e energy consumption of a node (CH or member) receiving l bits is expressed in the following equation: where E Elec is the energy consumed by the sensor circuit to process one-bit data.

Combinatorial Optimization-Based Clustering Algorithm
In this section, COCA is described in detail. Firstly, the mathematical model of clustering is established, and clustering is abstracted into a combinatorial optimization problem. en, the binary coding scheme of particles is presented and the fitness function is designed. Finally, the implementation procedure of COCA is described in detail.

Mathematical Model of Clustering.
e following issues need to be settled when a WSN is clustered: (1) selecting CHs from all nodes and (2) member nodes joining different clusters. e purpose of clustering WSN is to reduce the energy consumption of a single node and to balance the energy consumption of different nodes so as to prolong the lifetime of the whole network as much as possible. Here, we analyze the clustering problem from the perspective of combinatorial optimization.
Let there be N nodes in a WSN that are divided into K clusters.
ere are M i ( 1 ≤ i ≤ K) members in the i-th cluster. e number of CHs and the number of members in each cluster should satisfy the following constraints: According to equation (10), the total number of all possible clustering schemes is as follows: where C K N denotes K combinations of N elements, and M i (1 ≤ i ≤ K) is the number of members of the i-th cluster and should satisfy the constraint in equation (10).
Clustering WSN means that, under the constraint expressed by equation (10), one approximately optimal scheme S is selected from the NUM schemes expressed by equation (11). For the selected scheme S, the objective function expressed by the following equation should be minimized: In equation (12), the subobjective function f 1 represents the sum of the energy consumed by all member nodes in all clusters during the whole network lifetime, f 2 denotes the sum of the standard deviations of energy consumed by all members of all clusters, f 3 stands for the sum of the energy consumed by all CHs, f 4 is the sum of the standard deviations of the energy consumed by all CHs, and w 1 , w 2 , w 3 , w 4 are the weights of each subobjective function and they should satisfy the following constraints: At different stages of network operation, for different network topologies, the four weights could be dynamically changed based upon equation (13). In this paper, in order to quickly verify our approach, i.e., combinatorial optimization based clustering, the value of w 1 , w 2 , w 3 , w 4 in different situations are all taken as 0.25 for simplicity.
From the above analysis, it can be drawn that clustering WSN actually can be regarded as a combinatorial optimization problem.

Particle Coding.
If PSO is applied to pursue the best solution, the first step is to encode the particles. When COCA is utilized to cluster the WSN, the nodes in the network are either CHs or member nodes, and there is no other possibility. For BPSO, a particle represents a possible solution to the optimization problem. e component value of each dimension of the particle is either 0 or 1, and no third value exists. erefore, a correspondence between the particle component value of each dimension and the CH selection can be established. If the component of a dimension of the particle takes a value of 1, the node corresponding to the dimension is selected as a CH. Otherwise, if the value is 0, the corresponding node acts as a cluster member. e coding scheme of particles is as follows in detail.
Let there be a total of N nodes in the network which are divided into K clusters. e population size of particles is M. e dimension of each particle and the number of nodes in the network are both set to be N, and the position vector of node is treated as a member node. For example, for a WSN network with 10 nodes, if the position vector of a particle is (0, 0, 1, 0, 0, 0, 1, 0, 1, 0), it means that the third, seventh and ninth nodes are elected as CHs, and the remaining nodes are used as member nodes. For BPSO, the velocity vector of the V iN ), and the updating formula of the velocity vector of the particle is the same as that of continuous PSO presented in equation (3).

Fitness Function Design.
e second step of applying BPSO is to design a fitness function. e purpose of clustering is to reduce the node energy consumption and prolong the network lifetime. e goal of COCA is to (1) minimize and balance the energy consumption of nodes in a cluster and (2) minimize and balance the energy consumption of all CHs. To achieve the goal of clustering, we utilize the fitness function expressed in equation (12) in Section 4.1.
e definition of function f 1 in equation (12) is given as follows: where d iH−ij is the distance from the j-th member to the CH in the i-th cluster, M i indicates the number of member nodes in the i-th cluster, and K is the number of clusters. e meaning and value of ε fs and ε mp are the same as that in equation (7), and if d iH−ij is less than the threshold d 0 , the exponent a equals 2, otherwise 4. It can be seen from equations (7) and (14) that the value of f 1 is proportional to and can be used to describe the energy consumption of all member nodes in all clusters. e smaller the value of f 1 , the smaller the member nodes energy consumption.
e definition of function f 2 is as follows: where d iH−ij is the distance from the j-th member node to the CH in the i-th cluster, M i denotes the number of member nodes in the i-th cluster, and d i is the average distance from all member nodes to their CH in the i-th cluster and can be expressed as follows: 6 Mathematical Problems in Engineering where d j means the distance from the j-th member to the CH. e function f 2 represents the sum of mean square error (MSE) of the distance from all members to their CH. e smaller the value of f 2 , the closer the distance from the members to the CH, so that the energy consumption of member nodes is balanced. e definition of the function f 3 is as follows: where d BS−iH denotes the distance from the i-th CH to the BS, the values of ε fs and ε mp are the same as those in equations (7) and (14). It can be seen from equation (17) that the value of f 3 is proportional to the energy consumption of all CHs. e smaller is the value of f 3 , the less is the energy consumption of all CHs. e definition of the function f 4 is as follows: where K is the number of clusters, d BS−iH stands for the distance from the i-th CH to the BS, and d is expressed as follows: where d i is the distance from the i th CH to the BS. e value of the function f 4 is the sum of the MSE of the distance between all CHs and the BS. e smaller the value of f 4 is, the closer the distance between different CHs and the BS is, so that the remaining energy of CHs is basically balanced in the process of network operation. It can be seen from the definitions of f, f 1 , f 2 , f 3 , and f 4 that if f has the minimum value, it means that the CH and the member nodes in the network consume the least amount of energy, and the energy consumption is also balanced at the same time.

Procedure of COCA.
Similar to most clustering algorithms, COCA is also divided into two phases: setup phase and stable phase. e process of the COCA setup phase is expressed as Algorithm 1 and 2.
At the beginning of the clustering, the parameters of WSN and BPSO are initialized, respectively. e parameters of WSN include the size of the area where the network is located, the location of nodes and the BS, the initial energy of nodes, the proportion of CHs, etc. e parameters of BPSO include population size, individual learning factor, global learning factor, and inertia factor.
After parameters initialization, the velocity vector of each particle is initialized by using equation (3), and the position vector of each particle is initialized by using equations (4) and (5). According to the particle encoding scheme proposed in Section 4.2, the node corresponding to each particle position component with value 1 acts as the CH. After the CH is elected, the BS calculates the distance between each member node and all CHs, and makes the node join the cluster in which the nearest CH is located.
After the initial clustering, the individual optimal value of each particle is calculated with equations. (12)- (19), and the minimum individual optimal value of all particles is treated as the global optimal value of the whole population.
us, the initialization of the particle swarm is completed. During the iteration process, the velocity and position vectors of all particles are updated according to equations (3)- (6). e individual optimum value of each particle and the global optimum value of the whole population are calculated after the velocity and position update is completed.
When the number of iteration reaches the predetermined value, the CH selection scheme corresponding to the particle which has the global optimal value is selected as the final clustering scheme. After the completion of clustering, the ID of CHs, cluster members, and clusters is broadcasted to the whole network, so that each node knows its clustering information. After clustering, the CH assigns each member a TDMA slot and broadcasts it to the cluster.
It can be seen from the clustering process that COCA has an advantage over other clustering algorithms in terms of the selection of CH. On the basis of the binary particle coding scheme, COCA keeps iterating to obtain the optimal clustering scheme by taking advantage of BPSO evolutionary optimization.

Algorithm Performance Evaluation
In order to verify the performance of COCA, we simulated COCA using Matlab 2016a and compared the simulation results with three other clustering algorithms, i.e., LEACH, ECCR, and PSO-ECHS. e simulation results showed that COCA has better performance than other algorithms in terms of network lifetime, average residual energy of nodes, and network throughput. e reason for choosing LEACH as the comparison algorithm is that LEACH, as the first hierarchical clustering algorithm, has been widely used as a benchmark to evaluate the performance of other algorithms. e other two algorithms are chosen for comparison because ECCR and PSO-ECHS are the representatives of independent and cooperative algorithms, respectively.

Simulation Parameters and Evaluation Metrics.
In the simulation, the nodes are randomly distributed in a square area, and the nodes do not move after deployment. e BS is located in the center of the edge of the network area, and the percentage of CHs is 10%. A randomly generated network structure is shown in Figure 1. In the simulation, the total number of nodes in the network varies from 100 to 300, and the initial energy of each node is equal to each other. e specific network parameters are listed in Table 1, and the BPSO parameters are listed in Table 2. For Table 1, the parameters network size, BS coordinates, control packet size, data packet size, and data packet number per round are defined by us, 10% as the percentage of CHs is the best value obtained through many experiments, and other parameters on energy are the same as parameters in [15,24,25,[29][30][31][32][33][34][35][36]. For Table 2, the number of the parameters of particles and the number of iterations are defined by us, and other parameters are the optimal values obtained through many experiments.
In order to evaluate the performance of different clustering algorithms, the metrics are as follows: the number of live nodes in the network, the total residual energy of the network, and the number of packets received by the BS.      COCA, LEACH, ECCR, and PSO-ECHS. It can be seen from Figure 2 that with increasing the number of rounds, nodes begin to die in four algorithms (when the remaining energy of one node is 0, the node is considered dead). However, the first dead node in COCA appears later than the other three algorithms, and COCA has the most alive nodes when the number of rounds is equal. In four algorithms, LEACH has the earliest dead node. However, COCA has the latest dead node. In the same network environment, LEACH has the shortest lifetime and COCA has the longest lifespan. e lifetime of the other two algorithms is between the lifetime of COCA and LEACH. Figures 6-8 reveal the number of rounds when the first, half, and last node of the four clustering algorithms die in three scenarios. It can be seen from Figures 6-8 that the number of rounds of the first, half, and last nodes of COCA is later than that of the other three comparison algorithms, and the trend of node death of COCA is more gradual. e reason that COCA has a longer lifetime is that cluster members and CHs of COCA consume less energy than the other three algorithms during data transmission.

Residual Energy.
Nodes need to consume energy for sensing and transmitting data. e more is the residual energy of the whole network, the longer is the lifetime. erefore, clustering algorithms should minimize the energy consumption of the entire network. Figures 9-11 show the relationship between the total residual energy and the number of rounds of the four algorithms in three scenarios. From Figures 9-11, it can be seen that with the increase in the number of rounds, the total residual energy of the four algorithms is all decreasing. However, the residual energy of COCA is decreasing slower than the other three algorithms, and the trend of energy reduction of COCA is gentle than the compared algorithms. As can be seen from Figures 9-11, LEACH has the fastest energy consumption rate, COCA has the slowest rate, and the other two algorithms energy consumption rate is in the middle. e reason why COCA consumes the least energy is that when COCA selects the CHs and cluster members, it comprehensively considers the influence of several factors that restrict each other on the cluster formation.

Network roughput.
Two metrics are considered to evaluate network throughput; i.e., the number of packets received by the BS and the number of packets received by all CHs. Obviously, the more data packets received by the BS, the better the performance of the clustering algorithm. Figure 12 shows the total number of packets received by all CHs using four algorithms in three network scenarios. Figure 13 depicts the total number of packets received by the BS of the four algorithms in three network scenarios. Figure 14 displays the sum of data packets received by the BS and all CHs of four algorithms in three network scenarios. It can be seen from Figures 12-14 that in all scenarios COCA algorithm receives the most data packets in terms of whether the BS or CHs, which shows that COCA has the most network throughput.
From the above description, we can conclude that COCA has excellent performance than the other three algorithms in terms of network lifetime, residual energy, and throughput.

Conclusion
To save the nodes energy and prolong the network lifetime, a clustering algorithm based on combinatorial optimization for WSN, i.e., COCA, is proposed in this paper. From the point of view of combinatorial optimization, COCA abstracts the selection of CHs and the formation of clusters into a combinatorial optimization problem. Due to the large scale of feasible solutions of the combinatorial optimization problem, an approximation algorithm is generally adopted to solve such a problem. erefore the BPSO, which has a few parameters and is easy to implement, is utilized to cluster the WSN. In order to apply BPSO to cluster the WSN, a novel particle binary coding scheme for selecting CHs is proposed. For the coding scheme, the dimension of particles is equal to the number of nodes in the network. If the position component of particles in a certain dimension is 1, the node corresponding to this dimension is selected as CH. If the position component of particles in a dimension is 0, the node corresponding to this dimension is regarded as a cluster member. After the CH is elected, the fitness function is designed according to the principle that the energy consumption of the whole network is minimum and balanced. After a number of iterations, the WSN clustering is implemented by BPSO. Because the fitness function takes into account the influence of different factors on clustering    performance and the constraints between these factors, it ensures that the clustering result is optimal. Experiments showed that compared with existing clustering algorithms, COCA has the best performance in terms of network lifetime, residual energy of nodes, and the network throughput. COCA extended the lifetime of the network greatly and caused the death of the first node, half of the nodes, and all nodes to be significantly delayed. It can be seen from the experiments that COCA makes the BS receive more data from the member nodes.
However, COCA still has some shortcomings to overcome. COCA uses single-hop communication rather than multi-hop communication. When the network size is large, the distance between the node and the CH, as well as the distance from the CHs to the BS, is far. Compared with multi-hop communication, single-hop communication consumes more energy, which leads to the premature exhaustion of energy and the death of CHs. In addition, the four coefficients of fitness function need to be adjusted according to the changes of the network. erefore, in future research, we will try to change single-hop communication to multi-hop communication to reduce the energy consumption of data transmission. And we need to dynamically adjust the coefficients of fitness function according to the operation of the network to obtain a more accurate clustering result.

Data Availability
e data used to support the findings of this study are included within the article.

Conflicts of Interest
e authors declare that they have no conflicts of interest.