Low-delay high-efficiency WSN topology control method based on fusion clustering
Patent Information
- Application Number
- CN202510353627.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-25
- Publication Date
- 2025-07-01
Smart Images

Figure CN120238998A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of routing security of wireless sensor networks, and particularly relates to a low-latency and high-efficiency WSN topology control method based on fusion clustering. Background Art
[0002] Most of the research on WSN is based on energy consumption, and very little research has been done on latency. Since WSN is usually used in environments where batteries cannot be replaced, high efficiency is usually the primary goal of research. However, in environments such as fire detection or disaster warning, data must be transmitted as soon as possible within a limited time. However, in WSN, the end-to-end delay of single-hop routing is less than that of multi-hop routing, but the energy consumption of single-hop routing protocols is too high. Therefore, a trade-off is needed between minimum energy consumption and minimum latency.
[0003] Some scholars have applied the idea of heuristic algorithms to WSN. Heuristic algorithms are a class of problem-solving algorithms that improve the search efficiency through a kind of "heuristic" information to find solutions faster. The idea of reducing latency in this kind of algorithm is to set a suitable fitness function, which is constructed by combining factors such as inter-cluster distance, remaining energy of nodes, distance of nodes from the base station, and delay. A set of optimal cluster heads can be quickly obtained through iteration. Sirdeshpande et al. adopted the FLION clustering algorithm to construct the optimal routing. The fitness function of the FLION algorithm considers factors such as remaining energy of cluster heads, node density, and delay. The FLION algorithm combines fractional-order derivatives to detect neighborhood solutions and quickly obtains a set of optimal cluster heads, but this protocol does not consider node degree during the clustering process. Lalwani et al. adopted the harmony search algorithm (HSA) to cluster nodes and construct routing. The construction of the fitness function of HAS aims to reduce the end-to-end delay by selecting nodes with the smallest distance for data transmission. However, this protocol performs poorly in large-scale networks.
[0004] In terms of reducing latency, T. Moscibroda et al. proposed a solution model for the trade-off between energy consumption and delay during the deployment of WSN. The adaptive energy-constrained routing DEAR protocol they proposed is a multi-path routing protocol that considers many parameters such as reliability, delay, and energy consumption. This protocol allows data packets to be continuously distributed on the network, and it balances the delay between different paths by providing a polynomial-time algorithm for solving multi-objective optimization problems. However, this algorithm is too complex and has a poor balance between energy consumption and latency. This algorithm aims to reduce the retransmission latency through the idea of alternative paths. In addition to the above ways of reducing latency, another part of scholars proposed heuristic solutions for balancing energy consumption, but their convergence time is long. Another part of scholars proposed solutions for constraining delay to ensure minimum latency.
[0005] In summary, the design of secure and efficient topology control methods has become a research hotspot in wireless sensor networks in recent decades. How to balance the minimum energy consumption and the minimum delay has become an urgent problem to be solved in this field. Summary of the Invention
[0006] To solve the technical problems mentioned in the above background art, the present invention proposes a low-delay and high-efficiency WSN topology control method based on fusion clustering.
[0007] To achieve the above technical objectives, the technical solution of the present invention is as follows:
[0008] A low-delay and high-efficiency WSN topology control method based on fusion clustering, comprising the following steps:
[0009] (1) Apply the butterfly optimization algorithm in the WSN, and select the best cluster head node C1 in the network by using node degree, node centrality, distance to neighboring nodes, distance to the base station, and remaining energy of the node;
[0010] (2) The clustering algorithm adopts the SP-DPC algorithm, and a set of cluster head sets C2 can also be obtained;
[0011] (3) Arrange these two alternative cluster head sets in descending order according to the decision value formula, and select M nodes from high to low as the final cluster head nodes;
[0012] (4) For non-cluster head nodes in each cluster, we use the potential function for allocation, and non-cluster head nodes are assigned to the CH with a shorter transmission distance and higher remaining energy.
[0013] Further, in step (1), the steps of using the butterfly optimization algorithm to obtain the best cluster head node C1 in the network are as follows:
[0014] (101) Deduce the fitness function F(x), and the detailed process and calculation formula are as follows:
[0015] Remaining energy: In the WSN, the cluster head performs various tasks, collects data from non-cluster head nodes and transmits the data to the BS. The cluster head needs higher energy to complete the above tasks. Therefore, higher remaining energy is the first factor to be considered. The remaining energy is described by the following formula (1-1):
[0016]
[0017] Among them, E i represents the energy of cluster head node i, and M is the total number of cluster head nodes.
[0018] Distance from node to base station: Defines the distance from the cluster head node to the base station. The delay of a node depends on the distance of the transmission path. For example, if the BS is far from the CH, it takes more time to transmit data. To reduce the end-to-end delay, when transmitting data, the cluster head node closer to the BS is preferentially selected. The objective function of the distance between the cluster head and the BS is described by the following formula (1-2):
[0019]
[0020] where d is the distance from the cluster head node to the base station.
[0021] Distance between sensor nodes: Defines the distance between a sensor node and the cluster head in the cluster where it is located. The delay and energy consumption of a node mainly depend on the distance of the transmission path. When the transmission distance from the selected node to the base station is short, the delay of the node is small and the energy consumption is small. The objective function is as shown in (1-3):
[0022]
[0023] where dis(j,i) is the distance between each sensor node j and its cluster head i, and I i is the number of cluster members where each sensor node is located, and the rest is the same as above.
[0024] Node centrality: Defines the degree of centrality of a node from its neighbor nodes:
[0025]
[0026] where n is the number of nodes in the cluster where the cluster head node i is located, and i = N is the number of sensor nodes in the entire network.
[0027] Node degree: The node degree defines the number of sensor nodes belonging to the cluster where it is located. Select a CH with a smaller node degree because a CH with a higher number of cluster members will lose a large amount of energy in a short time. The node degree formula is as shown in (1-5):
[0028]
[0029] where I i is the number of members in the cluster where the butterfly i is located.
[0030] After defining five objective functions respectively, weights are assigned to each objective function to convert multiple objective functions into a single objective function. Since f2, f3, and f5 are all objective factors that need to be minimized, two objective functions need to be constructed during integration.
[0031] f(x) = α1f1 + α2f4 #(1-6)
[0032] g(x) = β1f2 + β2f3 + β3f5 #(1-7)
[0033] Since the energy consumption of each node is much smaller than the distance, the first objective function is amplified by a certain multiple. The integrated fitness function is as follows:
[0034] F(x) = ωf(x) - g(x) #(1-8)
[0035] Where ω is the amplification multiple, α1 + α2 = 1, β1 + β2 + β3 = 1, which represent the weight values respectively.
[0036] (102) Initialize the butterfly population, and the specific steps are as follows:
[0037] In the cluster head selection stage of BOA, a butterfly is represented as a set of cluster head nodes selected from all sensor nodes in the network. The dimension of each butterfly is equivalent to the number of CHs in the network. The position of each butterfly is initialized with a random number ID between 1 and n, where n is the total number of all nodes in the network. B i =(B i,1 (t), B i,2 (t), …, B i,m (t)) is the i-th butterfly, where the position of each butterfly is B i,a , 1 ≤ a ≤ m represents the ID of the nodes between 1 and n in the network, and m is the number of cluster head nodes in the network. Assume that the network has 100 sensor nodes, and the CHs will account for 5% of the total number of nodes. The dimension of each butterfly in BOA, that is, the number of cluster head nodes, is 5, and the position of each butterfly is initialized with a random number between 1 and 100 (i.e., the total number of sensor nodes). The position of each butterfly is mapped one-to-one with the coordinates of the sensor nodes.
[0038] (103) Initialize the stimulation intensity I through the fitness function F(x), and initialize the switching probability p, the sensory modality c, and the power exponent a;
[0039] (104) For each butterfly in the butterfly population, calculate the fragrance of the butterfly using formula (1-11) to detect the best butterfly population. For each butterfly in the population, create a random number r between 0 and 1. If r < p, the butterfly will move towards the best population using formula (1-9), otherwise, it will move randomly according to formula (1-10). After each round of iteration, update the power exponent a. The specific process is as follows:
[0040] In BOA, there are two modes for updating the position of butterflies, namely updating in the global search stage or the local search stage. In which stage to update depends on a randomly generated random number between 0 and 1. The global and local search stages of BOA are specified in formulas (1-9) and (1-10) respectively. Among them, the new butterflies are randomly generated according to the node IDs of all nodes in the network. The fragrance emitted by the remaining butterflies changes the position of the butterflies, and the butterflies will move closer to the butterflies with a higher fragrance index, and the position is updated according to the fragrance of the butterflies. When the butterflies cannot find any fragrance in the surrounding environment, the local search is initialized in BOA.
[0041] Butterflies move according to the best butterfly or the optimal solution in the global search stage:
[0042]
[0043] Among them, represents the solution of the i-th butterfly at the t-th iteration, r is a random number generated in the interval from 0 to 1, and g * is the optimal solution found among all the solutions that have been iterated so far, and f i is the fragrance of the i-th butterfly.
[0044] Among them, when butterfly j and k are the same butterfly, the butterfly performs a local random walk according to the following formula (1-10):
[0045]
[0046] Formula (1-11) is the fragrance calculation formula of the butterfly:
[0047] f = cI a #(1-11)
[0048] Among them, f represents the fragrance of the butterfly, c is the sensory modality of the butterfly, a is the power exponent, and I is the sensory stimulus intensity.
[0049] (105) Repeat (104) until the maximum number of iterations is reached, and output the optimal solution, that is, a set of cluster head nodes C1 in the wireless sensor network.
[0050] Furthermore, in step (2), the specific steps for obtaining a set of cluster head sets C2 by using the SP-DPC algorithm are as follows:
[0051] (201) Normalize the entire data set and calculate the distance matrix;
[0052] (202) Calculate the set of shared proximity matrices Snd. For any two sensor nodes x i , x j , the calculation method of their shared proximity is as follows:
[0053]
[0054] where |SNN(x i , x j )| is the number of shared neighbors between nodes x i , x j , and d ij represents the distance from node x i to x j . represents the sum of the distances from the sensor node x j and its K nearest neighbors to x i . The introduction of shared proximity makes clustering more accurate.
[0055] (203) Calculate the local density of each sensor node and the relative distance The calculation method is as follows:
[0056]
[0057] where X is the set of all sensor nodes. is the sum of the shared proximities between the sensor node x i and all sensor nodes (including itself).
[0058]
[0059] δ i refers to the relative distance between node x i and each of the other nodes, which is defined as the relative energy distance in WSN.
[0060] (204) Calculate the evaluation value of each sensor node Sort the comprehensive evaluation values in descending order. Select the top M largest values of the clustering number as the density peak set S, and the calculation formula is as follows:
[0061]
[0062] where E resi is the remaining energy of the sensor node x i , d itosink is the distance from x i to the base station. The higher d itosink , the lower the value of the decision value.
[0063] (205) Through the way of transfer probability allocation, conduct the first round of allocation of the backbone of the clusters to form the initial clustering result C;
[0064] (206) Calculate each node outside the set C, and add it to the cluster where the peak node with the largest relative proximity to it in the density peak set S is located.
[0065] Furthermore, in step (3), the formula for obtaining the decision value is as follows:
[0066]
[0067] where μ and v are weight coefficients, and E res is the remaining energy of the sensor, is the average of the remaining energies of the sensors within the cluster. is the average distance from the node to the base station, and d toBS is the distance from the node to the base station.
[0068] Furthermore, in step (4), the formula for obtaining the potential function is as follows:
[0069]
[0070] where the potential of the sensor node is S, the proportionality coefficient is θ, dis(i, j) specifies the distance between the cluster head and the sensor, and E i represents the remaining energy of each CH. Nodes are assigned to clusters with higher potential. The proportionality coefficient is used to balance the problem of a large numerical difference between energy and distance, making the influence factors of the two factors similar. If the distances from two cluster heads to the unassigned node are the same, the node will be assigned to the cluster with higher energy.
[0071] Beneficial effects brought by adopting the above technical solutions:
[0072] (1) The present invention combines the density peak algorithm with the heuristic algorithm, comprehensively considers the optimal cluster head globally, and combines the advantages of the density peak - type algorithm performing well in large - scale networks and the meta - heuristic algorithm quickly iterating from a global perspective. The improved hybrid clustering algorithm selects the cluster head by comprehensively considering multiple factors such as energy consumption, distance, and centrality from a global perspective, thereby reducing the network energy consumption and extending the network lifetime.
[0073] (2) In terms of routing selection, the present invention constructs a path weight cost function with lower cost, then proposes the idea of constraining delay, and finds the path with the lowest cost and meeting the delay conditions through the K - shortest path algorithm. Otherwise, it uses single - hop routing to the base station to ensure maximizing the reduction of delay. Brief Description of the Drawings
[0074] Figure 1 is the flowchart of the method of the present invention;
[0075] Figure 2 is the connection effect diagram of transfer probability assignment of the present invention; Detailed implementation manners
[0076] The technical solution of the present invention will be described in detail below with reference to the accompanying drawings.
[0077] As Figure 1 shown, a low-latency and high-efficiency WSN topology control method based on fusion clustering includes the following steps:
[0078] (1) Apply the butterfly optimization algorithm to the WSN, and select the best cluster head node C1 in the network by using node degree, node centrality, distance to neighboring nodes, distance to the base station, and remaining energy of the node;
[0079] (2) The clustering algorithm adopts the SP-DPC algorithm, and a set of cluster head sets C2 can also be obtained;
[0080] (3) Arrange these two alternative cluster head sets in descending order according to the decision value formula, and select M nodes from high to low as the final cluster head nodes;
[0081] (4) For non-cluster head nodes in each cluster, we use the potential function for allocation, and non-cluster head nodes are allocated to the CH with a shorter transmission distance and higher remaining energy;
[0082] In this embodiment, the following preferred solutions can be adopted to implement the above (1):
[0083] (101) Deduce the fitness function F(x), and the detailed process and calculation formula are as follows:
[0084] Remaining energy: In the WSN, the cluster head performs multiple tasks, collects data from non-cluster head nodes and transmits the data to the BS. The cluster head requires higher energy to complete the above tasks. Therefore, higher remaining energy is the first factor to be considered. The remaining energy is described by the following formula (1-1):
[0085]
[0086] where E i represents the energy of cluster head node i, and M is the total number of cluster head nodes.
[0087] Distance from the node to the base station: Defines the distance from the cluster head node to the base station. The delay of the node depends on the distance of the transmission path. For example, if the BS is far from the CH, it takes more time to transmit data. To reduce the end-to-end delay, when transmitting data, the cluster head node closer to the BS is preferentially selected. The objective function of the distance between the cluster head and the BS is described by the following formula (1-2):
[0088]
[0089] where d is the distance from the cluster head node to the base station.
[0090] Distance between sensor nodes: It defines the distance between a sensor node and the cluster head in the cluster where the sensor node is located. The delay and energy consumption of a node mainly depend on the distance of the transmission path. When the transmission distance from the selected node to the base station is short, the delay of the node is small and the energy consumption is small. The objective function is as shown in (1-3):
[0091]
[0092] where dis(j,i) is the distance between each sensor node j and its cluster head i, and I i is the number of cluster members where each sensor node is located, and the rest is the same as above.
[0093] Node centrality: It defines the central degree of a node from its neighbor nodes:
[0094]
[0095] where n is the number of nodes in the cluster where the cluster head node i is located, and i = N is the number of sensor nodes in the entire network.
[0096] Node degree: Node degree defines the number of sensor nodes belonging to the cluster where the node is located. Select a CH with a smaller node degree because a CH with a higher number of cluster members will lose a large amount of energy in a short time. The node degree formula is as shown in (1-5):
[0097]
[0098] where I i is the number of members in the cluster where the butterfly i is located.
[0099] After defining five objective functions respectively, weights are assigned to each objective function to convert multiple objective functions into a single objective function. Since f2, f3, and f5 are all objective factors that need to be minimized, two objective functions need to be constructed during integration.
[0100] f(x) = α1f1 + α2f4 #(1-6)
[0101] g(x) = β1f2 + β2f3 + β3f5 #(1-7)
[0102] Since the energy consumption of each node is much smaller than the distance, the first objective function is amplified by a certain multiple. The integrated fitness function is as follows:
[0103] F(x) = ωf(x) - g(x) #(1-8)
[0104] where ω is the amplified multiple, α1 + α2 = 1, and β1 + β2 + β3 = 1, which represent the weight values respectively.
[0105] (102) Initialize the butterfly population, and the specific steps are as follows:
[0106] In the cluster head selection stage of BOA, a butterfly is represented as a set of cluster head nodes selected from all sensor nodes in the network. The dimension of each butterfly is equivalent to the number of CHs in the network. The position of each butterfly is initialized with a random number ID between 1 and n, where n is the total number of all nodes in the network. B i =(B i,1 (t), B i,2 (t), …, B i,m (t)) is the i-th butterfly, where the position of each butterfly is B i,a , 1 ≤ a ≤ m represents the ID of the nodes between 1 and n in the network, and m is the number of cluster head nodes in the network. Assume that the network has 100 sensor nodes, and the CHs will account for 5% of the total number of nodes. The dimension of each butterfly in BOA, that is, the number of cluster head nodes, is 5, and the position of each butterfly is initialized with a random number between 1 and 100 (i.e., the total number of sensor nodes). The position of each butterfly is mapped one-to-one with the coordinates of the sensor nodes.
[0107] (103) Initialize the stimulation intensity I through the fitness function F(x), and initialize the switching probability p, the sensory modality c, and the power exponent a;
[0108] (104) For each butterfly in the butterfly population, calculate the fragrance of the butterfly using formula (1-11) to detect the best butterfly population. For each butterfly in the population, create a random number r between 0 and 1. If r < p, the butterfly will move towards the best population using formula (1-9), otherwise, it will move randomly according to formula (1-10). After each round of iteration, update the power exponent a. The specific process is as follows:
[0109] In BOA, there are two modes for updating the butterfly position, which are updated in the global search stage or the local search stage respectively. In which stage to update depends on a generated random number between 0 and 1. The global and local search stages of BOA are specified in formulas (1-9) and (1-10) respectively. Among them, the new butterfly is randomly generated according to the node IDs of all nodes in the network, and the fragrance emitted by the remaining butterflies changes the position of the butterfly. The butterfly will move closer to the butterfly with a higher fragrance index, and the position is updated according to the fragrance of the butterfly. When the butterfly cannot find any fragrance in the surrounding environment, local search is initialized in BOA.
[0110] The butterfly moves according to the best butterfly or the optimal solution in the global search stage:
[0111]
[0112] Among them, represents the solution of the i-th butterfly at the t-th iteration, r is a random number generated in the interval from 0 to 1, and g * is the optimal solution found among all the solutions that have been iterated so far, and f i is the fragrance of the i-th butterfly.
[0113] Among them, when butterflies j and k are the same butterfly, the butterfly performs local random walk according to the following formula (1-10):
[0114]
[0115] Formula (1-11) is the fragrance calculation formula of the butterfly:
[0116] f = cI a #(1-11)
[0117] Among them, f represents the fragrance of the butterfly, c is the sensory modality of the butterfly, a is the power exponent, and I is the sensory stimulus intensity.
[0118] (105) Repeat (104) until the maximum number of iterations is reached, and output the optimal solution, that is, a set of cluster head nodes C1 in the wireless sensor network.
[0119] In this embodiment, the following preferred scheme can be adopted to implement the above (2):
[0120] (201) Normalize the entire data set and calculate the distance matrix;
[0121] (202) Calculate the set of shared proximity matrices Snd. For any two sensor nodes x i , x j , the calculation method of their shared proximity is as follows:
[0122]
[0123] Among them, |SNN(x i , x j )| is the number of shared neighbors between nodes x i , x j , d ij represents the distance between nodes x i to x j , represents the sum of the distances from the sensor node x j and its K nearest neighbors to x i . The introduction of shared proximity makes clustering more accurate..
[0124] (203) Calculate the local density and relative distance The calculation method is as follows:
[0125]
[0126] Where X is the set of all sensor nodes. is the sensor node x i and the sum of the shared proximities with all sensor nodes (including itself).
[0127]
[0128] δ i refers to the relative distance between node x i and each of the other nodes, which is defined as the relative energy distance in WSN.
[0129] (204) Calculate the evaluation value of each sensor node Sort the comprehensive evaluation values in descending order. Select the top M largest values of the cluster numbers as the density peak set S, and the calculation formula is as follows:
[0130]
[0131] Where E resi is the remaining energy of the sensor node x i and d itosink is the distance from x i to the base station. The higher d itosink , the lower the value of the decision value.
[0132] (205) Through the method of transfer probability assignment, perform the first round of assignment on the backbone of the clusters to form the initial clustering result C, as Figure 1 shown, and the specific calculation process is as follows:
[0133] Input: Peak density node cluster center set S, proximity number k, shared proximity matrix Snd;
[0134] Output: Core node set and unassigned node set R that have completed transfer probability assignment;
[0135] Step 1: Initialize an empty queue Q, and add the nodes in the peak density node set S to the queue;
[0136] Step 2: Take out and delete the first element first from the queue;
[0137] Step 3: Traverse each neighbor node near in the K-nearest neighbor set KNN(first) of the first element. If near has no cluster label and first meets the conditions for transfer probability assignment to the near node, then assign the near node to the cluster where the first node is located and add near to the queue Q. If not, traverse the next neighbor node;
[0138] Step 4: When the queue Q is empty, end and output the result. Otherwise, jump to Step 2.
[0139] (206) Calculate for each node outside the set C and add it to the cluster of the peak node with the highest relative proximity to it in the density peak set S.
Claims
1. A low-latency and high-performance WSN topology control method based on fusion clustering, characterized in that: The following steps are involved: (1) The butterfly optimization algorithm is applied in WSN. The best cluster head node in the network is selected by using node degree, node centrality, distance to neighboring nodes, distance to base station and node residual energy. The specific steps are as follows: (101) The fitness function F(x) is derived. The detailed process and calculation formula are as follows: Residual energy: In WSN, cluster heads perform multiple tasks, collect data from non-cluster head nodes and transmit data to BS. Cluster heads require higher energy to complete the above tasks. Therefore, higher residual energy is the first factor to be considered. The residual energy is described by the following formula (1-1): Among them, E i represents the energy of cluster head node i, M is the total number of cluster head nodes; Distance from node to base station: defines the distance from the cluster head node to the base station. The node delay depends on the distance of the transmission path. If the BS is far away from the CH, it takes more time to transmit data. In order to reduce end-to-end delay, during data transmission, the cluster head node closer to the BS is preferred. The objective function of the distance between the cluster head and the BS is described by the following formula (1-2): Where, d is the distance from the cluster head node to the base station; Distance between sensor nodes: defines the distance between the sensor node and the cluster head in the cluster. The node delay and energy consumption mainly depend on the distance of the transmission path. When the transmission distance from the selected node to the base station is shorter, the node delay is smaller and the energy consumption is smaller. The objective function is shown in (1-3): Where dis(j,i) is the distance between each sensor node j and its cluster head i, I i is the number of cluster members that each sensor node belongs to, and the rest are the same as above; Node centrality: defines how central a node is to its neighboring nodes: Where n is the number of nodes in the cluster where the cluster head node i is located, and i = N is the number of sensor nodes in the entire network; Node degree: Node degree defines the number of sensor nodes belonging to the cluster. CH with less node degree is selected because CH with higher cluster membership will lose a lot of energy in a short time. The node degree formula is shown in (1-5): Among them, I i is the number of members in the cluster where butterfly i is located; After defining the five objective functions separately, assign weights to each objective function and convert multiple objective functions into a single objective function. Since f2, f3, and f5 are all objective factors that need to be minimized, two objective functions need to be constructed during integration: f(x)=α1f1+α2f4#(1-6) g(x)=β1f2+β2f3+β3f5#(1-7) Since the energy consumption of each node is much smaller than the distance, the first objective function is magnified by a certain multiple, and the integrated fitness function is as follows: F(x)=ωf(x)-g(x)#(1-8) Among them, ω is the magnification factor, α1+α2=1, β1+β2+β3=1, respectively represent the weight values; (102) Initialize the butterfly population. The specific steps are as follows: In the cluster head selection phase of BOA, butterflies are represented as a group of cluster head nodes selected from all sensor nodes in the network. The dimension of each butterfly is equivalent to the number of CHs in the network. The position of each butterfly is initialized with a random number ID between 1 and n, where n is the total number of all nodes in the network. i =(B i,1 (t),B i,2 (t),…,B i,m (t)) is the i-th butterfly, where each butterfly is located in B i,a , 1≤a≤m represents the ID of the node between 1 and n in the network, and m is the number of cluster head nodes in the network; assuming that the network has 100 sensor nodes, CH will account for 5% of the total number of nodes, and the dimension of each butterfly of BOA, i.e., the number of cluster head nodes, is 5. The position of each butterfly is initialized between a random number between 1 and 100 (i.e., the total number of sensor nodes), and the position of each butterfly is mapped one by one to the coordinates of the sensor node; (103) Initialize the stimulus intensity I through the fitness function F(x), and initialize the switching probability p, sensory modality c, and power exponent a; (104) For each butterfly in the butterfly population, use formula (1-11) to calculate the fragrance of the butterfly, detect the optimal butterfly population. For each butterfly in the population, create a random number r between 0 and 1. If r < p, the butterfly will move towards the optimal population using formula (1-9), otherwise, it will move randomly according to formula (1-10). After each iteration, update the power exponent a. The specific process is as follows: In BOA, there are two modes for updating the butterfly position, namely, updating in the global search stage or the local search stage. In which stage to update depends on a randomly generated 0-1 random number. The global and local search stages of BOA are specified in formulas (1-9) and (1-10) respectively. Among them, the new butterfly is randomly generated according to the node ID of all nodes in the network. The fragrance emitted by the remaining butterflies changes the position of the butterfly, and the butterfly will move closer to the butterfly with a higher fragrance index. The position is updated according to the fragrance of the butterfly. When the butterfly cannot find any fragrance from the surrounding environment, the local search is initialized in BOA; The butterfly moves according to the best butterfly or the optimal solution in the global search stage: in, represents the solution of the ith butterfly at the tth iteration, r is a random number generated in the interval from 0 to 1, and g * is the optimal solution found among all the solutions that have been iterated so far, f i is the scent of the i-th butterfly; Among them, when butterfly j and k are the same butterfly, the butterfly performs local random walk according to the following formula (1-10): Formula (1-11) is the fragrance calculation formula of the butterfly: f=cI a #(1-11) Among them, f represents the fragrance of the butterfly, c is the sensory modality of the butterfly, a is the power exponent, and I is the sensory stimulus intensity; (105) Repeat step (104) until the maximum number of iterations is reached, and output the optimal solution, that is, a set of cluster head nodes C1 in the wireless sensor network; (2) The clustering algorithm adopts the SP-DPC algorithm, and a set of cluster head sets C2 can also be obtained. The specific steps to obtain a set of cluster head sets C2 are as follows: (201) Normalize the entire data set and calculate the distance matrix; (202) Calculate the shared proximity matrix Snd set, for any two sensor nodes x i , x j , the shared proximity between them is calculated as follows: Where |SNN(x i ,x j )| is node x i , x j The number of shared neighbors between ij Represents node x i to x j The distance Represents sensor node x j and its K nearest neighbors to x i The sum of the distances; (203) Calculate the local density of each sensor node and relative distance The calculation is as follows: Among them, X is the set of all sensor nodes, is the sensor node x i The sum of shared proximity with all sensor nodes (including itself); δ i refers to node x i The relative distance to other nodes is defined as the relative energy distance in WSN; (204) Calculate the evaluation value of each sensor node Sort the comprehensive evaluation values in descending order, and select the top M values of the clustering number as the density peak set S. The calculation formula is as follows: Where E resi For sensor node x i The remaining energy, d itosink For x i Distance to the base station, d itosink The higher it is, the lower the numerical value of the decision value; (205) Through the method of transfer probability assignment, perform the first round of assignment on the backbone of the cluster to form the initial clustering result C; (206) Calculate each node outside the set C and add it to the cluster where the peak node with the largest relative proximity to it in the density peak set S is located; (3) Arrange these two alternative cluster head sets in descending order according to the decision value formula (3-1), and select M nodes from high to low as the final cluster head nodes. The calculation formula is as follows: Among them, μ,v is the weight coefficient, E res is the remaining energy of the sensor, is the mean residual energy of the sensors in the cluster. is the mean distance from the node to the base station, d toBS is the distance from the node to the base station (4) For each non-cluster head node in each cluster, we use the potential function formula (4-1) for assignment. The non-cluster head node is assigned to the CH with a shorter transmission distance and higher remaining energy. The calculation formula is as follows: Among them, the sensor node potential is S, the proportional coefficient is θ, dis(i,j) specifies the distance between the cluster head and the sensor, and E i Represents the remaining energy of each CH.