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

基于SA模拟退火优化的TWVRP路径规划matlab仿真

时间:2023/3/20 23:21:53 点击:

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

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

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

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

点击店铺

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

2.部分仿真图预览





3.算法概述

     模拟退火算法(simulated annealing,SAA)来源于固体退火原理,是一种基于概率的算法。模拟退火算法来源于固体退火原理,是一种基于概率的算法,将固体加温至充分高,再让其徐徐冷却,加温时,固体内部粒子随温升变为无序状,内能增大,而徐徐冷却时粒子渐趋有序,在每个温度都达到平衡态,最后在常温时达到基态,内能减为最小。

4.部分源码

.............................................................

data         = load('vrp1.mat');

model        = data.model;

model.eta    = 0.1;

CostFunction = @(q) MyCost(q,model);     

 

MaxIt          = 1000;     

MaxIt2         = 80;      

T0             = 100;       

alpha          = 0.99;    

 

x.Position     = CreateRandomSolution(model);

[x.Cost x.Sol] = CostFunction(x.Position);

 

BestSol        = x;

 

BestCost       = zeros(MaxIt,1);

 

nfe            = zeros(MaxIt,1);

 

T              = T0;

 

for it=1:MaxIt

    it

    for it2=1:MaxIt2

        xnew.Position        = CreateNeighbor(x.Position);

        [xnew.Cost xnew.Sol] = CostFunction(xnew.Position);

        

        if xnew.Cost<=x.Cost

           x=xnew;

        else

           delta=xnew.Cost-x.Cost;

           p=exp(-delta/T);

            

           if rand<=p

              x=xnew;

           end

        end

 

        if x.Cost<=BestSol.Cost

           BestSol=x;

        end

    end

    BestCost(it) = BestSol.Cost;

    nfe(it)      = NFE;

    if BestSol.Sol.IsFeasible

       FLAG=' *';

    else

       FLAG='';

    end

    T=alpha*T;

    figure(1);

    PlotSolution(BestSol.Sol,model);

end

figure;

plot(nfe,BestCost,'LineWidth',1);

xlabel('迭代次数');

ylabel('Cost');

A581

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