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

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

🍊个人信条:格物致知。

⛄ 内容介绍

空中无人机(UAVs)作为网络处理器在移动网络中长期使用,但它们现在被用作移动边缘计算(MEC)中的移动服务器。由于它们的灵活性、便携性、强大的视线通信联系和低成本、可改变的使用,它们在研究和商业应用中变得更加流行。更广泛的民用服务现在可能被这些重要的特征所支持,包括运输和工业监测和农业,以及森林和有线服务。本项目研究了基于无人飞行器的移动计算网络,无人飞行器(UAV)进行计算,移动终端用户向其提供计算。为了确保每个终端用户的服务质量(QoS),无人飞行器根据移动终端用户的位置动态选择其路线。

【无人机路径规划】基于强化学习的多无人机移动边缘计算与路径规划附matlab代码_无人机

【无人机路径规划】基于强化学习的多无人机移动边缘计算与路径规划附matlab代码_无人机_02

【无人机路径规划】基于强化学习的多无人机移动边缘计算与路径规划附matlab代码_无人机_03

⛄ 部分代码

function PATH = planning(i,initial_pos,E_matrix)

global TARGET;

global TU_demand_matrix;

global UAVnum;

global G;

global N;

global EPISOD_SUM;

global K;

global M;

G_ori=G; % store G

% PATH= planning(G{i},round(UAV_pos(i,:)*N),TARGET,E_matrix,TU,N,EPISOD_SUM,K,M);

%% initialize G with all elements are N^2 and target 0

% add the following lines then G will be refreshed in each planning

for j=1:UAVnum

    G{j}=ones(N,N)*N^2;

    G{j}(TARGET(1),TARGET(2))=0;

end

%% update G matrix

node=TARGET;

for t=1:EPISOD_SUM  % while in max iteration num

    % invoke dangerMatrx.m to return a weight matrix A

    A=dangerMatrix(node,E_matrix);

    G{i}=min(G{i},G{i}(node(1),node(2))+A);  % a reward matrix to update G to find most minimum element

    node=randi(N,1,2);                       %randomly find 1*2 int matrix range(0,N)

end

% every element in G is the minimum value to that position

%% calculate PATH by W

step=1;

s=initial_pos;

PATH=[];

G_tmp=G{i};

while(~isequal(s,TARGET) && step<N*2)  % continue to planning as long as UAV hasn't arrived at target or step<2N

    step=step+1;

    %% revised

    cost_add=dangerMatrix(s,E_matrix);

    W2=G_tmp+cost_add;

    [row_index,column_index]=find(W2==min(min(W2))); % find min element in W2

    % there might be 1+ minium, so use row_index(1)

    row_index=row_index(1);

    column_index=column_index(1);

    s=[row_index,column_index];

    G_tmp(row_index,column_index)=N^2;

    % prevent deadlock in PATH

    if(~isempty(PATH)&&ismember(s,PATH,'rows'))

        continue;

    else

        PATH=cat(1,PATH,s);

    end

    %% original

    %         A2=dangerMatrix(s,E_matrix);

    %         W2=G{i}+A2;

    %         W2(s(1),s(2))=abs(min(min(W2))*1.5); %make sure s value is not minimum in W2

    %         [a,b]=min(W2);                       %find min element in W2 and assign the column and row to s(1) and s(2)

    %         [~,d]=min(a);

    %         s(1)=b(d);

    %         s(2)=d;

    %         PATH=cat(1,PATH,s);                %add new s position to TRACE

end

G=G_ori; % restore G

end

⛄ 运行结果

【无人机路径规划】基于强化学习的多无人机移动边缘计算与路径规划附matlab代码_sed_04

⛄ 参考文献

[1] Wang L ,  Wang K ,  Pan C , et al. Multi-Agent Deep Reinforcement Learning-Based Trajectory Planning for Multi-UAV Assisted Mobile Edge Computing[J]. IEEE, 2021(1).

⛳️ 完整代码

❤️部分理论引用网络文献,若有侵权联系博主删除
❤️ 关注我领取海量matlab电子书和数学建模资料