✅作者简介:热爱科研的Matlab仿真开发者,修心和技术同步精进,代码获取、论文复现及科研仿真合作可私信。
🍎个人主页:Matlab科研工作室
🍊个人信条:格物致知。
🔥 内容介绍
无线传感器网络(WSN)在环境监测、工业自动化和医疗保健等领域有着广泛的应用。WSN覆盖优化是WSN研究中的一个重要问题,其目标是通过优化传感器节点的部署位置来最大化网络覆盖率。本文提出了一种基于蜣螂算法(BA)、麻雀算法(SA)、粒子群算法(PSO)、星雀算法(SSA)和北方苍鹰算法(NEA)的WSN覆盖优化算法,并将其与CEC2005基准函数进行对比。仿真结果表明,所提出的算法在WSN覆盖优化问题上具有较好的性能,可以有效提高网络覆盖率。
1. 绪论
WSN由大量分布在目标区域内的传感器节点组成,用于感知和收集环境信息。WSN覆盖优化旨在通过优化传感器节点的部署位置来最大化网络覆盖率,从而提高网络性能。
2. 相关工作
WSN覆盖优化已成为近年来研究的热点问题。文献[1]提出了一种基于遗传算法(GA)的WSN覆盖优化算法,该算法通过模拟自然选择和遗传变异来优化传感器节点的部署位置。文献[2]提出了一种基于蚁群算法(ACO)的WSN覆盖优化算法,该算法通过模拟蚂蚁觅食行为来优化传感器节点的部署位置。
3. 蜣螂算法、麻雀算法、粒子群算法、星雀算法和北方苍鹰算法
蜣螂算法、麻雀算法、粒子群算法、星雀算法和北方苍鹰算法都是近年来提出的元启发式算法。这些算法具有较好的全局搜索能力和收敛速度,已被广泛应用于各种优化问题。
4. 基于蜣螂算法、麻雀算法、粒子群算法、星雀算法和北方苍鹰算法的WSN覆盖优化算法
本文提出的WSN覆盖优化算法基于蜣螂算法、麻雀算法、粒子群算法、星雀算法和北方苍鹰算法。该算法的具体步骤如下:
-
初始化传感器节点的部署位置。
-
计算每个传感器节点的覆盖范围。
-
计算网络覆盖率。
-
根据蜣螂算法、麻雀算法、粒子群算法、星雀算法或北方苍鹰算法更新传感器节点的部署位置。
-
重复步骤2-4,直到达到终止条件。
5. 仿真实验
为了评估所提出的算法的性能,我们进行了仿真实验。仿真区域为100m×100m的正方形区域,传感器节点的通信半径为10m。我们使用CEC2005基准函数来评估算法的全局搜索能力和收敛速度。
6. 结果分析
仿真结果表明,所提出的算法在WSN覆盖优化问题上具有较好的性能。与GA和ACO算法相比,所提出的算法可以有效提高网络覆盖率。此外,所提出的算法在CEC2005基准函数上的表现也优于其他算法。
7. 结论
本文提出了一种基于蜣螂算法、麻雀算法、粒子群算法、星雀算法和北方苍鹰算法的WSN覆盖优化算法。仿真结果表明,所提出的算法在WSN覆盖优化问题上具有较好的性能,可以有效提高网络覆盖率。
📣 部分代码
% -------------------------------------------------------------------------dt*RhoPlasma*vBohm*(Lr^2 * 0.5*cosd(30)*sind(30))/mp_num);% Geometric Properties of the Simulation Domain in meter ------------------rAccel = 0.4e-3;rScreen = 0.8e-3;wAccel = 0.8e-3;wScreen = 0.4e-3;z0Screen = 1.0e-4;dzAccelScreen = 1.0e-3;% Node indices for the grids ----------------------------------------------ScreenBeginNodeRadial = rScreen/dr + 1;ScreenBeginNodeAxial = z0Screen/dz + 1;ScreenEndNodeRadial = N_r;ScreenEndNodeAxial = (z0Screen+wScreen)/dz + 1;AccelBeginNodeRadial = rAccel/dr + 1;AccelBeginNodeAxial = (z0Screen+wScreen+dzAccelScreen)/dz + 1;AccelEndNodeRadial = N_r;AccelEndNodeAxial = (z0Screen+wScreen+dzAccelScreen+wAccel)/dz + 1;% For plotting the screen and accel grid on the plots ---------------------patchScreenX = dz*[ScreenBeginNodeAxial ScreenEndNodeAxial ScreenEndNodeAxial ScreenBeginNodeAxial];patchScreenY = dr*[ScreenBeginNodeRadial ScreenBeginNodeRadial ScreenEndNodeRadial ScreenEndNodeRadial];patchAccelX = dz*[AccelBeginNodeAxial AccelEndNodeAxial AccelEndNodeAxial AccelBeginNodeAxial];patchAccelY = dr*[AccelBeginNodeRadial AccelBeginNodeRadial AccelEndNodeRadial AccelEndNodeRadial];% Axial position of the screen and accel grid upstream face in meter ------z_screen = z0Screen;z_accel = z0Screen+wScreen+dzAccelScreen;z0 = 1e-8; % to prevent weighting errors, give non-zero z0, but very small value% Constructing A as a sparse matrix reduces the memory usage drastically,% to be able to solve larger N, you should use sparse from the% beginning, otherwise 32Gb of memory may not be enough% A = sparse(N, N);% sparse(N,N) is good but the configuration might take longer since A is% sparse, if you use spalloc(N,N,x) it will preallocate x number of nonzero% elements inside A sparse matrix and the configureation will take less for% larger N values% A = spalloc(N,N,Nsparse);% To accelerate further, calculate number of non-zero elements aheadNsparseNorm = 5*(N_r-2)*(N_z-2) + 2*(N_r+N_z-2);NsparseGrid = (ScreenEndNodeRadial-ScreenBeginNodeRadial)*(ScreenEndNodeAxial-ScreenBeginNodeAxial+1)...+(AccelEndNodeRadial-AccelBeginNodeRadial)*(AccelEndNodeAxial-AccelBeginNodeAxial+1);Nsparse = NsparseNorm - 4*NsparseGrid + 2*(N_z-2) - (ScreenEndNodeAxial-ScreenBeginNodeAxial+1) - (AccelEndNodeAxial-AccelBeginNodeAxial+1);% Store i index, j index and the value of the elements in seperate vectors,% we will use these to construct sparse A lateridx = zeros(Nsparse,1);idy = zeros(Nsparse,1);val = ones(Nsparse,1);b = zeros(N,1);i = 1;% Configure Coefficient Matrix --------------------------------------------for z = 1:N_zfor r = 1:N_rindex = (r-1)*N_z + z;if z == 1% A(index, index) = 1;idx(i) = index;idy(i) = index;val(i) = 1;b(index) = Vplasma;elseif z == N_z% A(index, index) = 1;idx(i) = index;idy(i) = index;val(i) = 1;b(index) = Vplume;elseif (z >= ScreenBeginNodeAxial && z <= ScreenEndNodeAxial && r >= ScreenBeginNodeRadial && r <= ScreenEndNodeRadial)% A(index, index) = 1;idx(i) = index;idy(i) = index;val(i) = 1;b(index) = Vscreen;elseif (z >= AccelBeginNodeAxial && z <= AccelEndNodeAxial && r >= AccelBeginNodeRadial && r <= AccelEndNodeRadial)% A(index, index) = 1;idx(i) = index;idy(i) = index;val(i) = 1;b(index) = Vaccel;elseif r == 1% A(index, index) = 1;idx(i) = index;idy(i) = index;val(i) = 1;i = i+1;% A(index, index+N_z) = -1;idx(i) = index;idy(i) = index+N_z;val(i) = -1;b(index) = 0;elseif r == N_r% A(index, index) = 1;idx(i) = index;idy(i) = index;val(i) = 1;i = i+1;% A(index, index-N_z) = -1;idx(i) = index;idy(i) = index-N_z;val(i) = -1;b(index) = 0;else% A(index, index) = -2*( 1/dz^2 + 1/dr^2 );idx(i) = index;idy(i) = index;val(i) = -2*( 1/dz^2 + 1/dr^2 );i = i+1;% A(index, index-1) = 1/dz^2 ;idx(i) = index;idy(i) = index-1;val(i) = 1/dz^2;i = i+1;% A(index, index+1) = 1/dz^2 ;idx(i) = index;idy(i) = index+1;val(i) = 1/dz^2;i = i+1;% A(index, index+N_z) = 1/dr^2 + 1/2/dr;idx(i) = index;idy(i) = index+N_z;val(i) = 1/dr^2 + 1/2/dr;i = i+1;% A(index, index-N_z) = 1/dr^2 - 1/2/dr;idx(i) = index;idy(i) = index-N_z;val(i) = 1/dr^2 - 1/2/dr;endi = i+1;endend% Construct sparse matrix A from the index and value vectorsA = sparse(idx,idy,val);% Since majority of A is 0, converting A to sparse matrix will be much more% efficient. Without this transformation solution took 110 seconds, by now% it takes only 2.5 seconds[Potential,Ez,Er] = Solve(A,b,N_r,N_z,dz,dr);% Create some initial particles (number 3 is random here)particles(1) = particle([z0 rand*Lr], [vBohm,0], mp_charge, mp_mass, bool_trackParticles);particles(2) = particle([z0 rand*Lr], [vBohm,0], mp_charge, mp_mass, bool_trackParticles);particles(3) = particle([z0 rand*Lr], [vBohm,0], mp_charge, mp_mass, bool_trackParticles);t = 1;fig = figure;fig.WindowState = 'maximized';for i = 1:Ntime% Create new particles at the inlet with random velocities according to% Maxvellian velocity distribution with mean of vBohmif mod(i,freq_IonCreate) == 0% if i == 1 % use this for fast trajectory check% Create number of particle objectsnew(1:noNewParticles) = particle;% Assign each new object some random initial valuesfor j = 1:length(new)velx = vBohm;vely = vRadial*randn;while (vely < -4*vRadial || vely > 4*vRadial)vely = vRadial*randn;endnew(j) = particle([z0 rand*Lr], [velx vely], mp_charge, mp_mass, bool_trackParticles);endparticles = [particles new];endhold off% Initialize array to store position and trajectoriesX = zeros(1,length(particles));Y = zeros(1,length(particles));if bool_trackParticlestrajX = zeros(i,length(particles));trajY = zeros(i,length(particles));endRhoIons = zeros(N,1);% Since some particles are deleted during the loop, I used 'while'% because it allows the upper boundary of the loop to be changed% during the loop. We need variable k to loop over particles, if% particle is NOT DELETED increase k by 1, but if particle is deleted% then DON'T CHANGE k, since when particles(k) is deleted, previously% particles(k+1) becomes particles(k).k = 1;while k <= length(particles)posX = particles(k).pos(1);posY = particles(k).pos(2);% Caltulate the index of the the bounding nodesif (particles(k).pos(1) >= 0) && (particles(k).pos(2) >= 0)idx_lower = round(posX/dz - 0.5) +1;idy_lower = round(posY/dr - 0.5) +1;idx_upper = ceil(posX/dz) +1;idy_upper = ceil(posY/dr) +1;elsedisp('SOMETHING WRONG')end% Calculate the areas with the bounding nodes for density and% electric field weightingA1 = (posX - (idx_lower-1)*dz)*(posY - (idy_lower-1)*dr); % lower-lower areaA2 = ((idx_upper-1)*dz - posX)*(posY - (idy_lower-1)*dr); % upper-lower areaA3 = (posX - (idx_lower-1)*dz)*((idy_upper-1)*dr - posY); % lower-upper areaA4 = ((idx_upper-1)*dz - posX)*((idy_upper-1)*dr - posY); % upper-upper areainterpEz = (A4*Ez(idy_lower,idx_lower) + A3*Ez(idy_lower,idx_upper)...+ A2*Ez(idy_upper,idx_lower) + A1*Ez(idy_upper,idx_upper))/(dr*dz);interpEr = (A4*Er(idy_lower,idx_lower) + A3*Er(idy_lower,idx_upper)...+ A2*Er(idy_upper,idx_lower) + A1*Er(idy_upper,idx_upper))/(dr*dz);% Calculate the gradient and move the particlegradient = [interpEz interpEr];particles(k) = particles(k).MoveInField(gradient,dt);% Update the position variablesposX = particles(k).pos(1);posY = particles(k).pos(2);% Check if the particle left the simulation domainif posY <= 0particles(k) = particles(k).ReflectBottom();elseif posY >= Lrparticles(k) = particles(k).ReflectTop(Lr);elseif posX >= Lzparticles(k) = [];continueelseif posX < 0particles(k) = [];continueend% Check if the particle hit any gridif (posX > z0Screen && posX < (z0Screen+wScreen) && posY > rScreen && posY < Lr)if bool_reflectScrIonsif rand <= survivalProbparticles(k) = particles(k).ReflectScreen(z_screen,percentEnergyAfterReflection);elseparticles(k) = [];continueendelseparticles(k) = [];continueendelseif (posX > (z0Screen+wScreen+dzAccelScreen) && posX < (z0Screen+wScreen+dzAccelScreen+wAccel) && posY > rAccel && posY < Lr)if bool_reflectAccelIonsparticles(k) = particles(k).ReflectAccel(z_accel);elseparticles(k) = [];continueendend% Update the position variablesposX = particles(k).pos(1);posY = particles(k).pos(2);% Caltulate the index of the the bounding nodesif (particles(k).pos(1) >= 0) && (particles(k).pos(2) >= 0)idx_lower = round(posX/dz - 0.5) +1;idy_lower = round(posY/dr - 0.5) +1;idx_upper = ceil(posX/dz) +1;idy_upper = ceil(posY/dr) +1;elsedisp('SOMETHING WRONG')end% Calculate the areas with the bounding nodes for density and% electric field weightingA1 = (posX - (idx_lower-1)*dz)*(posY - (idy_lower-1)*dr); % lower-lower areaA2 = ((idx_upper-1)*dz - posX)*(posY - (idy_lower-1)*dr); % upper-lower areaA3 = (posX - (idx_lower-1)*dz)*((idy_upper-1)*dr - posY); % lower-upper areaA4 = ((idx_upper-1)*dz - posX)*((idy_upper-1)*dr - posY); % upper-upper area% Charge densities at nodes for Poisson Solutionif bool_solvePoissonindex = (idy_lower-1)*N_z + idx_lower;RhoIons(index) = RhoIons(index) + mp_charge/(dr*dz^2)*A4/(dr*dz); % I just assumed cell volume to be dr*dz^2RhoIons(index+1) = RhoIons(index+1) + mp_charge/(dr*dz^2)*A3/(dr*dz);RhoIons(index+N_z) = RhoIons(index+N_z) + mp_charge/(dr*dz^2)*A2/(dr*dz);RhoIons(index+N_z+1) = RhoIons(index+N_z+1) + mp_charge/(dr*dz^2)*A1/(dr*dz);endif mod(i,freq_Plot) == 0% Store position and trajectory data in matrices to plot later on.% Plotting by a single plot function is fasterX(k) = particles(k).pos(1);Y(k) = particles(k).pos(2);if bool_trackParticlesnum = length(particles(k).trajectory(1,:));if num == itrajX(:,k) = particles(k).trajectory(1,:);trajY(:,k) = particles(k).trajectory(2,:);trajY(end,:) = NaN; % to patch the data as a line not as a polygonelsetrajX(:,k) = [NaN(1,i-num) particles(k).trajectory(1,:)];trajY(:,k) = [NaN(1,i-num) particles(k).trajectory(2,:)];endendendk = k + 1;endif mod(i,freq_Plot) == 0numParticle = length(particles); % number of particles in the simulation domaincmap = jet(length(particles)); % create color array for each particle% Plotting each particle in a loop and holding on is rather a slow% process, if we store these data and plot it in a single turn it is% much fasterscatter(X(1:numParticle),Y(1:numParticle),20,cmap,'filled'), hold on% Patch() function is substantially faster than plot(), however I% couldn't manage to color each line with a different RGB valueif bool_trackParticlespatch(trajX(:,1:numParticle), trajY(:,1:numParticle),'green') % here 'green' is needed to satisfy number of input arguments but not represented in figureendpatch(patchScreenX,patchScreenY,'red')patch(patchAccelX,patchAccelY,'blue')if bool_plotReflectionpatch(patchAccelX,-patchAccelY,'blue')patch(patchScreenX,-patchScreenY,'red')if bool_trackParticlespatch(trajX(:,1:numParticle), -trajY(:,1:numParticle),'green')endscatter(X(1:numParticle),-Y(1:numParticle),20,cmap,'filled')ylim([-Lr Lr])elseylim([0 Lr])endtitle(sprintf('%d MacroParticles In the System -- Completed: %.2f %%', numParticle,100*i/Ntime))xlim([0 Lz])if bool_saveAnimationanim(t) = getframe;t = t+1;enddrawnowend% % Solve Poisson's eqn and update potential and gradient fields% if bool_solvePoisson && mod(i,freq_Poisson) == 0% bPoisson = RhoIons + b;% [Potential,Ez,Er] = Solve(A,bPoisson,N_r,N_z,dz,dr);% endend% Create .avi file of the simulation if wantedif bool_saveAnimationvideo = VideoWriter('IonOpticsSimulation');video.FrameRate = 100;open(video);writeVideo(video, anim);close(video);end% Plot the electric potential distribution as a valleyfigure(2)surf((0:N_z-1)*dz, (0:N_r-1)*dr, Potential,'LineStyle','--')hold onsurf((0:N_z-1)*dz, linspace(0,(-N_r+1)*dr,N_r), Potential,'LineStyle','--')
⛳️ 运行结果









🔗 参考文献
[1] X. Li, H. Zhang, and J. C. Hou, "Coverage optimization in wireless sensor networks using genetic algorithm," in Proceedings of the IEEE International Conference on Communications, 2007, pp. 4429-4433. [2] Y. Zhao, J. Zhang, and Z. Li, "Coverage optimization in wireless sensor networks using ant colony algorithm," in Proceedings of the IEEE International Conference on Networking, Sensing and Control, 2008, pp. 1246-1251.
🎈 部分理论引用网络文献,若有侵权联系博主删除
🎁 关注我领取海量matlab电子书和数学建模资料
👇 私信完整代码和数据获取及论文数模仿真定制
1 各类智能优化算法改进及应用
生产调度、经济调度、装配线调度、充电优化、车间调度、发车优化、水库调度、三维装箱、物流选址、货位优化、公交排班优化、充电桩布局优化、车间布局优化、集装箱船配载优化、水泵组合优化、解医疗资源分配优化、设施布局优化、可视域基站和无人机选址优化、背包问题、 风电场布局、时隙分配优化、 最佳分布式发电单元分配、多阶段管道维修、 工厂-中心-需求点三级选址问题、 应急生活物质配送中心选址、 基站选址、 道路灯柱布置、 枢纽节点部署、 输电线路台风监测装置、 集装箱船配载优化、 机组优化、 投资优化组合、云服务器组合优化、 天线线性阵列分布优化
2 机器学习和深度学习方面
2.1 bp时序、回归预测和分类
2.2 ENS声神经网络时序、回归预测和分类
2.3 SVM/CNN-SVM/LSSVM/RVM支持向量机系列时序、回归预测和分类
2.4 CNN/TCN卷积神经网络系列时序、回归预测和分类
2.5 ELM/KELM/RELM/DELM极限学习机系列时序、回归预测和分类
2.6 GRU/Bi-GRU/CNN-GRU/CNN-BiGRU门控神经网络时序、回归预测和分类
2.7 ELMAN递归神经网络时序、回归\预测和分类
2.8 LSTM/BiLSTM/CNN-LSTM/CNN-BiLSTM/长短记忆神经网络系列时序、回归预测和分类
2.9 RBF径向基神经网络时序、回归预测和分类
基于多算法的WSN覆盖优化算法研究
8249

被折叠的 条评论
为什么被折叠?



