您现在的位置:首页 >> 智能优化 >> 内容

基于ACO蚁群优化算法的栅格地图避障路线规划matlab仿真

时间:2022/12/30 18:26:49 点击:

  核心提示:A165,包括程序操作录像...

1.完整项目描述和程序获取

>面包多安全交易平台:https://mbd.pub/o/bread/Y52blZlw

>如果链接失效,可以直接打开本站店铺搜索相关店铺:

点击店铺

>如果链接失效,程序调试报错或者项目合作可以加微信或者QQ联系。

2.部分仿真图预览




3.算法概述

        蚁群算法是通过对自然界中真实蚂蚁的集体行为的观察,模拟而得到一种仿生优化算法,它具有很好的并行性,分布性.根据蚂蚁群体不同的集体行为特征,蚁群算法可分为受蚂蚁觅食行为启发的模型和受孵化分类启发的模型,受劳动分工和协作运输启发的模型.本文重点研究了前两种蚁群算法模型. 受蚂蚁觅食行为启发的模型又称为蚁群优化算法(ACO),是继模拟退火算法,遗传算法,禁忌搜索等之后又一启发式智能优化算法.目前它已成功应用于求解TSP问题,地图着色,路径车辆调度等优化问题.本文针对蚁群算法收敛时间长,易陷入局部最优的缺点,通过对路径上信息素的更新方式作出动态调整,建立信息素平滑机制,进而使得不同路径上的信息素的更新速度有所不同,从而使改进后算法能够有效地缩短搜索的时间,并能对最终解进行优化,避免过早的陷入局部最优. 聚类是数据挖掘的重要技术之一,它可按照某种规则将数据对象划分为多个类或簇,使同一类的数据对象有较高的相似度,而不同类的数据对象差异较大.     

4.部分源码

%% -----------iteration time is k, ant number is M--------------------

for k=1:K

    disp(k);

    for m=1:M

%%     First step: status initialization

        W=S;%set current point as the starting point

        Path=S;%initialize the passing route

        PLkm=0;%initialize the passing length

        TABUkm=ones(1,N);%initialize the forbbiden table

        TABUkm(S)=0;% eliminate this point for it is the starting point

        DD=D;%initialize adjacency matrix

%%     Second Step:Choose the nodes that can step forward

        DW=DD(W,:);

        DW1=find(DW<inf);

        for j=1:length(DW1)

            if TABUkm(DW1(j))==0

                DW(j)=inf;

            end

        end

        LJD=find(DW<inf);% set of points can be selected

        Len_LJD=length(LJD);%number of points can be selected

%%     Colony stop condition:there is no food or go into a impass

        while W~=E&&Len_LJD>=1

%%         Third Step:the method to choose the next step

            PP=zeros(1,Len_LJD);

            for i=1:Len_LJD

                PP(i)=(Tau(W,LJD(i))^Alpha)*(Eta(LJD(i))^Beta);

            end

            PP=PP/(sum(PP));%construct probability distributing

            Pcum=cumsum(PP);

            Select=find(Pcum>=rand);

            to_visit=LJD(Select(1));%the next step node

%%         Fourth Step:status update and record

            Path=[Path,to_visit];%Paths accumulation

            PLkm=PLkm+DD(W,to_visit);%Path length accumulation

            W=to_visit;%move to the next point

            for kk=1:N

                if TABUkm(kk)==0

                    DD(W,kk)=inf;

                    DD(kk,W)=inf;

                end

            end

            TABUkm(W)=0;%eliminate the travelled point in the forbidden table

            DW=DD(W,:);

            DW1=find(DW<inf);

            for j=1:length(DW1)

                if TABUkm(DW1(j))==0

                    DW(j)=inf;

                end

            end

            LJD=find(DW<inf);%set of optional points

            Len_LJD=length(LJD);%number of optional points

        end

%%     Fifth Step:record the pate and length that every ant for every

%%     iteration passes

        ROUTES{k,m}=Path;

        if Path(end)==E

            PL(k,m)=PLkm;

        else

            PL(k,m)=inf;

        end

    end

%%    Sixth Step: update pheromone

    Delta_Tau=zeros(N,N);%initialize updating ammount

    for m=1:M

        if PL(k,m)<inf

            ROUT=ROUTES{k,m};

            TS=length(ROUT)-1;

            PL_km=PL(k,m);

            for s=1:TS

                x=ROUT(s);

                y=ROUT(s+1);

                Delta_Tau(x,y)=Delta_Tau(x,y)+Q/PL_km;

                Delta_Tau(y,x)=Delta_Tau(y,x)+Q/PL_km;

            end

        end

    end

    Tau=(1-Rho).*Tau+Delta_Tau;%pheromone evaporates some and accumulates some

end

%% ---------------------------PLOT--------------------------------

plotif=1;%control parameter, determine if plot or not

if plotif==1

    %plot convergence curve

    meanPL=zeros(1,K);

    minPL=zeros(1,K);

    for i=1:K

        PLK=PL(i,:);

        Nonzero=find(PLK<inf);

        PLKPLK=PLK(Nonzero);

        meanPL(i)=mean(PLKPLK);

        minPL(i)=min(PLKPLK);

    end

A165

作者:我爱C编程 来源:我爱C编程
本站最新成功开发工程项目案例
相关评论
发表我的评论
  • 大名:
  • 内容:
本类固顶
  • 没有
  • FPGA/MATLAB商业/科研类项目合作(www.store718.com) © 2025 版权所有 All Rights Reserved.
  • Email:1480526168@qq.com 站长QQ: 1480526168