Positioning method of wireless sensor
By constructing a weight matrix and probability distribution matrix in a wireless sensor network and combining it with the locust optimization algorithm, the position estimation of the target node is optimized, which solves the problem of positioning inaccuracy caused by wireless signal parameters and achieves higher positioning accuracy.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- CHINA TELECOM CORP LTD
- Filing Date
- 2025-12-30
- Publication Date
- 2026-05-12
AI Technical Summary
Node localization methods in wireless sensor networks rely on wireless signal parameters, resulting in low localization accuracy.
By constructing a weight matrix and a probability distribution matrix, and combining them with the locust optimization algorithm, the position estimation of the target node is optimized through multiple iterations and evolutions using the measured distance between the target node and the anchor node.
It improves the positioning accuracy of nodes in wireless sensor networks and solves the problem of inaccurate positioning caused by wireless signal parameters.
Smart Images

Figure CN122028170A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of signal processing technology, and more specifically, to a method for locating a wireless sensor. Background Technology
[0002] In wireless sensor networks, node localization is a prerequisite for many applications. Localization technology typically relies on wireless signal parameters such as received signal strength indication, time of arrival, and time difference. However, wireless signals are affected by various factors during propagation, including multipath effects, obstacle obstruction, antenna directivity, and environmental noise, which can lead to low localization accuracy.
[0003] There is currently no effective solution to the above problems. Summary of the Invention
[0004] This application provides a wireless sensor localization method to at least solve the technical problem of low localization accuracy caused by the reliance of node localization methods in related wireless sensor networks on wireless signal parameters.
[0005] According to one aspect of this application, a method for locating a wireless sensor is provided, comprising: determining a weight matrix based on the measured distance between a target node and an anchor node in a wireless sensor network, wherein the anchor node represents a wireless sensor with known coordinates, the target node represents a wireless sensor to be located that has a communication connection with the anchor node, and the rows of the weight matrix represent weight coefficients between the same target node and different anchor nodes, wherein the weight coefficients are negatively correlated with the measured distance; determining a probability distribution matrix based on the ratio of the element values in the weight matrix to the target summation result, wherein the target summation result is the summation result of all element values in the row containing the element value, and the rows of the probability distribution matrix represent the probability that different anchor nodes are selected by the same target node; repeating the process for each individual in the population in the locust optimization algorithm. The following process is executed multiple times to obtain an initial population: For each target node in the probability distribution matrix, three anchor nodes are selected in the probability distribution matrix by roulette wheel selection, and triangulation is performed based on the real coordinates of the three anchor nodes to obtain the initial coordinates of each target node. Each individual includes the initial coordinates of all target nodes. For each target node, the optimal coordinate with the smallest error value is determined from the initial coordinates of all individuals to obtain the optimal coordinates of all target nodes. Based on the optimal coordinates of all target nodes, the optimal individual is generated. The optimal individual replaces any individual in the initial population to obtain a new population. The new population is iterated, evolved, and updated. When the preset termination condition is met, the predicted coordinates of the target nodes are output, and the position of the target nodes in the wireless sensor network is determined based on the predicted coordinates.
[0006] Optionally, the weight matrix is determined based on the measured distance between the target node and the anchor node, including: determining a distance matrix based on the measured distance between the target node and the anchor node, wherein the rows of the distance matrix represent the measured distance between the same target node and different anchor nodes; determining the minimum value in each row of the distance matrix; determining the target element value of each element in the i-th row based on the ratio of the minimum value in the i-th row to the value of each element in the i-th row, thereby obtaining the target element value of each element in N rows, where i is a positive integer not greater than N, N is the number of target nodes, and N is a positive integer greater than 1; and determining the weight matrix based on the target element value of each element in N rows.
[0007] Optionally, three anchor nodes are selected in the probability distribution matrix by roulette wheel selection, and three-point positioning is performed based on the real coordinates of the three anchor nodes to obtain the initial coordinates of each target node. This includes: selecting the element in the i-th row of the probability distribution matrix, where i is a positive integer not greater than N, N is the number of target nodes, and N is a positive integer greater than 1; selecting three anchor nodes in the i-th row by roulette wheel selection; obtaining the real coordinates of the three anchor nodes; and processing the real coordinates of the three anchor nodes using a three-point positioning algorithm to obtain the initial coordinates of the i-th target node.
[0008] Optionally, in the i-th row of elements, three anchor nodes are selected by roulette wheel selection, including: determining the fitness function and calculating the fitness value of each anchor node in the i-th row of elements based on the fitness function; normalizing the fitness value to obtain the selection probability value of each anchor node; constructing a continuous probability interval based on the selection probability value of each anchor node, and assigning a corresponding sub-interval to each anchor node in the continuous probability interval; generating three random numbers, wherein each random number falls into the target position within the continuous probability interval; and determining the anchor nodes associated with the sub-intervals corresponding to the target positions into which the three random numbers fall as the three anchor nodes.
[0009] Optionally, determining the fitness function includes: determining the fitness function based on the mean square error of the first distance and the second distance, wherein the first distance is the measured distance between the target node and the anchor node, and the second distance is the distance between the estimated coordinates of the target node and the true coordinates of the anchor node.
[0010] Optionally, the true coordinates of the three anchor nodes are processed to obtain the initial coordinates of the i-th target node, including: establishing a set of geometric constraint equations with the target node coordinates of the i-th target node as unknowns based on the true coordinates of the three anchor nodes; transforming the set of geometric constraint equations into a target matrix; and performing matrix operations on the target matrix to obtain the initial coordinates of the i-th target node.
[0011] Optionally, the method further includes: if the preset termination condition is not met, repeating the following steps until the preset termination condition is met: updating the decline coefficient according to the current evolutionary state, wherein the decline coefficient is a control parameter that gradually decreases during the iteration process; performing an individual position update operation on the current parent population based on the updated decline coefficient, and regenerating the offspring population; calculating the fitness value of each individual in the offspring population; determining a new optimal individual from the offspring population based on the fitness value of the individuals in the offspring population; comparing the new optimal individual with the historical global optimal individual, and updating the historical global optimal individual based on the comparison result; implementing an elite retention strategy on the current parent population and offspring population, selecting a preset number of optimal individuals from the current parent population and offspring population based on the individual fitness value to form a new population, and using the new population as the parent population for the next iteration cycle.
[0012] Optionally, an individual position update operation is performed on the current parent population, including: obtaining a unified upper bound, a unified lower bound, and a decreasing coefficient for the solution space; calculating the resultant force vector of social interactions for each individual based on the relative positional relationships between individuals in the current parent population, where the relative positional relationships include the Euclidean distance and unit direction vector between individuals; multiplying the resultant force vector of social interactions by the decreasing coefficient to obtain a new position vector for each individual; comparing each component of the new position vector with the unified upper and lower bounds of the solution space, and constraining components that exceed the boundaries; and combining the constrained new position vectors into a new offspring population.
[0013] Optionally, for each target node, the optimal coordinate with the smallest error value is determined from the initial coordinates of all individuals to obtain the optimal coordinates of all target nodes. This includes: determining the initial distance between each target node and the anchor node based on the initial coordinates of each target node and the true coordinates of the anchor node; calculating the error value between the initial distance and the target measured distance, where the target measured distance is the measured distance between the target node and the anchor node; and for each target node, determining the optimal coordinate with the smallest error value from the initial coordinates of all individuals to obtain the optimal coordinates of all target nodes.
[0014] In this application, a weight matrix is determined based on the measured distance between target nodes and anchor nodes in a wireless sensor network. Anchor nodes represent wireless sensors with known coordinates, and target nodes represent wireless sensors to be located that have a communication connection with anchor nodes. The rows of the weight matrix represent the weight coefficients between the same target node and different anchor nodes, with the weight coefficients negatively correlated with the measured distance. A probability distribution matrix is determined based on the ratio of the element values in the weight matrix to the target summation result. The target summation result is the sum of all element values in the row containing the target value. The rows of the probability distribution matrix represent the probability that different anchor nodes are selected by the same target node. For each individual in the population in the locust optimization algorithm, the following process is repeated multiple times to obtain the initial population: For each target node in the probability distribution matrix, three anchor nodes are selected from the probability distribution matrix using a roulette wheel, and tri-point localization is performed based on the real coordinates of the three anchor nodes. The initial coordinates of each target node are determined, where each individual includes the initial coordinates of all target nodes. For each target node, the optimal coordinate with the smallest error value is determined from the initial coordinates of all individuals to obtain the optimal coordinates of all target nodes. Based on the optimal coordinates of all target nodes, the optimal individual is generated. The optimal individual replaces any individual in the initial population to obtain a new population. The new population is iterated, evolved, and updated. Under the condition of satisfying the preset termination condition, the predicted coordinates of the target nodes are output, and the position of the target nodes in the wireless sensor network is determined based on the predicted coordinates. This method achieves the purpose of constructing a weight matrix negatively correlated with the distance measurement and a probability distribution matrix based on the weight matrix, and combining it with the locust optimization algorithm for population initialization and iterative update, thereby achieving the technical effect of improving the positioning accuracy. This solves the technical problem of low positioning accuracy caused by the dependence of node positioning methods in related wireless sensor networks on wireless signal parameters. Attached Figure Description
[0015] The accompanying drawings, which are included to provide a further understanding of this application and form part of this application, illustrate exemplary embodiments and are used to explain this application, but do not constitute an undue limitation of this application. In the drawings:
[0016] Figure 1 is a schematic diagram of node localization in a wireless sensor network;
[0017] Figure 2 This is a flowchart of a wireless sensor positioning method according to an embodiment of this application;
[0018] Figure 3 This is a schematic diagram of an ALE function surface and contour lines according to an embodiment of this application;
[0019] Figure 4This is a schematic diagram of an ALE² function surface and contour lines according to an embodiment of this application;
[0020] Figure 5 This is a schematic diagram of the objective function image corresponding to a different number of anchor nodes according to an embodiment of this application;
[0021] Figure 6 This is a schematic diagram of the surface contour lines of an objective function corresponding to a different number of anchor nodes according to an embodiment of this application;
[0022] Figure 7 This is a schematic diagram of an objective function calculated from the RSS ranging distance matrix for a different number of anchor nodes according to an embodiment of this application;
[0023] Figure 8 This is a schematic diagram of the surface contour lines of an objective function calculated from the RSS ranging distance matrix corresponding to a different number of anchor nodes according to an embodiment of this application;
[0024] Figure 9 This is a schematic diagram of contour line comparison of two sets of objective function images according to an embodiment of this application;
[0025] Figure 10 This is a schematic diagram of a three-point positioning algorithm according to an embodiment of this application;
[0026] Figure 11 This is a schematic diagram of a three-point positioning algorithm for a situation where there is a distance error, according to an embodiment of this application;
[0027] Figure 12 This is a schematic diagram of an initialized individual obtained by a different method according to an embodiment of this application;
[0028] Figure 13 This is a comparative diagram of the objective function and average positioning error of different strategy individuals according to an embodiment of this application;
[0029] Figure 14 This is a schematic diagram of a target anchor node RSS ranging distance matrix according to an embodiment of this application;
[0030] Figure 15 This is a schematic diagram of an anchor node weight matrix according to an embodiment of this application;
[0031] Figure 16 This is a schematic diagram of an anchor node selection probability distribution matrix according to an embodiment of this application;
[0032] Figure 17 This is a schematic diagram of a target anchor node true distance matrix according to an embodiment of this application;
[0033] Figure 18 This is a schematic diagram of a target anchor node distance error matrix according to an embodiment of this application;
[0034] Figure 19 This is a schematic diagram of a target anchor node distance error rate matrix according to an embodiment of this application;
[0035] Figure 20 This is a schematic diagram of the convergence curve of the objective function of a different algorithm according to an embodiment of this application;
[0036] Figure 21 This is a schematic diagram of the convergence curve of the average positioning error of a different algorithm according to an embodiment of this application;
[0037] Figure 22 This is a schematic diagram of the localization result of an improved GOA algorithm according to an embodiment of this application;
[0038] Figure 23 This is a flowchart of another wireless sensor positioning method according to an embodiment of this application. Detailed Implementation
[0039] To enable those skilled in the art to better understand the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present application, and not all embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative effort should fall within the scope of protection of the present application.
[0040] It should be noted that the terms "first," "second," etc., in the specification, claims, and accompanying drawings of this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of this application described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.
[0041] To better understand the embodiments of this application, the technical terms involved in the embodiments of this application are explained below:
[0042] The Grasshopper Optimization Algorithm (GOA) is inspired by the leader-follower behavior of grasshoppers. In GOA, the solution to the problem is considered as an individual grasshopper, while the entire swarm represents the search space. The algorithm begins by randomly generating a group of grasshoppers to form an initial swarm. Each grasshopper has a specific location and its fitness is evaluated based on its current location. In each iteration, grasshoppers guide the search process by communicating and cooperating. Specifically, each grasshopper chooses a leader grasshopper based on its fitness and distance from surrounding grasshoppers. Other grasshoppers then follow the leader grasshopper's movement, gradually adjusting their own position and speed. Through this leader-follower behavior, the entire swarm gradually converges on a location with a better solution. The algorithm also introduces mechanisms for global and local search to balance exploration and exploitation capabilities.
[0043] A Wireless Sensor Network (WSN) is a network composed of a large number of wireless sensor nodes distributed throughout space. These nodes can sense various parameters in the environment, such as temperature, humidity, light, and pressure, and transmit the collected data wirelessly to a base station or data center for processing and analysis. WSNs are commonly used to monitor and collect information about the environment, objects, or events, with applications including environmental monitoring, agriculture, industrial automation, and health monitoring. Because nodes are typically battery-powered and deployed in harsh environments, the design and management of WSNs require consideration of energy efficiency, communication reliability, and network topology.
[0044] In wireless sensor networks, node localization is a critical issue—determining the precise physical location of each node. The accuracy of node localization is essential for many applications, such as target tracking, environmental monitoring, and area coverage.
[0045] However, node localization faces a series of challenges and problems. First, wireless sensor nodes have limited computing and communication capabilities, thus requiring the selection of localization methods suitable for node resources. Second, the deployment of nodes may lead to uneven coverage or dead zones, affecting localization accuracy. Furthermore, nodes in wireless sensor networks are typically subject to interference such as signal attenuation, multipath effects, and noise, all of which can impact localization results. In addition, node energy consumption must also be considered, as the localization process may require nodes to perform additional computation, communication, and coordination.
[0046] Figure 1 is a schematic diagram of wireless sensor network node localization. Figure 1(a) shows the wireless sensor network node before localization, and Figure 1(b) shows the wireless sensor network node after localization. As shown in Figure 1, the red " The green "△" points represent the anchor node positions, the green "△" points represent the actual target node positions, the blue "○" points represent the estimated target node positions, and the blue "—" line represents the correspondence between the actual and estimated target node positions. The length of this line segment represents the positioning error.
[0047] The problem of node localization in wireless sensor networks is essentially a real-number optimization model, as shown below:
[0048] In a two-dimensional space, a wireless sensor network consists of several sensor nodes (anchor nodes and target nodes). The anchor nodes have known locations and do not move after deployment, while the target nodes have unknown locations that need to be calculated. The effective communication range of a sensor node is a radius of [missing information]. The anchor node broadcasts information to the target node within its communication range, and the actual distance between the two points is calculated by measuring the signal strength transmitted between the nodes.
[0049] The number of target nodes (unknown nodes) is , No. The actual coordinates of each target node are as follows: The estimated coordinates are as follows The number of anchor nodes (known nodes) is... , No. The coordinates of each anchor node are as follows Target node With anchor node The actual distance is Estimate coordinates With anchor node The distance is .
[0050] By minimizing , The mean square error between nodes is used to estimate the target node coordinates, thus yielding the objective function. As shown in equation (1):
[0051]
[0052] Wherein, equation (2) represents the target node. and The mean square error of each anchor node Includes The estimated coordinates of each target node, i.e. .
[0053]
[0054] In practical applications, target node With anchor node actual distance Ranging is obtained based on RSS (Range Scale), which can be achieved using a logarithmic-normal distribution wireless signal propagation model, i.e.:
[0055]
[0056] in, For reference distance, For the propagation distance is The received signal power at that time. This represents the distance between the anchor node and the target node. For the propagation distance is The signal receiving power at that time. This is the path loss factor. With a mean of 0 and a standard deviation of Gaussian variables.
[0057] Due to factors such as multipath fading, unstable signal propagation, and noise, the communication range of a sensor node is not a regular circle. Therefore, communication irregularity is used for modeling. The higher the Degree of Irregularity (DOI) value, the more severely the communication range is affected by the environment. The DOI is defined as follows:
[0058]
[0059] in, Indicates the first The irregularity in each direction satisfies , It is a random number that follows a uniform distribution. The signal propagation model after using DOI is defined as:
[0060]
[0061] The aforementioned problem is a continuous real-number optimization problem in a two-dimensional space. Its search space (decision space) is of higher order infinity, making it an NP-hard problem. The difficulty of solving the problem increases exponentially with the data size, making it difficult to obtain the optimal solution in a finite time. Since its inception in the last century, this type of problem has been one of the key technologies in wireless sensor networks. Due to its wide range of applications and significant economic value, it has received widespread attention from scholars both domestically and internationally.
[0062] Wireless sensor network node localization methods are mainly divided into two categories: distance-dependent and distance-independent algorithms. Distance-dependent localization algorithms mainly include Time of Arrival (TOA) algorithms, Time Difference of Arrival (TDA) algorithms, Received Signal Strength Indication (RSSI) algorithms, and trilateration algorithms. Distance-independent localization algorithms mainly include centroid localization algorithms, approximate triangle interior point testing algorithms, DVHop algorithms, and node localization algorithms based on Multidimensional Calibration Spectrum (MDS). Among these, the RSSI algorithm has become a commonly used method for sensor node localization due to its low cost and convenient and flexible measurement. However, the RSSI localization algorithm suffers from relatively large ranging errors due to the complex and variable communication channel between the anchor node (reference node) and the target node (measurement node). Furthermore, since the RSSI algorithm is susceptible to environmental factors, signal transmission models, and parameters, optimization algorithms are needed to optimize the RSSI ranging results to ensure more stable localization accuracy.
[0063] Exact algorithms are feasible for small-scale problems, but their computation time becomes unacceptable with large datasets, making them difficult to apply in real-world production and daily life. Heuristic algorithms, while not guaranteeing the discovery of the optimal solution, often find suboptimal solutions close to the global optimum, but significantly reduce computation time, leading to their widespread use. Swarm intelligence algorithms, a type of heuristic algorithm inspired by natural (biological) laws, mimic problem-solving algorithms based on their principles; they are also known as "soft computing." They possess advantages such as strong robustness and wide adaptability, and are used to solve NP-hard problems. These algorithms are currently one of the mainstream research directions for solving node localization problems in wireless sensor networks. Some related technologies first construct the RSSI distance formula between the anchor node and the unknown node, calculate the centroid coordinates of the anchor node, and then use these centroid coordinates as the initial coordinates for the Grey Wolf algorithm to iteratively optimize and ultimately find the precise coordinates of the unknown node. Some related technologies optimize the weighted centroid algorithm using the whale algorithm to reduce the impact of RSSI ranging error on the weighted centroid algorithm. This paper proposes an improved weighted centroid algorithm based on the whale optimization algorithm to improve positioning accuracy.
[0064] Among the heuristic algorithms is the locust optimization algorithm, which is an evolutionary search algorithm based on the collective behavior of locusts in nature. It simulates the social behavior and group cooperation among individual locusts and finds the optimal solution by imitating the foraging behavior of locusts.
[0065] The locust optimization algorithm includes the following steps: 1. Initialize the locust swarm: Set the initial number of locust individuals and randomly initialize the position of each individual; 2. Calculate the fitness value: Calculate the fitness value of each locust individual according to the objective function of the problem; 3. Update the best individual: Based on the individual fitness, find the best individual in the current swarm, compare it with the historical best individual, and decide whether to update it. If the fitness is better than the historical best, then update it; otherwise, do not update it; 5. Update the parameters: A linear decreasing function that decreases with the number of iterations; 6. Update the position of the locust: Calculate an increment for the current locust individual and other individuals in the swarm. Multiply this increment by the parameters and add it to the best individual to obtain a new individual. Calculate the fitness value of the new individual; 7. Termination condition judgment: Repeat steps 3 to 6 until a preset termination condition is reached.
[0066] The Locust Optimization Algorithm simulates the foraging behavior of locust swarms, utilizing inter-swarm interactions, the effects of Earth's gravity, and environmental wind forces to update the swarm's position, thereby searching for the global optimum. Compared to other optimization algorithms, the Locust Optimization Algorithm exhibits better convergence speed and global search capability, achieving excellent results in practical applications. This algorithm performs well on the CEC2005 test set, effectively avoiding getting trapped in local optima. However, its current application is primarily focused on real-valued optimization problems, and its use in wireless sensor network node localization has not yet been addressed.
[0067] According to an embodiment of this application, a method embodiment for locating a wireless sensor is provided. It should be noted that the steps shown in the flowchart in the accompanying drawings can be executed in a computer system such as a set of computer-executable instructions. Furthermore, although a logical order is shown in the flowchart, in some cases, the steps shown or described may be executed in a different order than that shown here.
[0068] Figure 2 This is a flowchart of a wireless sensor positioning method according to an embodiment of this application, such as... Figure 2 As shown, the method includes the following steps:
[0069] Step S202: Determine the weight matrix based on the measured distance between the target node and the anchor node in the wireless sensor network. The anchor node represents a wireless sensor with known coordinates, and the target node represents a wireless sensor to be located that has a communication connection with the anchor node. The rows of the weight matrix represent the weight coefficients between the same target node and different anchor nodes. The weight coefficients are negatively correlated with the measured distance.
[0070] Optionally, the localization method for wireless sensors further includes the following steps: determining an objective function, wherein, in the application of the locust optimization algorithm to the node localization problem of wireless sensor networks, the objective function is based on the localization errors of all target nodes relative to anchor nodes in the entire wireless sensor network. Specifically, the objective function is an aggregation of the localization errors of all target nodes, so as to comprehensively evaluate the overall performance of individuals (i.e., localization solutions) in the population.
[0071] Specifically, the best way to calculate the closeness between estimated and actual coordinates is to use the Average Localization Error (ALE). The error value is a non-negative real number; the smaller the value, the closer the estimated and actual coordinates are. When ALE is 0, it means the two coordinates completely coincide. Equation (6) is the mean Euclidean distance between the estimated and actual coordinates of all unknown nodes, i.e.:
[0072]
[0073] However, in real-world wireless sensor network node localization problems, the true coordinates of the target node are unknown. The locust optimization algorithm needs to calculate the estimated coordinates of the target node based on the true coordinates of the anchor node and the distance matrix between the target and anchor nodes obtained through ranging. Therefore, ALE can only be used as an indicator to measure the effectiveness of the algorithm's localization results in experiments.
[0074] Therefore, this embodiment requires constructing an objective function that is similar to the ALE function surface or has the same minimum point. The objective function can be the mean of the mean squared errors of all target nodes. For details, see formula (1).
[0075] The following explains the specific reasons for choosing the mean squared error of all target nodes as the objective function.
[0076] Select target node 1 (77.685, 34.899) from Table 5 as the object to be estimated, and plot its ALE function graph, as shown below. Figure 3 As shown in (a) above. Its function expression is: It is a conic surface with the target node (77.685, 34.899) as its vertex and opening upwards, with a function minimum value of 0. At a fixed height... The surface is cut off, and the resulting cross-section is a circle with the target node as the center and a radius of... The circle, Figure 3 (b) in the figure is the contour line of the function, and the red “” in the figure is the target node No. 1.
[0077] Figure 4 In (a), target node 1 in Table 5 is taken as the object to be estimated. The graph of the function is a circular parabola with the target node 1 as its vertex and opening upwards. The minimum value of the function is 0. Figure 4 (b) in the diagram represents the top view and contour lines of the function.
[0078] Select anchor node 1 (54.971, 57.013) from Table 3, and the distances between the target anchor nodes in the first row and first column of Table 4, and plot the corresponding equation (1). Function graphs, such as Figure 5 As shown in (a) in the figure, the red " The black "○" represents target node 1, and the black "○" represents anchor node 1. Its function expression is: It has one local peak, which is the location of anchor node 1; and a set of minimum points formed by a circle with anchor node 1 as the center and radius 31.701, whose minimum value is 0, where target node 1 is a point on this circle. Figure 6 (a) in the figure is a top view of the graph of the function, and the contour lines are composed of several concentric circles with anchor node 1 as the center.
[0079] Figure 5 (b) represents the distance between anchor nodes 1 and 2 in Table 3 and the first two rows and first two columns of target anchor nodes in Table 4. The target function image is plotted and has two local peaks, which are the positions of the function images where anchor nodes 1 and 2 are located. There are two function minimum points, one of which is the position of the function image where target node 1 is located, and the other is the point symmetrical to the other side of the vertical symmetry plane between the two anchor nodes. Figure 6 (b) in the figure is the top view and contour lines of the function graph. The function graph is symmetrical about the straight line where anchor nodes 1 and 2 are located. The minimum value of the function is also 0.
[0080] Figure 5 (c) Figure 6 In the graph, (c) represents the distance between the first three anchor nodes in Table 3 and the first three rows and three columns of the target anchor nodes in Table 4. The target function graph is plotted, and its three anchor nodes are all local peaks on the function. The function has only one minimum point, which is the position of the target node, and the function value is 0.
[0081] Figure 5 (d) Figure 6 In the graph, (d) represents the distance between the first 5 anchor nodes in Table 3 and the first 5 rows and 5 columns of the target anchor nodes in Table 4. The target function graph is plotted, and at this point, the local peak of the function is no longer obvious. There is only one minimum point of the function, which is the position of the target node, and the function value is 0.
[0082] Figure 5 (e) Figure 6 In the graph (e), the objective function image of the first 10 anchor nodes is shown. Figure 5 (f) in Figure 6In the example (f), the objective function graph for the first 30 anchor nodes yields the same conclusion. Objective function As the number of anchor nodes increases, local peaks gradually disappear, and the shape of the function graph becomes more uniform. Figure 4 In (a), the surface plots of the ALE² function become increasingly similar, and the two function graphs have the same lowest point, namely the target node 1, and their minimum value points are both 0.
[0083] However, in practical applications, the true distance matrix of the target anchor node cannot be obtained. Therefore, the RSS ranging distance matrix (distance matrix) can be used instead. Figure 5 , Figure 6 The actual objective function is plotted in different ways. Images and contour lines, such as Figure 7 , Figure 8 As shown, where, Figure 7 (a) in the figure is a schematic diagram of the objective function calculated from the RSS ranging distance matrix for one anchor node; Figure 7 (b) in the diagram is a schematic diagram of the objective function calculated from the RSS ranging distance matrix for the two anchor nodes; Figure 7 (c) in the figure is a schematic diagram of the objective function calculated from the RSS ranging distance matrix corresponding to the three anchor nodes; Figure 7 (d) in the figure is a schematic diagram of the objective function calculated from the RSS ranging distance matrix for the 5 anchor nodes; Figure 7 (e) in the diagram is a schematic diagram of the objective function calculated from the RSS ranging distance matrix corresponding to the 10 anchor nodes; Figure 7 (f) in the diagram is a schematic diagram of the objective function calculated from the RSS ranging distance matrix corresponding to 30 anchor nodes. Figure 8 (a) is a schematic diagram of the surface contour lines of the objective function calculated from the RSS ranging distance matrix corresponding to one anchor node; Figure 8 (b) is a schematic diagram of the surface contour lines of the objective function calculated from the RSS ranging distance matrix corresponding to the two anchor nodes; Figure 8 (c) is a schematic diagram of the surface contour lines of the objective function calculated from the RSS ranging distance matrix corresponding to the three anchor nodes; Figure 8 (d) is a schematic diagram of the surface contour lines of the objective function calculated from the RSS ranging distance matrix corresponding to the 5 anchor nodes; Figure 8 (e) in the figure is a schematic diagram of the surface contour lines of the objective function calculated from the RSS ranging distance matrix corresponding to the 10 anchor nodes; Figure 8 In the diagram, (f) is a schematic representation of the surface contour lines of the objective function calculated from the RSS ranging distance matrix for the 30 anchor nodes. Figure 7 , Figure 8It can be seen that the function graph of the true distance and the function graph of the RSS distance measurement are basically the same in shape and properties, with only a small local offset, and Figure 7 The minimum value of the function in the equation is no longer 0; it is a number slightly greater than 0, which is related to the RSS ranging distance deviation.
[0084] Figure 9 for Figure 6 , Figure 8 The comparison of two sets of contour maps shows that the same contour lines largely overlap, verifying the rationality of the objective function. Figure 9 (a) in the middle is Figure 6 (a) and Figure 8 A comparison chart between (a) and (b); Figure 9 (b) is Figure 6 (b) and Figure 8 A comparison diagram between (b) in the diagram; Figure 9 (c) in the middle is Figure 6 (c) and Figure 8 A comparison chart between (c) in the chart; Figure 9 (d) in the text is Figure 6 (d) and Figure 8 A comparison chart between (d) in the chart; Figure 9 (e) in the middle is Figure 6 (e) and Figure 8 A comparison diagram between (e) in the middle; Figure 9 (f) in the middle is Figure 6 (f) and Figure 8 A comparison diagram between (f) in the middle;
[0085] Optionally, before step S202, the following steps may also be performed: Initialize parameters: Determine population size (Scalar), Maximum Evolution Generation (Scalar) Anchor node coordinate data (Set), Target Anchor Node Distance Matrix Data (Two-dimensional matrix), effective communication radius (Scalar).
[0086] Reading data: Reading the dataset , where the dataset This includes: the actual coordinates of the anchor node. Read the dataset , where the dataset Includes: target-anchor node distance matrix ( (a two-dimensional matrix).
[0087] Loading Model: Remove target anchor node distances from the target anchor node distance matrix that exceed the effective communication radius. The distance is set to .
[0088] Specifically, in step S102, determining the weight matrix based on the measured distance between the target node and the anchor node can be achieved as follows: Determine a distance matrix based on the measured distance between the target node and the anchor node, where each row of the distance matrix represents the measured distance between the same target node and different anchor nodes; determine the minimum value in each row of the distance matrix; determine the target element value of each element in the i-th row based on the ratio of the minimum value in the i-th row to the values of each element in the i-th row, thus obtaining the target element values of each element in N rows, where i is a positive integer not greater than N, N is the number of target nodes, and N is a positive integer greater than 1; determine the weight matrix based on the target element values of each element in the N rows.
[0089] Understandably, the above steps first require constructing a distance matrix. Each row of the distance matrix represents a target node, and the elements of each row are the measured distances between that target node and all anchor nodes in the network. Since the distance between target nodes and anchor nodes in a wireless sensor network is obtained based on RSS ranging, the design of the rows and columns of the distance matrix directly reflects the relationship between target nodes and anchor nodes; rows represent target nodes, and columns represent anchor nodes.
[0090] Next, the minimum value in each row of the distance matrix is determined. The purpose of this step is to find the anchor node that is closest to each target node, because close-range measurements are more accurate than distant measurements. By finding the minimum value in each row, the anchor node that contributes the most to the localization of the target node can be identified. The target element value is determined by the ratio of the minimum value in each row to each element in the row. It can be understood that the above determination process is essentially calculating weight coefficients, that is, the relative magnitude of each element in the row (the measured distance between the anchor node and the target node) to the minimum value of that row. By comparing the element values of each row of the weight matrix with its minimum value, the relative importance of each anchor node in the localization problem can be quantified; the closer the anchor node, the greater its weight.
[0091] Finally, each row of the weight matrix is normalized to form the anchor node selection probability distribution matrix. The rows and columns of the probability distribution matrix correspond to the target node and the anchor node, respectively. Each element in the matrix represents the probability that the (j)th anchor node is selected when locating the (i)th target node. The normalization process ensures that the sum of the elements in each row is 1, making the probability distribution matrix more intuitive and easier to use.
[0092] Specifically, for target nodes and The distance matrix between anchor nodes is denoted as As shown in equation (7).
[0093]
[0094] in, Indicates the first The target node and the first RSS distance between anchor nodes If the first The target node is not in the first Within the effective communication radius of each anchor node, ranging cannot be obtained; in this case, the corresponding... The value is assigned to an infinite value. .
[0095] Find the distance matrix The minimum value in each row yields the column vector. As shown in equation (8).
[0096]
[0097] in, Representation matrix The Middle The minimum value of all elements in a row.
[0098] Based on column vectors Calculate the weight matrix As shown in equation (9).
[0099]
[0100] in, Indicates the first The anchor node is the first The weight coefficient of each target node is determined by the distance between the anchor node and the target node. The closer the anchor node is to the target node, the greater its weight coefficient. The distance-based importance parameter is a natural number greater than 1. The larger the value, the greater the impact of distance on the weight.
[0101] Step S204: Determine the probability distribution matrix based on the ratio of the element values in the weight matrix to the target summation result. The target summation result is the summation result of all element values in the row containing the element value. The rows of the probability distribution matrix are used to represent the probability that different anchor nodes are selected by the same target node.
[0102] In step S204, the weight matrix needs to be calculated. The sum of the elements in each row yields the column vector. As shown in equation (10).
[0103]
[0104] in, Represents the weight matrix The Middle The sum of all elements in the row.
[0105] Based on column vectors Calculate the probability distribution matrix of anchor node selection As shown in equation (11).
[0106]
[0107] in, Indicating the estimation of the first When the coordinates of the target node are given, the first... The probability that anchor node number 1 is selected. The larger, the more The higher the probability that the anchor node is selected, the more likely each row will be selected. The sum is 1.
[0108] Step S206: For each individual in the population of the locust optimization algorithm, repeat the following process multiple times to obtain the initial population: For each target node in the probability distribution matrix, select three anchor nodes in the probability distribution matrix by roulette wheel betting, and perform three-point positioning based on the real coordinates of the three anchor nodes to obtain the initial coordinates of each target node. Each individual includes the initial coordinates of all target nodes.
[0109] Step S206 can also be implemented as follows: For each individual in the population of the locust optimization algorithm, repeat the following process multiple times to obtain the initial population: Determine the initial coordinates of each target node in the probability distribution matrix based on the true coordinates of multiple randomly selected anchor nodes, wherein the individual includes the predicted coordinates of all target nodes.
[0110] It's worth explaining that in the locust optimization algorithm, the population refers to the set of candidate solutions generated in the early stages of the algorithm. Each solution (individual) represents a potential solution for the location information of all target nodes in the wireless sensor network. The population consists of multiple individuals, each including the initial predicted coordinates of all target nodes, forming a set of coordinate vectors.
[0111] For each target node, based on its measured distance to the anchor nodes, the true coordinates of three anchor nodes are randomly selected from the probability distribution matrix using a roulette wheel mechanism (roulette wheel betting) for triangulation, thus obtaining the initial estimated coordinates of the target node. These initial estimated coordinates are a subset of those of individuals in the population; that is, the target node coordinates for each individual are initialized through random selection based on the probability distribution matrix. This initialization method increases the probability of selecting anchor nodes that are closer together, thereby improving the initial positioning accuracy of the individual.
[0112] For example, suppose there are 5 target nodes in the network (N=5), and the population size is 10 (i.e., 10 individuals). To construct the first individual, firstly, 3 anchor nodes are randomly selected based on the probability distribution matrix. Using the real coordinates of these 3 anchor nodes, the predicted coordinates of the first target node are calculated using triangulation or other localization algorithms. Then, 3 more anchor nodes are randomly selected, and the predicted coordinates of the second target node are calculated. This process is repeated 5 times until the coordinates of all target nodes are estimated. This yields the first individual in the population. Next, this process is repeated 9 times until all individuals in the population (a total of 10 individuals) have been constructed, thus forming the initial population.
[0113] In step S206, the initial coordinates of each target node in the probability distribution matrix are determined based on the real coordinates of multiple randomly selected anchor nodes. This can be achieved as follows: In the probability distribution matrix, select the element in the i-th row, where i is a positive integer not greater than N, and N is the number of target nodes, where N is a positive integer greater than 1; In the element in the i-th row, select three anchor nodes by roulette wheel selection; Obtain the real coordinates of the three anchor nodes; Use the three-point positioning algorithm to process the real coordinates of the three anchor nodes to obtain the initial coordinates of the i-th target node.
[0114] Understandably, the above steps start from the probability distribution matrix. For each row, the row represents the relationship between a specific target node and all anchor nodes, with each element representing the probability of the corresponding anchor node being selected. Taking row (i) as an example, here (i) is a positive integer, and the value of (i) ranges from 1 to (N), where (N) is the total number of target nodes, and (N) is greater than 1. The set of elements in row (i) constitutes a probability distribution, reflecting the relative importance of each anchor node for locating the (i)th target node. The closer an anchor node is to the (i)th target node, the higher its corresponding element value (i.e., the probability of being selected) in that row, and vice versa.
[0115] Three target anchor nodes are selected from a row using a roulette wheel selection algorithm. The roulette wheel selection algorithm is a probability-based random selection method, mimicking the principle of roulette, where the probability of selecting each element is proportional to its probability value in that row. This algorithm ensures that anchor nodes that are closer together have a higher chance of being selected, thus providing more accurate initial distance information in the triangulation algorithm. For the three anchor nodes selected in row (i) using the roulette wheel selection algorithm, their real coordinates are further retrieved. These real coordinates are known in the wireless sensor network, representing the anchor node's location information. The initial coordinates of the three target anchor nodes are then processed using the triangulation algorithm to obtain the initial coordinates of the (i)th target node. Triangulation is a common target localization method based on geometric principles. It estimates the target point's location by knowing the positions of three points (in this case, the three anchor nodes) and their distances to the target point. By inputting the real coordinates of the three selected anchor nodes into the triangulation algorithm, a preliminary estimate of the (i)th target node's location can be obtained.
[0116] Optionally, in the i-th row, selecting three anchor nodes by roulette wheel can be achieved as follows: determine the fitness function, and calculate the fitness value of each anchor node in the i-th row based on the fitness function; normalize the fitness value to obtain the selection probability value of each anchor node; construct a continuous probability interval based on the selection probability value of each anchor node, and assign a corresponding sub-interval to each anchor node in the continuous probability interval; generate three random numbers, where each random number falls into the target position within the continuous probability interval; and determine the anchor nodes associated with the sub-intervals corresponding to the target positions into which the three random numbers fall as the three anchor nodes.
[0117] Specifically, the fitness function represents the relative effectiveness of anchor nodes in locating target nodes. The fitness function is defined based on the distance between the target node and the anchor node, where a shorter distance implies a smaller potential error during localization and is therefore assigned a higher fitness value. The calculated fitness values are then normalized, converting them into probability values. The purpose of normalization is to ensure that the sum of the selection probabilities of all anchor nodes is 1, thus forming a probability distribution. This probability distribution reflects the likelihood of each anchor node being selected; anchor nodes closer to the target node will have a higher selection probability.
[0118] Based on the normalized probability values, a continuous probability interval is constructed, and a corresponding sub-interval is assigned to each anchor node. This process is similar to dividing the [0,1] interval into multiple parts, where the length of each part represents the selection probability of the corresponding anchor node, and the continuous probability interval is a combination of these parts. Through the above allocation mechanism, an intuitive random selection framework can be created, in which each anchor node has a clear probability of being selected and a corresponding selection sub-interval.
[0119] Finally, based on the continuous probability interval constructed above, three independent random numbers are generated. Each of these three random numbers falls independently into a certain position within the probability interval. According to their position, the anchor node associated with the corresponding sub-interval is determined, i.e., the three target anchor nodes. The three generated target anchor nodes will be used in the triangulation algorithm to initially estimate the coordinates of the (i)th target node.
[0120] Optionally, the fitness function can be determined as follows: Based on the mean square error of the first distance and the second distance, the fitness function is determined, where the first distance is the measured distance between the target node and the anchor node, and the second distance is the distance between the estimated coordinates of the target node and the true coordinates of the anchor node. The fitness function can be the objective function in Equation 1).
[0121] Optionally, the initial coordinates of the i-th target node can be obtained by processing the real coordinates of the three target anchor nodes. This can be achieved by: establishing a set of geometric constraint equations with the target node coordinates of the i-th target node as unknowns based on the real coordinates of the three anchor nodes; transforming the set of geometric constraint equations into a target matrix; and performing matrix operations on the target matrix to obtain the initial coordinates of the i-th target node.
[0122] Specifically, each generation of the population contains a number of individuals, each individual Includes The estimated coordinates of each target node, i.e. Based on the probability distribution matrix of anchor node selection. Each time, three anchor nodes are selected to initialize the coordinates of the target node. In estimating the... When considering the coordinates of each target node, from the probability distribution matrix... The row element Three anchor nodes are selected using a roulette wheel selection method, and then the third anchor node is estimated using the "three-point positioning" principle. The coordinates of each target node, as an individual No. Initial coordinates of each target node.
[0123] Among them, the triangulation algorithm is often used for estimating the coordinates of unknown nodes, and its principle is as follows: Figure 10As shown. Given three points in a plane and their distances to any other point, a system of equations can be established based on these distances, and the coordinates of any point can be solved using matrix operations. Assume that in the plane... The coordinates of the three points are respectively Point to be located The coordinates are ,point The distances to the three points are respectively Based on the distance formula, a system of equations can be established as shown in equation (12).
[0124]
[0125] The equation can be expressed in matrix form as follows:
[0126]
[0127] in:
[0128]
[0129] The point to be located can be obtained through matrix operations using equation (17). The coordinates are the solution vectors. .
[0130]
[0131] Figure 10 This represents the ideal situation where three-point positioning distance is error-free. However, in reality, RSS ranging distance is usually accompanied by considerable errors, affecting the positioning effect. Figure 11 As shown, the method of randomly selecting three punctuation marks using a roulette wheel based on probability is precisely to reduce this error.
[0132] Repeat the individual initialization operation described above. Next, the initial population of the GOA algorithm is obtained, as shown in equation (18).
[0133]
[0134] in, Indicates population The first in Individual, Indicates the first Among the individuals, the first Estimated coordinates (initialized coordinates) of each target node.
[0135] Step S208: For each target node, determine the optimal coordinate with the smallest error value among the initial coordinates of all individuals to obtain the optimal coordinates of all target nodes, and generate the optimal individual based on the optimal coordinates of all target nodes; replace any individual in the initial population with the optimal individual to obtain a new population; iterate, evolve, and update the new population, and output the predicted coordinates of the target nodes when the preset termination condition is met, and determine the position of the target nodes in the wireless sensor network based on the predicted coordinates.
[0136] Specifically, for each target node, the optimal coordinate with the smallest error value is determined from the initial coordinates of all individuals to obtain the optimal coordinates of all target nodes. This can be achieved as follows: Based on the initial coordinates of each target node and the true coordinates of the anchor node, the initial distance between each target node and the anchor node is determined; the error value between the initial distance and the target measured distance is calculated, where the target measured distance is the measured distance between the target node and the anchor node; for each target node, the optimal coordinate with the smallest error value is determined from the initial coordinates of all individuals to obtain the optimal coordinates of all target nodes.
[0137] Understandably, the following steps are needed to obtain the optimal coordinates of all target nodes: Utilize the initial coordinates of the target nodes and the actual coordinates of the anchor nodes to perform distance calculations. For each target node, iterate through all anchor nodes and use the distance calculation formula to determine the initial distance between the target node and each anchor node. Compare the initial distance obtained above with the known target measurement distance, i.e., the actual distance between the target node and anchor nodes obtained through RSS ranging or other measurement methods. By checking the distance between each target node and anchor node, calculate the difference between the two to obtain the error value.
[0138] It is worth noting that the error value is used to measure the accuracy of the target node initial coordinate prediction. The smaller the error value, the closer the predicted coordinates are to the actual position.
[0139] The optimal coordinate determination step is performed on all target nodes to ensure that each step obtains the optimal positional solution for a specific target node, ultimately forming a set containing the optimal coordinates of all target nodes. This set essentially constitutes an optimal individual (super individual) in the optimized locust algorithm. The optimal individual provides an excellent starting point for subsequent evolutionary algorithm iterations, helping the algorithm converge to the global optimum more quickly, while also ensuring improved positioning accuracy. For example, suppose each generation of the population includes several individuals, and each individual X includes the initial predicted coordinates of N target nodes. For target node 1, the coordinate with the smallest error value is found from the initial coordinates of all individuals, and this coordinate is marked as the "optimal coordinate" of target node (i).
[0140] It is worth noting that the optimal coordinates of each target node are determined independently. The optimal coordinates may appear in any individual in the population, rather than in the individual with the best overall performance.
[0141] Perform the above steps independently for each target node. That is, for target node 2, target node 3, and so on up to target node (N), find the initial coordinates with the smallest error value in the population. This will give you a list containing the set of optimal initial coordinates for all target nodes.
[0142] The optimal initial coordinates of all target nodes are combined into a new individual, namely the optimal individual. In other words, the optimal individual includes the optimal initial coordinates of all target nodes and is a comprehensive representation of the best position prediction in the population.
[0143] Suppose we are dealing with a network localization problem involving 4 target nodes, and the population has 5 individuals: to Specifically, it can be expressed as:
[0144]
[0145]
[0146]
[0147]
[0148]
[0149] For each target node, the initial distance between the initial coordinates of the target node and the actual coordinates of the anchor node is calculated, and the error value between the initial distance and the measured distance is determined. Finally, the individual with the smallest error value is determined. Assuming that for target node 1, ( Predicted coordinates in ) The minimum error value is found at (target node 2); for target node 2, the minimum error value appears at (target node 2). The predicted coordinates in (( For target node 3 and target node 4, the minimum error values appear respectively in ( )and( The predicted coordinates in (( ))and( ).
[0150] Therefore, the optimal combination of individuals is as follows: [ , ( ), , In summary, during the evolutionary process, the locust algorithm identifies the optimal individual in the current population in each iteration. The evolution of the entire population is guided by the optimal individual. The node localization problem in wireless sensor networks is to simultaneously optimize the position coordinates of multiple target nodes, using the average mean square error of all target nodes as the objective function value (Equation (1)). However, The positions of the target nodes are independent of each other. For an individual with the optimal objective function value, the mean square error (equation (2)) of each target node is not necessarily optimal. Conversely, for an individual with a poor objective function value, its mean square error (equation (2)) of each target node is not necessarily optimal. Among the target nodes, there may be one or more target nodes with the optimal mean square error.
[0151] Therefore, this embodiment proposes a super-individual generation strategy, based on the population... Each individual Estimated coordinates of each target node Based on the localization status, the coordinates with the smallest mean square error for each target node are selected to form a super individual (optimal individual). This super individual is then incorporated into the current population, preventing the loss of fragments of excellent individuals during population evolution and significantly accelerating the convergence speed. In evolutionary algorithms, the population objective function, also known as the fitness function, is the standard for measuring the quality of each individual in the population. The objective function evaluates the performance of each individual in the current environment, guiding the algorithm to optimize the solution through evolutionary strategies. The algorithm selects well-performing individuals for the next generation based on the objective function value, thereby gradually improving the overall fitness of the population during the optimization process.
[0152] According to equation (1), the population Each individual The objective function value is calculated as shown in equation (19). Wherein, Indicates the first in the population The objective function value for each individual.
[0153]
[0154] According to equation (2), the population Each individual Estimated coordinates of each target node The mean square error is calculated as shown in equation (20). Wherein, Indicates the first in the population The individual The mean square error of each target node.
[0155]
[0156] Then, the coordinates that provide the best localization effect for each target node are selected. In the population... Among the individuals, the first The optimal estimated coordinates of each target node are: It is calculated according to formula (21).
[0157]
[0158] Finally, synthesize a super-individual. The optimal coordinate values for target node localization are used to synthesize a super-individual. As the optimal individual, it is shown in equation (22).
[0159]
[0160] Data from Tables 3, 4, and 5 below were used to conduct ablation experiments to verify the effectiveness of this strategy.
[0161] Figure 12 (a) in the figure is the coordinate distribution diagram of anchor and target nodes in Tables 3 and 5, where red “” represents anchor nodes and green “△” represents actual target nodes.
[0162] Figure 12 In (b), the case of a random initial individual (randomly estimated target node coordinates) in the evolutionary algorithm is shown. The blue "○" point is the estimated position of the target node, and the blue "—" line is the correspondence between the actual position and the estimated position of the target node. The length of the line segment is the positioning error. Figure 12 In (b), the estimated values of all node positions differ significantly from the actual values, and the objective function value of this individual... The average positioning error is 1236.61. It is 56.42.
[0163] Figure 12 (c) represents the result of randomly selecting 3 anchor nodes each time to perform three-point localization estimation for the target node. Figure 12 In (c), the estimated values of most node positions differ little from the actual values, while the differences are larger for a small number of nodes. The objective function value for this individual... The average positioning error is 488.03. It is 16.52.
[0164] Figure 12 In the example, (d) represents the result obtained by selecting the three anchor nodes closest to the target node each time and performing three-point positioning estimation. Figure 12 In (d), the estimated values of most node positions are very close to the actual values, while the estimated values of a very small number of nodes are slightly different. The objective function value of this individual is... The average positioning error is 13.59. The value is 2.69. This method can only generate one solution, lacking diversity.
[0165] Figure 12 In the matrix (e), the probability distribution matrix of the selected candidate is used for each selection. The result is obtained by selecting 3 anchor nodes and performing three-point localization estimation for the target node. Figure 12 In (e), the estimated values of most node positions are very close to the actual values, while the estimated values of a small number of nodes differ significantly from the actual values. The objective function value of this individual... The average positioning error is 45.92. It is 4.78.
[0166] Figure 12 In this context, (f) represents the probability distribution matrix of the selected individuals. The situation where a population is generated, and then super individuals are synthesized from the population. Figure 12 In (f), the estimated values of all node positions are very close to the actual values, and the objective function value of this individual is... The average positioning error is 3.60. The value is 1.03. The objective function value and the average positioning error are significantly better than the other four schemes.
[0167] Figure 13 The following are statistical charts showing the results of experiments conducted 500 times each using five different individual generation strategies, as presented in Tables 3, 4, and 5 below. Figure 13 In (a) and (b), the horizontal axis 1-500 represents 500 experiments, and the vertical axis represents two coordinates: the volume objective function and the average positioning error. Figure 13 The five colored lines represent individual indicator values generated by different strategies. Figure 13 (c) and (d) in the figure are box plot comparisons of the indicators of 500 experimental individuals.
[0168] Tables 1 and 2 compare the minimum, median, maximum, mean, and standard deviation of the objective function and average positioning error index for 500 groups of individuals with different strategies. The probability matrix three-point positioning + super individual generation strategy is significantly better than other strategies and has more stable performance.
[0169] Table 1 Objective functions of 500 groups of individuals with different strategies contrast
[0170]
[0171] Table 2. Average positioning error of 500 groups of individuals using different strategies contrast
[0172]
[0173] Preferably, the wireless sensor positioning method further includes the following steps: if a preset termination condition is not met, repeat the following steps until the preset termination condition is met: update the reduction coefficient according to the current evolutionary state, wherein the reduction coefficient is a control parameter that gradually decreases during the iteration process; based on the updated reduction coefficient, perform an individual position update operation on the current parent population to regenerate the offspring population; calculate the fitness value of each individual in the offspring population; determine a new optimal individual from the offspring population based on the fitness values of the individuals in the offspring population; compare the new optimal individual with the historical global optimal individual, and update the historical global optimal individual based on the comparison result; implement an elite retention strategy on the current parent population and offspring population, select a preset number of optimal individuals from the current parent population and offspring population based on the individual fitness values to form a new population, and use the new population as the parent population for the next iteration cycle.
[0174] Understandably, unless a preset termination condition is met (such as reaching the maximum number of iterations or the fitness value stabilizing), the algorithm will repeatedly execute specific steps to optimize individuals in the population. First, the dynamic adjustment of the decrease coefficient is crucial for balancing the algorithm's global and local search capabilities. A larger c value in the initial stage helps the algorithm quickly explore the search space, while a gradually decreasing c value in the later stages prompts the algorithm to focus on smaller regions for a more detailed search, aiming to find a better solution. Based on the updated decrease coefficient, an individual position update operation is performed on the current parent population. The update process adjusts the individual's position by calculating the relationship between individuals and other individuals, as well as their interactions within their comfort zones, while also reflecting the influence of control factors such as the number of iterations and the search space boundaries.
[0175] The fitness value of each individual in the offspring population can be calculated using formula (1) or a similar form. The contribution of each individual's coordinates to the objective function (e.g., mean squared error) is evaluated to determine which individuals are closer to the solution. Based on the fitness values of the individuals in the offspring population, the algorithm determines a new optimal individual. The optimal individual can be better than the historical optimal individual in terms of fitness, or it can simply be the best-performing individual in the current offspring population. The new optimal individual is compared with the historical global optimal individual. If the new optimal individual performs better on the objective function, it will be recorded as the new global optimal individual. This ensures that the optimal solution in the algorithm process is preserved and passed on, providing a reference point for future iterations.
[0176] Finally, an elite retention strategy is implemented. This involves selecting a predetermined number of optimal individuals from the current parent population and the newly generated offspring population. These individuals are chosen based on their fitness values to form a new population. This new population then becomes the parent population for the next iteration, while underperforming individuals are excluded, ensuring that the population maintains a high standard of individual quality throughout its evolution. The elite retention strategy helps maintain diversity within the population while ensuring that evolution moves towards a more optimal solution.
[0177] Optionally, the individual position update operation for the current parent population can be performed as follows: obtain the unified upper bound, unified lower bound, and reduction coefficient of the solution space; calculate the resultant force vector of social interaction for each individual based on the relative positional relationship between individuals in the current parent population, where the relative positional relationship includes the Euclidean distance and unit direction vector between individuals; multiply the resultant force vector of social interaction with the reduction coefficient to obtain the new position vector for each individual; compare each component of the new position vector with the unified upper and lower bounds of the solution space, and constrain the components that exceed the boundaries; combine the constrained new position vectors into a new offspring population.
[0178] It should be noted that during the iteration process, the algorithm calculates the social interaction vector of each individual based on the relative positional relationship between individuals (estimated coordinates of a set of target nodes) in the current parent population (which can be calculated using equations (24) to (26)). The calculation of the social interaction vector is essentially based on the individual's fitness and distance information to determine how the individual should adjust its position to get closer to the global optimum. After calculating the social interaction vector, the vector is multiplied by the decreasing coefficient to obtain the new position vector of each individual. After obtaining the new position vector, it is checked whether each component of the new position vector exceeds the defined unified upper and lower bounds of the solution space. If some coordinate components are found to exceed the specified boundaries, constraint measures are taken to ensure that all components of the new position vector are within the allowable range of the solution space. The constrained new position vector is transformed into new individual coordinates, and these individuals form a new offspring population.
[0179] Preferably, the individual position update operation can be performed on the current parent population using the following formula:
[0180]
[0181] It's worth explaining that GOA, as a heuristic optimization algorithm, primarily simulates the social activities of locusts. In GOA, candidate solutions to the optimization problem are abstracted into the positions of individual locusts. During their social activities, such as reproduction, foraging, migration, and gathering, the positions of individual locusts are mainly influenced by social forces among them. The force of gravity acting on the locust Wind power The influence of these three factors can be expressed using a mathematical model as follows:
[0182]
[0183] in, , , The expression is as follows:
[0184]
[0185] in, Population size; For the first The locust and the first The distance between locusts; The force function between locusts is shown in equation (27); It is the gravitational constant; It is a unit vector pointing towards the center of the Earth; It is the wind constant; This is a unit vector pointing to the wind force.
[0186]
[0187] in, This refers to the attraction intensity parameter; This is the scale parameter.
[0188] Substituting equations (24), (25), and (26) into equation (23) yields equation (28):
[0189]
[0190] However, while locusts can reach their comfort zone very quickly, they do not converge to a specific value. To address this issue, parameters are typically used to differentiate between different stages of optimization. In this case, the position update formula becomes Equation (29):
[0191]
[0192] in, , For the first A locust in Upper and lower bounds in 3D space; The optimal solution for the current location of the locusts; The decreasing coefficient is calculated using equation (30):
[0193]
[0194] in, , n are respectively The maximum and minimum values; This represents the current iteration number of the algorithm; This represents the maximum number of iterations for the algorithm.
[0195] For equation (29), population updates require calculating the relationship between each individual's decision variable and other individuals, which is computationally intensive and unsuitable for online production environments. Analyzing the characteristics of the node localization problem, the localization of target nodes is independent and does not affect each other. Therefore, it is not necessary to calculate the relationship between each decision variable; only the relationship between individuals needs to be calculated. This reduces one loop layer, significantly lowering the algorithm's time complexity and improving efficiency without compromising localization accuracy. In this application, equation (29) can be improved to equation (31):
[0196]
[0197] As described above, in the node localization problem of wireless sensor networks, this application proposes a population initialization strategy based on a probability distribution matrix to optimize the starting point of the localization solution and ensure the efficiency and accuracy of the algorithm. The core of this strategy lies in constructing a weight matrix based on the distance between the target node and all anchor nodes, where anchor nodes closer to the target node are assigned higher weights. Subsequently, by normalizing each row of the weight matrix, a probability distribution matrix of anchor node selection is obtained to reflect the importance of nearby anchor nodes in the localization process. When generating the initial coordinates of individuals, three anchor nodes are randomly selected using a roulette wheel mechanism based on the row probability distribution corresponding to each target node, and the coordinates of the target node are estimated using a triangulation algorithm, thus obtaining an initial population close to the optimal solution. This strategy effectively improves the algorithm's local search capability, reduces the risk of getting trapped in local optima, accelerates the convergence speed of the algorithm, and also improves the quality of the initial solution.
[0198] Furthermore, this application introduces a super-individual generation strategy, aiming to improve the retention efficiency of superior genes during population evolution and accelerate the convergence speed of the population. This strategy selects the coordinate values with the best localization performance by calculating the mean square error of each individual in the population when locating the coordinates of each target node. These optimal coordinate values are combined into a new individual, namely the super-individual, which represents the best localization performance of the current population. By incorporating super-individuals into the population, the loss of superior individual fragments during evolution is effectively prevented, ensuring that the algorithm can iterate rapidly and move closer to the optimal solution.
[0199] Finally, the population evolution strategy of the locust algorithm is optimized, and the computational mechanism for population updates is improved to address the characteristics of node localization in wireless sensor networks. The original locust optimization algorithm uses a comparison method for each decision variable during population updates, a process with enormous computational cost, making it unsuitable for the real-time requirements of online production environments. The improved strategy proposed in this application considers only the overall distance relationship between individuals, reducing computational layers and eliminating one loop, thereby significantly reducing the algorithm's time complexity and improving its efficiency. This improvement maintains positioning accuracy while significantly reducing computation time, making the algorithm more suitable for real-time localization tasks.
[0200] In summary, by employing a population initialization strategy based on the probability distribution matrix, a super-individual generation strategy, and an improved population evolution strategy, we not only improved the quality of the initial solution and enhanced the algorithm's local search capability, avoiding the loss of excellent genes, but also optimized the algorithm's efficiency. This allows the algorithm to better adapt to the real-time requirements of online production environments while ensuring positioning accuracy.
[0201] The following example, with 30 anchor nodes and 80 target nodes, illustrates the specific implementation of the wireless sensor localization method:
[0202] Number of anchor nodes The target number is 30, with specific coordinates shown in Table 3; the number of target nodes... The effective communication range of this wireless sensor network node is 80×30, and the target anchor node RSS ranging distance matrix is an 80×30 two-dimensional matrix (see Table 4). The value is 60. The above is all the information regarding the wireless sensor network node localization problem, used to calculate the estimated coordinates of 80 target nodes.
[0203] Table 5 shows the actual coordinates of the 80 target nodes, which are not used in the GOA algorithm but are only used to verify the performance after the algorithm runs.
[0204] Table 4 lists the target anchor node RSS ranging distance matrix that exceeds the effective communication radius. The distance is set to Table 6 shows the RSS ranging distance matrix of the anchor target nodes within the effective communication radius. .
[0205] The anchor node weight matrix in Table 7 is obtained by calculating Table 6 using Equation (9). .
[0206] The probability distribution matrix of anchor node selection in Table 8 is obtained by calculating Table 7 using Equation (11). .
[0207] Visualizing Table 4, we obtain... Figure 14 Target anchor node RSS ranging distance matrix; visualize Table 7 to obtain Figure 15 Anchor node weight matrix; visualize Table 8 to obtain Figure 16 Anchor node selection probability distribution matrix.
[0208] Population size Set to 50, maximum evolution generation With a value set to 1000, three algorithms—the nearest three-point localization method, GWO, and the improved GOA—were tested and compared to obtain the results. Figure 20 Convergence curves of objective functions for different algorithms and a comparison table of experimental results for different algorithms.
[0209] The improved GOA results in the comparison table of experimental results for different algorithms are plotted separately to obtain... Figure 22 The localization results of the improved GOA algorithm.
[0210] Will Figure 20 Substituting the curve into equation (6) and operating on Table 5, we obtain... Figure 21 Convergence curves of average positioning error for different algorithms.
[0211] Based on the anchor node coordinates in Table 3 and the target node real coordinates in Table 5, the real distance matrix between the target and anchor nodes can be calculated.
[0212] Visualize the true distance matrix between the target and anchor nodes to obtain Figure 17 The true distance matrix between target and anchor nodes.
[0213] Figure 14 , Figure 17 Subtracting, we get Figure 18 Target anchor node distance error matrix.
[0214] Figure 18 , Figure 17 Divide, and you get Figure 19 The target anchor node distance error rate matrix has an average error rate of 0.0389.
[0215] In summary, the experimental results of the improved GOA algorithm are superior in terms of both objective function and performance. Still in the average positioning error In all aspects, it outperforms other comparison algorithms.
[0216] Figure 20 The results show that the improved GOA algorithm converges very quickly, significantly outperforming other comparative algorithms both before and after population evolution.
[0217] Figure 21 Overall convergence trend of each algorithm and Figure 20 The results are consistent, but the GWO and improved GOA algorithms are not like... Figure 20 While it achieves absolute convergence, it exhibits local oscillations. Furthermore, the improved GOA algorithm reaches an inflection point in its early evolutionary stages. Instead of decreasing, it increased, which confirms... and The lowest points are not completely consistent and there is a slight deviation, which is caused by RSS ranging error.
[0218] Figure 22 The superiority of the improved GOA algorithm is intuitively demonstrated, with the estimated coordinates of all target nodes being very close to the actual coordinates, with almost no difference.
[0219] Table 3 Anchor Node Coordinates
[0220]
[0221] Table 4 Target Anchor Node RSS Ranging Distance Matrix
[0222]
[0223] Table 5. Actual coordinates of target nodes
[0224]
[0225] Table 6 Effective Communication Radius Anchor Target Node RSS Distance Matrix
[0226]
[0227] Table 7 Anchor Node Weight Matrix
[0228]
[0229] Table 8. Anchor Node Selection Probability Distribution Matrix
[0230]
[0231] Figure 23 This is a flowchart of another wireless sensor positioning method according to an embodiment of this application, such as... Figure 23 As shown, the method includes the following steps:
[0232] 1. Initialize parameters and read data: Determine the population size and maximum number of generations; read anchor node coordinate data; read target anchor node distance matrix data; load the model and ensure that all distances beyond the effective communication radius are marked as infinity to prevent these invalid distances from affecting positioning.
[0233] 2. Calculate the anchor node selection probability distribution matrix: Calculate the weight matrix based on the distance between the target node and all anchor nodes, and obtain the anchor node selection probability distribution matrix through normalization.
[0234] 3. Population initialization based on probability distribution matrix: Using a roulette wheel selection mechanism, three anchor nodes are randomly selected for each target node based on the probability distribution matrix of anchor node selection to perform three-point positioning and generate the initial coordinates of each individual in the population.
[0235] 4. Calculate population fitness: For each individual in the population, calculate its objective function value, which is the average of the mean square error of the estimated coordinates of all target nodes and the measured distances of the anchor nodes.
[0236] 5. Generate a super individual: Analyze the localization performance of each individual in the population. For each target node, select the coordinates with the best localization performance, and then combine these coordinates into a super individual. This individual represents the best localization result of the current population.
[0237] 6. Population Update: Incorporate super individuals into the current population. This strategy can prevent the loss of superior genes during population evolution and accelerate the search for the optimal solution.
[0238] 7. Population Evolution: The improved population update rule, i.e., the locust optimization algorithm formula shown in Equation (30), is used to perform iterative evolution of the population. The evolution process will be adjusted according to the decrease coefficient c to balance the global and local search. During the evolution process, offspring populations are generated, the fitness of the offspring populations is evaluated, and individuals with higher fitness are selected as the next generation population through an elite strategy to retain high-quality solutions and ensure the convergence of the algorithm.
[0239] 8. Iterative Control: The population evolution process is executed iteratively until the maximum number of generations is reached. In each iteration, the decay coefficient is updated to adjust the search range and speed of the population.
[0240] 9. Output the optimal solution: After reaching the maximum number of generations, output the best individual in the current population, which contains the optimal estimated coordinates of all target nodes.
[0241] Figure 23 The steps shown can also be represented in the following form.
[0242]
[0243] In the above embodiments of this application, the information collected is information and data authorized by the user or fully authorized by all parties, and the collection, storage, use, processing, transmission, provision, disclosure and application of the relevant data all comply with relevant laws, regulations and standards, take necessary protective measures, do not violate public order and good morals, and provide corresponding operation entry points for users to choose to authorize or refuse.
[0244] In the several embodiments provided in this application, it should be understood that the disclosed technical content can be implemented in other ways. The device embodiments described above are merely illustrative; for example, the division of units can be a logical functional division, and in actual implementation, there may be other division methods. For instance, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the displayed or discussed mutual coupling, direct coupling, or communication connection may be through some interfaces; the indirect coupling or communication connection between units or modules may be electrical or other forms.
[0245] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.
[0246] Furthermore, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.
[0247] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to related technologies, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, read-only memory (ROM), random access memory (RAM), portable hard drives, magnetic disks, or optical disks.
[0248] The above description is only a preferred embodiment of this application. It should be noted that for those skilled in the art, several improvements and modifications can be made without departing from the principle of this application, and these improvements and modifications should also be considered within the scope of protection of this application.
Claims
1. A positioning method for a wireless sensor, characterized in that, include: A weight matrix is determined based on the measured distance between target nodes and anchor nodes in a wireless sensor network. The anchor node represents a wireless sensor with known coordinates, and the target node represents a wireless sensor to be located that has a communication connection with the anchor node. The rows of the weight matrix represent the weight coefficients between the same target node and different anchor nodes, and the weight coefficients are negatively correlated with the measured distance. The probability distribution matrix is determined based on the ratio of the element values in the weight matrix to the target summation result, wherein the target summation result is the summation result of all element values in the row where the element value is located, and the rows of the probability distribution matrix are used to represent the probability that different anchor nodes are selected by the same target node; For each individual in the population in the locust optimization algorithm, the following process is repeated multiple times to obtain the initial population: For each target node in the probability distribution matrix, three anchor nodes are selected in the probability distribution matrix by roulette wheel, and three-point positioning is performed based on the real coordinates of the three anchor nodes to obtain the initial coordinates of each target node, wherein each individual includes the initial coordinates of all target nodes; For each target node, the optimal coordinate with the smallest error value is determined from the initial coordinates of all individuals to obtain the optimal coordinates of all target nodes. Based on the optimal coordinates of all target nodes, an optimal individual is generated. The optimal individual is used to replace any individual in the initial population to obtain a new population. The new population is iterated, evolved, and updated. When a preset termination condition is met, the predicted coordinates of the target nodes are output, and the position of the target node in the wireless sensor network is determined based on the predicted coordinates.
2. The method according to claim 1, characterized in that, The weight matrix is determined based on the measured distance between the target node and the anchor node in the wireless sensor network, including: A distance matrix is determined based on the measured distance between the target node and the anchor node, wherein the rows of the distance matrix are used to represent the measured distance between the same target node and different anchor nodes; In the distance matrix, determine the minimum value in each row; Based on the ratio of the minimum value in the i-th row to the values of each element in the i-th row, the target element value of each element in the i-th row is determined, and the target element value of each element in the N-th row is obtained, where i is a positive integer not greater than N, N is the number of target nodes, and N is a positive integer greater than 1. The weight matrix is determined based on the target element values of each element in the N rows.
3. The method according to claim 1, characterized in that, Three anchor nodes are selected from the probability distribution matrix by roulette wheel selection, and three-point positioning is performed based on the true coordinates of the three anchor nodes to obtain the initial coordinates of each target node, including: In the probability distribution matrix, the element in the i-th row is selected, where i is a positive integer not greater than N, N is the number of target nodes, and N is a positive integer greater than 1; In the i-th row of elements, three anchor nodes are selected by roulette wheel selection; Obtain the actual coordinates of the three anchor nodes; Using a three-point positioning algorithm, the actual coordinates of the three anchor nodes are processed to obtain the initial coordinates of the i-th target node.
4. The method according to claim 3, characterized in that, In the i-th row of elements, three anchor nodes are selected by roulette wheel selection, including: Determine the fitness function, and calculate the fitness value of each anchor node in the i-th row based on the fitness function; The fitness values are normalized to obtain the selection probability value of each anchor node; Based on the selection probability value of each anchor node, a continuous probability interval is constructed, and a corresponding sub-interval is assigned to each anchor node within the continuous probability interval; Generate three random numbers, wherein each of the random numbers falls within the target position of the continuous probability interval; The anchor nodes associated with the sub-intervals corresponding to the target positions where the three random numbers fall are determined as the three anchor nodes.
5. The method according to claim 4, characterized in that, Determine the fitness function, including: The fitness function is determined based on the mean square error of the first distance and the second distance, wherein the first distance is the measured distance between the target node and the anchor node, and the second distance is the distance between the estimated coordinates of the target node and the true coordinates of the anchor node.
6. The method according to claim 3, characterized in that, The actual coordinates of the three anchor nodes are processed to obtain the initial coordinates of the i-th target node, including: Based on the true coordinates of the three anchor nodes, a set of geometric constraint equations is established with the target node coordinates of the i-th target node as unknowns. Transform the geometric constraint equations into the target matrix; Perform matrix operations on the target matrix to obtain the initial coordinates of the i-th target node.
7. The method according to claim 1, characterized in that, The method further includes: if the preset termination condition is not met, repeating the following steps until the preset termination condition is met: The reduction coefficient is updated based on the current evolutionary state, wherein the reduction coefficient is a control parameter that gradually decreases during the iteration process; Based on the updated decrease coefficient, perform an individual position update operation on the current parent population and regenerate the offspring population; Calculate the fitness value of each individual in the offspring population; Based on the fitness values of individuals in the offspring population, a new optimal individual is determined from the offspring population; The new optimal individual is compared with the historical global optimal individual, and the historical global optimal individual is updated based on the comparison result; An elite retention strategy is implemented for the current parent population and the offspring population. Based on the fitness value of each individual, a preset number of optimal individuals are selected from the current parent population and the offspring population to form a new population, and the new population is used as the parent population for the next iteration.
8. The method according to claim 7, characterized in that, Perform individual position update operations on the current parent population, including: Obtain the unified upper bound of the solution space, the unified lower bound of the solution space, and the decreasing coefficient; Based on the relative positional relationships between individuals in the current parent population, the resultant force vector of social interactions experienced by each individual is calculated, wherein the relative positional relationships include the Euclidean distance and the unit direction vector between individuals; Multiplying the resultant vector of social interactions with the decreasing coefficient yields a new position vector for each individual; Each component of the new position vector is compared with the unified upper bound and the unified lower bound of the solution space, and the components that exceed the boundaries are constrained. The constrained new position vectors are combined to form a new offspring population.
9. The method according to claim 1, characterized in that, For each target node, the optimal coordinate with the smallest error value is determined from the initial coordinates of all individuals to obtain the optimal coordinates of all target nodes, including: Based on the initial coordinates of each target node and the actual coordinates of the anchor node, determine the initial distance between each target node and the anchor node; Calculate the error value between the initial distance and the target measured distance, wherein the target measured distance is the measured distance between the target node and the anchor node; For each target node, among the initial coordinates of all individuals, the optimal coordinates that minimize the error value are determined to obtain the optimal coordinates of all target nodes.