基于共识的捆绑算法CBBA实现多无人机多任务调度附matlab代码

简介: 基于共识的捆绑算法CBBA实现多无人机多任务调度附matlab代码

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

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

🍊个人信条:格物致知。

更多Matlab仿真内容点击👇

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

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

⛄ 内容介绍

Theorem 1. Provided that the scoring function is DMG (Diminishing Marginal Gain), the CBBA process with a conflflict resolution phase over a static communication network with diameter D satisfifiesthe following:

1. CBBA produces the same solution as SGA(sequentional greedy algo) with the corresponding winning bid values and winning agent information being shared across the flfleet

2. The convergence time Tc is bounded above by NminD.

⛄ 部分代码

% Runs consensus between neighbors

% Checks for conflicts and resolves among agents


%---------------------------------------------------------------------%


function [CBBA_Data t] = CBBA_Communicate(CBBA_Params, CBBA_Data, Graph, old_t, T)


% Copy data

for n = 1:CBBA_Params.N,

   old_z(n,:) = CBBA_Data(n).winners;

   old_y(n,:) = CBBA_Data(n).winnerBids;    

end


z = old_z;

y = old_y;

t = old_t;


epsilon = 10e-6;



% Start communication between agents


% sender   = k

% receiver = i

% task     = j


for k=1:CBBA_Params.N

   for i=1:CBBA_Params.N

       if( Graph(k,i) == 1 )

           for j=1:CBBA_Params.M


               % Implement table for each task

               

               if( old_z(k,j) == k ) % Entries 1 to 4: Sender thinks he has the task

               

                   % Entry 1: Update or Leave

                   if( z(i,j) == i )

                       if( old_y(k,j) - y(i,j) > epsilon )  % Update

                           z(i,j) = old_z(k,j);

                           y(i,j) = old_y(k,j);

                       elseif( abs(old_y(k,j) - y(i,j)) <= epsilon )  % Equal scores

                           if( z(i,j) > old_z(k,j) )  % Tie-break based on smaller index

                               z(i,j) = old_z(k,j);

                               y(i,j) = old_y(k,j);

                           end

                       end

                       

                   % Entry 2: Update

                   elseif( z(i,j) == k )

                       z(i,j) = old_z(k,j);

                       y(i,j) = old_y(k,j);

                   

                   % Entry 3: Update or Leave

                   elseif( z(i,j) > 0 )

                       if( old_t(k,z(i,j)) > t(i,z(i,j)) )  % Update

                           z(i,j) = old_z(k,j);

                           y(i,j) = old_y(k,j);

                       elseif( (old_y(k,j) - y(i,j)) > epsilon )  % Update

                           z(i,j) = old_z(k,j);

                           y(i,j) = old_y(k,j);

                       elseif( abs(old_y(k,j) - y(i,j)) <= epsilon )  % Equal scores

                           if( z(i,j) > old_z(k,j) )  % Tie-break based on smaller index

                               z(i,j) = old_z(k,j);

                               y(i,j) = old_y(k,j);

                           end

                       end

               

                   % Entry 4: Update

                   elseif( z(i,j) == 0 )

                       z(i,j) = old_z(k,j);

                       y(i,j) = old_y(k,j);

                       

                   else

                       disp('Unknown winner value: Should not be here, please revise')

                   end

                   

               elseif( old_z(k,j) == i ) % Entries 5 to 8: Sender thinks receiver has the task


                   % Entry 5: Leave

                   if( z(i,j) == i )

                       % Do nothing

                       

                    % Entry 6: Reset

                   elseif( z(i,j) == k )

                       z(i,j) = 0;

                       y(i,j) = 0;

                 

                    % Entry 7: Reset or Leave

                   elseif( z(i,j) > 0 )

                       if( old_t(k,z(i,j)) > t(i,z(i,j)) )  % Reset

                           z(i,j) = 0;

                           y(i,j) = 0;

                       end

                       

                   % Entry 8: Leave

                   elseif( z(i,j) == 0 )

                       % Do nothing

                       

                   else

                       disp('Unknown winner value: Should not be here, please revise')

                   end

                 

               elseif( old_z(k,j) > 0 ) % Entries 9 to 13: Sender thinks someone else has the task

                   

                   % Entry 9: Update or Leave

                   if( z(i,j) == i )

                       if( old_t(k,old_z(k,j)) > t(i,old_z(k,j)) )

                           if ( (old_y(k,j) - y(i,j)) > epsilon )

                               z(i,j) = old_z(k,j);  % Update

                               y(i,j) = old_y(k,j);

                           elseif( abs(old_y(k,j) - y(i,j)) <= epsilon )  % Equal scores

                               if( z(i,j) > old_z(k,j) )  % Tie-break based on smaller index

                                   z(i,j) = old_z(k,j);

                                   y(i,j) = old_y(k,j);

                               end

                           end

                       end

                       

                    % Entry 10: Update or Reset

                   elseif( z(i,j) == k )

                       if( old_t(k,old_z(k,j)) > t(i,old_z(k,j)) )  % Update

                           z(i,j) = old_z(k,j);

                           y(i,j) = old_y(k,j);

                       else  % Reset

                           z(i,j) = 0;

                           y(i,j) = 0;

                       end

                       

                   % Entry 11: Update or Leave

                   elseif( z(i,j) == old_z(k,j) )

                       if( old_t(k,old_z(k,j)) > t(i,old_z(k,j)) )  % Update

                           z(i,j) = old_z(k,j);

                           y(i,j) = old_y(k,j);

                       end

                   

                   % Entry 12: Update, Reset or Leave

                   elseif( z(i,j) > 0 )

                       if( old_t(k,z(i,j)) > t(i,z(i,j)) )

                           if( old_t(k,old_z(k,j)) >= t(i,old_z(k,j)) )  % Update

                               z(i,j) = old_z(k,j);

                               y(i,j) = old_y(k,j);

                           elseif( old_t(k,old_z(k,j)) < t(i,old_z(k,j)) ) % Reset

                               z(i,j) = 0;

                               y(i,j) = 0;

                           else

                               disp('Should not be here, please revise')

                           end

                       else

                           if( old_t(k,old_z(k,j)) > t(i,old_z(k,j)) )

                               if( (old_y(k,j) - y(i,j)) > epsilon )  % Update

                                   z(i,j) = old_z(k,j);

                                   y(i,j) = old_y(k,j);

                               elseif( abs(old_y(k,j) - y(i,j)) <= epsilon )  % Equal scores

                                   if( z(i,j) > old_z(k,j) )   % Tie-break based on smaller index

                                       z(i,j) = old_z(k,j);

                                       y(i,j) = old_y(k,j);

                                   end

                               end

                           end

                       end


                   % Entry 13: Update or Leave

                   elseif( z(i,j) == 0 )

                       if( old_t(k,old_z(k,j)) > t(i,old_z(k,j)) )  % Update

                           z(i,j) = old_z(k,j);

                           y(i,j) = old_y(k,j);

                       end

                       

                   else

                       disp('Unknown winner value: Should not be here, please revise')

                   end

                   

               elseif( old_z(k,j) == 0 ) % Entries 14 to 17: Sender thinks no one has the task


                   % Entry 14: Leave

                   if( z(i,j) == i )

                       % Do nothing

                       

                    % Entry 15: Update

                   elseif( z(i,j) == k )

                       z(i,j) = old_z(k,j);

                       y(i,j) = old_y(k,j);

                 

                    % Entry 16: Update or Leave

                   elseif( z(i,j) > 0 )

                       if( old_t(k,z(i,j)) > t(i,z(i,j)) )  % Update

                           z(i,j) = old_z(k,j);

                           y(i,j) = old_y(k,j);

                       end

                       

                   % Entry 17: Leave

                   elseif( z(i,j) == 0 )

                       % Do nothing

                       

                   else

                       disp('Unknown winner value: Should not be here, please revise')

                   end

                   

                   % End of table

                   

               else

                   disp('Unknown winner value: Should not be here, please revise')

               end

           end

           

           % Update timestamps for all agents based on latest comm

           for n=1:CBBA_Params.N

               if( n ~= i && t(i,n) < old_t(k,n) )

                   t(i,n) = old_t(k,n);

               end

           end

           t(i,k) = T;

           

       end

   end

end


% Copy data

for n = 1:CBBA_Params.N,

   CBBA_Data(n).winners    = z(n,:);

   CBBA_Data(n).winnerBids = y(n,:);

end

end

⛄ 运行结果

⛄ 参考文献


⛳️ 代码获取关注我

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


相关文章
|
7月前
|
算法 定位技术 计算机视觉
【水下图像增强】基于波长补偿与去雾的水下图像增强研究(Matlab代码实现)
【水下图像增强】基于波长补偿与去雾的水下图像增强研究(Matlab代码实现)
906 0
|
7月前
|
算法 机器人 计算机视觉
【图像处理】水下图像增强的颜色平衡与融合技术研究(Matlab代码实现)
【图像处理】水下图像增强的颜色平衡与融合技术研究(Matlab代码实现)
236 0
|
7月前
|
机器学习/深度学习 算法 机器人
使用哈里斯角Harris和SIFT算法来实现局部特征匹配(Matlab代码实现)
使用哈里斯角Harris和SIFT算法来实现局部特征匹配(Matlab代码实现)
342 8
|
7月前
|
机器学习/深度学习 编解码 算法
基于OFDM技术的水下声学通信多径信道图像传输研究(Matlab代码实现)
基于OFDM技术的水下声学通信多径信道图像传输研究(Matlab代码实现)
344 8
|
7月前
|
机器学习/深度学习 算法 机器人
【水下图像增强融合算法】基于融合的水下图像与视频增强研究(Matlab代码实现)
【水下图像增强融合算法】基于融合的水下图像与视频增强研究(Matlab代码实现)
699 0
|
7月前
|
新能源 Java Go
【EI复现】参与调峰的储能系统配置方案及经济性分析(Matlab代码实现)
【EI复现】参与调峰的储能系统配置方案及经济性分析(Matlab代码实现)
251 0
|
7月前
|
机器学习/深度学习 数据采集 测试技术
基于CEEMDAN-VMD-BiLSTM的多变量输入单步时序预测研究(Matlab代码实现)
基于CEEMDAN-VMD-BiLSTM的多变量输入单步时序预测研究(Matlab代码实现)
301 8
|
7月前
|
机器学习/深度学习 算法 自动驾驶
基于导向滤波的暗通道去雾算法在灰度与彩色图像可见度复原中的研究(Matlab代码实现)
基于导向滤波的暗通道去雾算法在灰度与彩色图像可见度复原中的研究(Matlab代码实现)
393 8
|
7月前
|
编解码 运维 算法
【分布式能源选址与定容】光伏、储能双层优化配置接入配电网研究(Matlab代码实现)
【分布式能源选址与定容】光伏、储能双层优化配置接入配电网研究(Matlab代码实现)
630 12
|
7月前
|
人工智能 数据可视化 网络性能优化
【顶级SCI复现】虚拟电厂的多时间尺度调度:在考虑储能系统容量衰减的同时,整合发电与多用户负荷的灵活性研究(Matlab代码实现)
【顶级SCI复现】虚拟电厂的多时间尺度调度:在考虑储能系统容量衰减的同时,整合发电与多用户负荷的灵活性研究(Matlab代码实现)
249 9

热门文章

最新文章