腾讯云 门户网站建设,贵州做网站的,网站建设应遵守的原则,京东网站的建设目的目录
#x1f4a5;1 概述
#x1f4da;2 运行结果
#x1f389;3 参考文献
#x1f468;#x1f4bb;4 Matlab代码 #x1f4a5;1 概述
A*#xff08;念做#xff1a;A Star#xff09;算法是一种很常用的路径查找和图形遍历算法。它有较好的性能和准确度。本文… 目录
1 概述
2 运行结果
3 参考文献
4 Matlab代码 1 概述
A*念做A Star算法是一种很常用的路径查找和图形遍历算法。它有较好的性能和准确度。本文使用 A* 搜索算法来优化无线传感器节点网络的平均电池寿命。 2 运行结果 主函数部分代码
close all;
clear;
clc;
%-------------------------------
%Number of Nodes in the fieldn200;
%ninput(Enter the number of nodes in the space : );
%Energy Model (all values in Joules)
%Initial Energy
Eo0.1;
%Eoinput(Enter the initial energy of sensor nJ : );
%Field Dimensions - x and y maximum (in meters)
% xminput(Enter x value for area plot : );
% yminput(Enter y value for area plot : );
xm100;
ym100;
%x and y Coordinates of the Sink
sink.x1.5*xm;
sink.y0.5*ym;
%Optimal Election Probability of a node
%to become cluster head
p0.2;
%EelecEtxErx
ETX50*0.000000001;
ERX50*0.000000001;
%Transmit Amplifier types
Efs10*0.000000000001;
Emp0.0013*0.000000000001;
%Data Aggregation Energy
EDA5*0.000000001;
%Values for Hetereogeneity
%Percentage of nodes than are advanced
m0.5;
%\alpha
a1;
%maximum number of rounds
%rmaxinput(enter the number of iterations you want to run : );
rmax200;
%------------------
%Computation of do
dosqrt(Efs/Emp);
%Creation of the random Sensor Network
figure(1);
hold off;
for i1:1:nS(i).xdrand(1,1)*xm;XR(i)S(i).xd;S(i).ydrand(1,1)*ym;YR(i)S(i).yd;S(i).G0;%initially there are no cluster heads only nodesS(i).typeN;temp_rnd0i;%Random Election of Normal Nodesif (temp_rnd0m*n1) S(i).EEo;S(i).ENERGY0;plot(S(i).xd,S(i).yd,o-r);hold on;end%Random Election of Advanced Nodesif (temp_rnd0m*n1) S(i).EEo*(1a);S(i).ENERGY1;plot(S(i).xd,S(i).yd,);hold on;end
end
S(n1).xdsink.x;
S(n1).ydsink.y;
plot(S(n1).xd,S(n1).yd,o, MarkerSize, 12, MarkerFaceColor, r);
figure(1);
% figure(1)
% plot(o1,o2,^,LineWidth,1, MarkerEdgeColor,k, MarkerFaceColor,y, MarkerSize,12);
% hold on
%First Iteration
%counter for CHs
countCHs0;
%counter for CHs per round
rcountCHs0;
cluster1;
countCHs;
rcountCHsrcountCHscountCHs;
flag_first_dead0;
for r0:1:rmaxr;
%Operation for epochif(mod(r, round(1/p) )0)for i1:1:nS(i).G0;S(i).cl0;endend
3 参考文献
[1]梁艺凡,谭丽,冯挺.A~*进路搜索算法的研究与实现[J].铁道标准设计,2013,No.613(02):117-119127.
部分理论引用网络文献若有侵权联系博主删除。