当前位置:网站首页>【TSP问题】基于Hopfield神经网络求解旅行商问题附Matlab代码
【TSP问题】基于Hopfield神经网络求解旅行商问题附Matlab代码
2022-06-25 22:23:00 【Matlab科研工作室】
1 简介
本文给出了一种基于Hopfield神经网络模型求解TSP问题的算法.Hopfield网络是一种网状网络,网络中的每个神经元都可以和其他神经元双向连接.这种连接方式使得网络中每个神经元的输出都能反馈到同一层次的其他神经元,因此,它是一种反馈网络.根据网络节点的状态,Hopfield网络可分为离散的和连续的两种类型.离散的网络,其节点状态仅取 两个值;而连续的网络,其节点状态可以取区间 上任何值.Hopfield神经网络在联想记忆,组合优化和机器人控制等方面有重要的应用.其中Hopfield网络用于优化计算是最常见的.Hopfield网络的能量函数是一个多维神经元状态的标量函数,在网络收敛的稳定点上的能量函数最小.因此,设计网络权值W和输入,将优化问题中的目标函数,约束条件与能量函数联系起来,那么能量函数的极小点也是目标函数满足约束条件的极小点,所以Hopfield网络也可用于求解优化计算问题
2 部分代码
% 路径寻优作图
function PlotR(V,citys)
figure;
citys_origin=citys;
citys=[citys;citys(1,:)];
[xxx,order]=max(V);
New=citys(order,:);
New=[New;New(1,:)];
subplot(1,2,1)
plot(citys(1,1),citys(1,2),'*') % first city
hold on
plot(citys(2,1),citys(2,2),'+') % second city
hold on
plot(citys(:,1),citys(:,2),'o-')
for i=1:length(citys_origin)
text(citys_origin(i,1),citys_origin(i,2),[' ' num2str(i)])
end
xlabel('X axis')
ylabel('Y axis')
title('Original Route')
axis([0 1 0 1])
grid on
subplot(1,2,2)
plot(New(1,1),New(1,2),'*') % first city
hold on
plot(New(2,1),New(2,2),'+') % second city
hold on
plot(New(:,1),New(:,2),'o-')
for i=1:length(citys_origin)
text(citys_origin(i,1),citys_origin(i,2),[' ' num2str(i)])
end
xlabel('X axis')
ylabel('Y axis')
title('TSP solution')
axis([0 1 0 1])
axis on
grid on
3 仿真结果
4 参考文献
[1]于慧, 徐慧. 基于Hopfield神经网络模型求解TSP问题的算法[J]. 2008.
博主简介:擅长智能优化算法、神经网络预测、信号处理、元胞自动机、图像处理、路径规划、无人机等多种领域的Matlab仿真,相关matlab代码问题可私信交流。
部分理论引用网络文献,若有侵权联系博主删除。
边栏推荐
猜你喜欢
鼠标拖拽围绕某个物体旋转展示
正则表达式介绍及一些语法
Research and development practice of Kwai real-time data warehouse support system
10.4.1 données intermédiaires
Redis之跳跃表
CaMKIIa和GCaMP6f是一样的嘛?
The problem of low video memory in yolov5 accelerated multi GPU training
yolov5 提速多GPU训练显存低的问题
(Reprint) visual explanation of processes and threads
Apache基金会正式宣布Apache InLong成为顶级项目
随机推荐
Explanation of chip processing manufacturer__ What is ICT? What is the main test? Advantages and disadvantages of ICT testing?
Installing redis on Linux
Redis cluster
Function and principle of SPI solder paste inspection machine
10.4.1、數據中臺
SPI锡膏检查机的作用及原理
正则表达式介绍及一些语法
删库跑路、“投毒”、改协议,开源有哪几大红线千万不能踩?
ValueError: color kwarg must have one color per data set. 9 data sets and 1 colors were provided
logstash丢弃没有精准匹配到文件名的日志数据
Maintenance and key points of SMT Mounter
Redux workflow explanation + small examples
Tensorrt PB to UF problem
Servlet response download file
元宇宙中的法律与自我监管
ffmpeg 版本切换
每日刷题记录 (四)
Rocket之消息存储
How ASA configures port mapping and pat
SQL中只要用到聚合函数就一定要用到group by 吗?