Intelligent optimization algorithm application: 3D wireless sensor network (WSN) coverage optimization based on atomic search algorithm - code attached
Article directory
Abstract: This article mainly introduces how to use the atomic search algorithm to optimize 3D wireless sensor network (WSN) coverage.
1. Wireless sensor network node model
This article is mainly based on the 0/1 model for optimization. The sensing range of a sensor node on a two-dimensional plane is a circle with the node as the center and a radius of R n R_n RnThe circular area of is often called the "perception disk" of the node, R n R_n Rn is called the sensing radius of the sensor node. The sensing radius is related to the physical characteristics of the built-in sensor device of the node. Assume that the node n n n的LOCATION ( x n , y n , z n ) (x_n,y_n,z_n) (xn,andn,Withn)In the 0-1 perception model, for any point on the plane p ( x p , y p , z p ) p(x_p,y_p ,z_p) p(xp,andp,Withp),different points n n nPoints in the area monitored p p The event probability of p is:
P r ( n , p ) = { 1 , d ( n , p ) ≤ R n 0 , e s l e (1) P_r(n,p)=\begin{cases}1, \,d(n,p)\leq R_n\\ 0,\, esle \end{cases}\tag{1} Pr(n,p)={
1,d(n,p)≤Rn0,esle(1)
inside d ( n , p ) = ( x n − x p ) 2 + ( y n − y p ) 2 + ( z n − z p ) 2 d(n,p)=\sqrt{(x_n-x_p)^2+(y_n-y_p)^2 + (z_n -z_p)^2} d(n,p)=(xn−xp)2+(yn−andp)2+(zn−Withp)2is the Euclidean distance between points and .
2. Cover mathematical models and analysis
Now assume that the target monitoring area is a two-dimensional plane, in area A r e a Area The number of sensor nodes with the same type of structure placed on Area is N, and the number of each node The position coordinate value is assumed to have been initialized and assigned, and the node's sensing radius r. The sensor node set is expressed as:
N o d e { x 1 , . . . , x N } (2) Node\{x_1,...,x_N\} \tag{2} < /span>Node{
x1,...,xN}(2)
其中 n o d e i = { x i , y i , z i , r } node_i=\{x_i,y_i,z_i,r\} nodei={
xi,andi,Withi,r},Display point ( x i , y i , z i ) (x_i,y_i, z_i)(xi,andi,Withi) is the center of the circle, r is the sphere with monitoring radius, assuming the monitoring area A r e a Area Areadigitization separation m ∗ n ∗ l m*n*l m∗n∗l space points, the coordinates of the space points are ( x , y , z ) (x,y,z) (x,y,z),Distance between the target point and the sensor point:
d ( n o d e i , p ) = ( x i − x ) 2 + ( y i − y ) 2 + ( z i − z ) 2 (3) d(node_i,p)=\sqrt{(x_i-x)^2+(y_i-y)^2 + (z_i-z)^2}\tag{3} d(nodei,p)=(xi−x)2+(yi−y)2+(zi−z)2(3)
The event that a point in the target area is covered by a sensor node is defined as a> c i c_i ci. Then the probability of the event occurring P c i P{c_i} PciImmediate point ( x , y , z ) (x,y,z) (x,y,z)affected sensor point n o d e i node_i nodei所覆盖的概率:
P c o v ( x , y , z , n o d e i ) = { 1 , i f d ( n o d e i , p ) ≤ r 0 , e s l e (4) P_{cov}(x,y,z,node_i)=\begin{cases}1, if\,d(node_i,p)\leq r\\ 0,\, esle \end{cases}\tag{4} Pwhatin(x,y,z,nodei)={
1,ifd(nodei,p)≤r0,esle(4)
We compare the regional coverage of all sensor nodes in the target monitoring environment C o v e r R a t i o CoverRatio CoverR atiodefined义为@Sensor experience collection CoverRatio = \frac{\sum P_{cov }}{m*n*l}\tag{5}
CoverR atio=m∗n∗l∑Pwhatin(5)
Then our ultimate goal is to find a group of nodes that maximizes coverage.
3. Atomic search algorithm
For the principle of atomic search algorithm, please refer to: https://blog.csdn.net/u011835903/article/details/112909360
The atomic search algorithm is to find the minimum value. Then the fitness function is defined as the minimum uncovered ratio, that is, the maximum coverage ratio. As follows:
f u n = a r g m i n ( 1 − C o v e r R a t i o ) = a r g m i n ( 1 − ∑ P c o v m ∗ n ∗ l ) (6) fun = argmin(1 - CoverRatio) = argmin(1 -\frac{\sum P_{cov}}{m*n*l}) \tag{6} fun=argmin(1−CoverR atio)=argmin(1−m∗n∗l∑Pwhatin)(6)
4. Experimental parameter setting
The wireless sensor coverage parameters are set as follows:
%% 设定WNS覆盖参数,
%% 默认输入参数都是整数,如果想定义小数,请自行乘以系数变为整数再做转换。
%% 比如范围1*1,R=0.03可以转换为100*100,R=3;
%区域范围为AreaX*AreaY*AreaZ
AreaX = 100;
AreaY = 100;
AreaZ = 100;
N = 20 ;%覆盖节点数
R = 15;%通信半径
The parameters of the atomic search algorithm are as follows:
%% 设定原子搜索优化参数
pop=30; % 种群数量
Max_iteration=30; %设定最大迭代次数
lb = ones(1,3*N);
ub = [AreaX.*ones(1,N),AreaY.*ones(1,N),AreaZ.*ones(1,N)];
dim = 3*N;%维度为3N,N个坐标点
5. Algorithm results
Judging from the results, the coverage rate continues to increase during the optimization process. It shows that the atomic search algorithm plays an optimization role in coverage optimization.
6. References
[1] Shi Chaoya. Research on wireless sensor network coverage optimization based on PSO algorithm [D]. Nanjing University of Science and Technology.