• 基于改进遗传算法的卡车和两架无人机旅行推销员问题(D2TSP)(Matlab代码实现)


    🎉🎉🎉🎉欢迎您的到来😊😊😊

    🥬博客主页博客内容尽量做到思维缜密,逻辑清晰,为了方便读者。

    目录

    🌈1 概述

    🌟2 运行结果

    ⛳️3 参考文献

    💥4 Matlab代码实现

    🌈1 概述

       本文为解决卡车和两个无人机旅行推销员的问题,表示为串联团队,无人机提供最后一英里的努力。使用遗传算法(路由突变)来解决问题。该问题可以解决随机生成坐标的100个城市的D2TSP。该解决方案基于最小化时间而不是距离。最短时间计算基于卡车或无人机在操作中交付的最长时间。操作表示为无人机(或两者)发射、发送交付然后在会合位置恢复的节点或停靠点。每架无人机都受到航程和容量的限制。因此,操作中的停靠范围和停靠次数受到无人机约束的限制。

    🌟2 运行结果

    部分代码:

    % Sanity Checks
        popSize     = max(12,12*ceil(popSize(1)/12));
        numIter     = max(1,round(real(numIter(1))));
        showProg    = logical(showProg(1));
        showResult  = logical(showResult(1));
        showWaitbar = logical(showWaitbar(1));
        
        % Initialize the Populations
        popRoute = zeros(popSize,n); %routes        
        popTrk   = zeros(popSize,n); %truck route
        popDrn   = zeros(popSize,n); %drone route
        popDrn2   = zeros(popSize,n); %drone 2 route
        popOps   = zeros(popSize,n); %operations drone 1
        popRoute(1,:) = (1:n);
        rp =popRoute(1,:);

        %[rp, optr, oppr, opdr] = map_cir2(rp) ;  
        [rp, optr, oppr, opdr, opdr2] = map_cir2(rp);
        
        popRoute(1,:) = map_cir( rp);   
        popTrk(1,:)   = optr;    
        popDrn(1,:)   = opdr; 
        popDrn2(1,:)  = opdr2;
        popOps(1,:)   = oppr;
        for k = 2:popSize
            [op, tr, dr, dr2]  = rand_ops_d_o();
           % op=oppr; tr=optr; dr=opdr; dr2=opdr2;
            popRoute(k,:) = randperm(n);
            
             if mod(k,2)==0    % swap
                r = sort([randi(n) randi(n)]);
                r1=r(1); r2=r(2);
                popRoute(k,:)= popRoute(1,:);
                popRoute(k,[r1 r2]) = popRoute(k,[r2 r1]); 
            elseif mod(k,3)==0 % flip
                r = sort([randi(n) randi(n)]);
                r1=r(1); r2=r(2);
                popRoute(k,:)= popRoute(1,:);
                popRoute(k,r1:r2) = popRoute(k,r2:-1:r1); 
            elseif mod(k,4)==0% swap, flip
                r = sort([randi(n) randi(n)]);
                r1=r(1); r2=r(2);
                popRoute(k,:)= popRoute(1,:);
                popRoute(k,[r1 r2]) = popRoute(k,[r2 r1]);
                popRoute(k,r1:r2)   = popRoute(k,r2:-1:r1);
            else
                r = sort([randi(n) randi(n)]);
                r1=r(1); r2=r(2);
                popRoute(k,:)= popRoute(1,:);
                popRoute(k,[r1 r2]) = popRoute(k,[r2 r1]);
               % popRoute(k,r1:r2)   = popRoute(k,r2:-1:r1);    
            end
            
            
            popTrk(k,:)   = tr;
            popOps(k,:)   = op;
            popDrn(k,:)   = dr;
            popDrn2(k,:)  = dr2;
        end
        
        % Run the GA
        globalMin   = Inf;
        totalDist    = zeros(1,popSize);
        totalTime    = zeros(1,popSize);              % total time for route
        totalEnergy  = zeros(1,popSize);              % total energy for route
        totalCost    = zeros(1,popSize);              % cost of route
        totalCostkm  = zeros(1,popSize);
        totalCosthr  = zeros(1,popSize);
        totalEnergyP = zeros(1,popSize);
        distHistory  = zeros(1,numIter);      
        timeHistory  = zeros(1,numIter);
        energyHistory= zeros(1,numIter);
        costHistory  = zeros(1,numIter);
        costkmHistory= zeros(1,numIter);
        costhrHistory= zeros(1,numIter);

        
        tmpPopRoute  = zeros(12,n);
        tmpPopTrks   = zeros(12,n);
        tmpPopOps    = zeros(12,n);
        tmpPopDrns   = zeros(12,n);
        tmpPopDrns2  = zeros(12,n);
        
        newPopRoute  = zeros(popSize,n);
        newPopTrks   = zeros(popSize,n);
        newPopOps    = zeros(popSize,n);
        newPopDrns   = zeros(popSize,n);
        newPopDrns2  = zeros(popSize,n);

     

    ⛳️3 参考文献

    [1]黄书召,田军委,乔路,王沁,苏宇.基于改进遗传算法的无人机路径规划[J.计算机应用,2021,41(02):390-397.

    💥4 Matlab代码实现

  • 相关阅读:
    【C++设计模式】(五)创建型模式 — 建造者模式
    Matlab如何选择读取dat格式数据?
    毕设-基于SpringBoot西餐厅点餐系统
    【Lilishop商城】No2-7.确定软件架构搭建六(本篇包括延时任务,会用到rocketmq、redis)
    【浅学Java】Seervlet小项目——MessageWall
    鸢尾花分类模型demo-恢复、部署、保存
    No such module ‘FacebookCore‘
    可升级合约的原理-DelegateCall
    C++ Reference: Standard C++ Library reference: Containers: deque: deque: clear
    搭建nacos集群,并通过nginx实现负载均衡
  • 原文地址:https://blog.csdn.net/weixin_46039719/article/details/127591927