• 【WSN布局】基于LICHTENBERG算的多目标传感器选择和放置优化问题研究附matlab代码


    ✅作者简介:热爱科研的Matlab仿真开发者,修心和技术同步精进,matlab项目合作可私信。

    🍎个人主页:Matlab科研工作室

    🍊个人信条:格物致知。

    更多Matlab仿真内容点击👇

    智能优化算法  神经网络预测 雷达通信  无线传感器

    信号处理 图像处理 路径规划 元胞自动机 无人机  电力系统

    ⛄ 内容介绍

    随着无线传感器网络(Wireless Sensor Network,WSN)技术的不断发展,越来越多的WSN技术已经应用到了智能家居,智慧交通等领域.WSN属于一种重要的ad hoc网络,它由很多具有感知和数据处理能力的传感节点以自组织或多跳的方式搭建.目前,WSN的研究工作主要集中在网络技术和通信协议方面,关于传感器网络部署优化的研究还很少.在空旷的农场或森林部署WSN,一般做法是通过飞机进行高空随机抛撒.但是,这种方法可能出现大量的多余节点和覆盖漏洞.因此,如何用尽量少的传感节点感知最大的区域是WSN部署优化中一个亟待研究的问题.在广阔的农场环境或森林中,需要准备许多传感节点,节点大部分靠电池供电,但是,电池能量是有限的,并且无法更换.因此,如何使用相同数量的节点,达到最长的网络寿命成为WSN部署优化中另一个倍受瞩目的问题.

    ⛄ 部分代码

    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

    %

    %           Multi-objective Sensor Selection Optimization based on 

    %                      Lichtenberg Algorithm (MOSSOLA)

    %

    %         AUTHORS: Jo茫o Luiz Junho Pereira and Guilherme Ferreira Gomes

    %

    %         A Hybrid PHYSICS-based Multi-objective Metaheuristic with 

    %         Feature Selection for Sensor Placement Optimization (SPO) 

    %

    %   Please cite this algorithm as:

    %

    % Pereira, J.L.J., Francisco, M.B., Souza Chaves, J. A., Sebasti茫o Sim玫es Cunha Jr & Gomes, G. F. 

    % Multi-objective sensor placement optimization of helicopter rotor blade based on feature selection. 

    % Mechanical Systems and Signal Processing. 2022.

    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

    close all

    clear all

    clc

    format long

    warning off

    set(0,'DefaultAxesFontName', 'Times New Roman')

    set(0,'DefaultAxesFontSize', 12)

    set(0,'DefaultTextFontname', 'Times New Roman')

    set(0,'DefaultTextFontSize', 12)

    opengl('save', 'software')

    % Importing natural frequencies in FEM structure (Main Rotor Blade - MRB)

    F=importdata('natural_frequencies.txt');

    wn1=F.data(1:9,2); wn = [wn1(1) wn1(2) wn1(3) wn1(4) wn1(6) wn1(9)];

    % Importing All sensor candidates from FEM structure (34 well spaced nodes

    % in MRB)

    S=importdata('Sensors.txt'); 

    % Importing mode shapes in FEM structure (MRB)

    M1=importdata('Mode1.txt'); M1x=M1.data(:,5); M1y=M1.data(:,6);M1z=M1.data(:,7);

    M2=importdata('Mode2.txt'); M2x=M2.data(:,5); M2y=M2.data(:,6);M2z=M2.data(:,7);

    M3=importdata('Mode3.txt'); M3x=M3.data(:,5); M3y=M3.data(:,6);M3z=M3.data(:,7);

    M4=importdata('Mode4.txt'); M4x=M4.data(:,5); M4y=M4.data(:,6);M4z=M4.data(:,7);

    M6=importdata('Mode6.txt'); M6x=M6.data(:,5); M6y=M6.data(:,6);M6z=M6.data(:,7);

    M9=importdata('Mode9.txt'); M9x=M9.data(:,5); M9y=M9.data(:,6);M9z=M9.data(:,7);

    % Calculating Total displacements (triaxial)

    M1T = sqrt(M1x.^2+M1y.^2+M1z.^2); M2T = sqrt(M2x.^2+M2y.^2+M2z.^2); M3T = sqrt(M3x.^2+M3y.^2+M3z.^2); 

    M4T = sqrt(M4x.^2+M4y.^2+M4z.^2); M6T = sqrt(M6x.^2+M6y.^2+M6z.^2); M9T = sqrt(M9x.^2+M9y.^2+M9z.^2); 

    Modos = [M1T M2T M3T M4T M6T M9T];

    % Optimizator Parameters

    UB = ones(1,length(S)); % Uper bounds

    LB = 0*UB;              % lower bounds

    pop = 100;              % Population

    n_iter = 100;           % Max number os iterations/gerations

    ref = 0.4;              % if more than zero, a second LF is created with refinement % the size of the other

    Np = 100000;            % Number of Particles (If 3D, better more than 10000)

    S_c = 1;                % Stick Probability: Percentage of particles that can don麓t stuck in the

                            % cluster. Between 0 and 1. Near 0 there are more aggregate, the density of

                            % cluster is bigger and difusity is low. Near 1 is the opposite. 

    Rc = 150;               % Creation Radius (if 3D, better be less than 80, untill 150)

    M = 0;                  % If M = 0, no lichtenberg figure is created (it is loaded a optimized figure); if 1, a single is created and used in all iterations; If 2, one is created for each iteration.(creating an LF figure takes about 2 min)

    d = length(UB);         % problem dimension

    ngrid = 30;             % Number of grids in each dimension

    Nr = 100;               % Maximum number of solutions in PF

    % Sensor Placement Optimization Parameters

    C = 1;                 % METRIC USED (KE=1;EfI=2,ADPR=3;EVP=4;IE=5;FIM=6;MAC=7)

    NS = 6;                % Sensor Congiguration solution with NS sensors (select from PARETO FRONT after optimization with all sensors numbers)

    [x,fval] = LA_optimization(@(x)objectives(x,Modos,S,wn,C),d,pop,LB,UB,ref,n_iter,Np,Rc,S_c,M,ngrid,Nr,@constraint);

    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%PARETO FRONT FIGURE%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

    % figure

    % plot(fval(:,1),fval(:,2),'ZDataSource','',...

    %     'MarkerFaceColor',[0 0 1],...

    %     'MarkerEdgeColor',[0 0 0],...

    %     'MarkerSize',4,...

    %     'Marker','o',...

    %     'LineWidth',0.1,...

    %     'LineStyle','none',...

    %     'Color',[0 0 0]);

    % hold on

    % box on

    % %plot(fval(best_pos,1),fval(best_pos,2),'MarkerFaceColor',[1 1 0],'MarkerSize',14,'Marker','pentagram','LineWidth', 0.2, 'LineStyle','none','Color',[0 0 0]);

    % %legend('PF','TOPSIS');

    % % set(0,'DefaultAxesFontSize', 10)

    % % set(0,'DefaultTextFontSize', 10)

    % set(findall(gcf,'-property','FontName'),'FontName','Italic')

    % set(findall(gcf,'-property','FontAngle'),'FontAngle','italic')

    % set(gcf,'position',[200,200,350,200])

    % %title('Non-dominated solutions','fontweight','bold');

    % % axis([0 -0.01 0 30])

    % xlabel('J=max(diag(MAC))')

    % ylabel('Number of Sensors')

    %%%%%%%%%%%%%%%%%%%%%%%%%%%TO CALCULATE HYPERVOLUME%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

    % Simulation = 0;

    % for i =1:10

    %  Simulation = Simulation + 1 

    % [x,fval] = LA_optimization(@(x)objectives(x,Modos,S,wn,C),d,pop,LB,UB,ref,n_iter,Np,Rc,S_c,M,ngrid,Nr,@constraint);

    % HV_Score(i) = HV(fval,length(S))

    % end

    % mean(HV_Score)

    %%%%%%%%%%%%%%%%%%%%%%%%TO PLOT THE SELECTED SENSORS IN STRUCTURE%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

    x = round(x);

    for i = 1 : length(x)

    P(i) = sum(x(i,:));

    end

    best_pos=find(P==NS);

    Xbest = round(x(best_pos,:));

    for i=1:length(S)

       SLCT(i) = S(i)*Xbest(1,i);

    end

    SLCT(find(SLCT==0))=[];

    FITNESS = fval(best_pos,:);

    NUMBERofSENSORS = FITNESS(1,2)

    METRICfitness = FITNESS(1,1)

    SENSORS = SLCT

    ALLNODES = importdata('NODES.txt'); %ALL NODES IN FEM STRUCTURE (TO PLOT STRUCTURAL FIGURE)

    NODES = [ALLNODES(:,2) ALLNODES(:,3)];

    theta = -90; % to structure figure rotate in 90掳 counterclockwise

    R = [cosd(theta) -sind(theta); sind(theta) cosd(theta)];

    C = (R*NODES')'; 

    %Sensor Points

    for i = 1 : length(SENSORS)

        PS(i,:) = [C(SENSORS(i),1) C(SENSORS(i),2)];

    end

    %Plot

    figure

    plot(C(:,1),C(:,2),'.k')

    hold on

    plot(PS(:,1),PS(:,2),'ZDataSource','',...

        'MarkerFaceColor',[1 0 0],...

        'MarkerEdgeColor',[1 0 0],...

        'MarkerSize',8,...

        'Marker','o',...

        'LineWidth',0.1,...

        'LineStyle','none',...

        'Color',[1 0 0]);

    axis equal

    axis([-1 5.2 -0.5 0.2])

    set(gcf,'position',[200,200,900,300])

    ⛄ 运行结果

    ⛄ 参考文献

    [1]伊廷华, 李宏男, 顾明,等. 基于MATLAB平台的传感器优化布置工具箱的开发及应用[J]. 土木工程学报, 2010(12):7.

    [2]郎健. 无线传感器网络部署优化研究与仿真[D]. 北京工业大学.

    ⛄ Matlab代码关注

    ❤️部分理论引用网络文献,若有侵权联系博主删除

    ❤️ 关注我领取海量matlab电子书和数学建模资料

     

  • 相关阅读:
    【Python入门】文件内容操作
    基于BP神经网络的手写数字识别问题研究附Matlab代码
    Day34——K次取反后最大化的数组和、加油站、分发糖果
    【工具】2102- es-toolkit:一个现代 JavaScript 工具包,体积更小,内置 TypeScript 支持...
    Linux 远程登录(Xshell7)
    Mybatis-Plus知识点总结(上)
    洛谷 P2852 [USACO06DEC]Milk Patterns G(后缀数组,height数组)
    UI自动化测试单例实现报错:AttributeError: ‘NoneType‘ object has no attribute ‘get_driver‘
    C++的一些应用
    LeetCode-子集 II(C++)
  • 原文地址:https://blog.csdn.net/matlab_dingdang/article/details/128130619