当前位置: 首页 > news >正文

企业网站的特点企业管理系统

企业网站的特点,企业管理系统,天翼云虚拟主机,怎么看网站是哪个平台做的模拟退火算法求解TSP的步骤参考书籍《Matlab智能算法30个案例分析》。 问题描述 TSP问题描述在该书籍的第4章 算法流程 部分实现代码片段 坐标轴转换成两点之间直线距离长度的代码 coordinates np.array([(16.47, 96.10),(16.47, 94.44),(20.09, 92.54),(22.39, 93.37),(2…

模拟退火算法求解TSP的步骤参考书籍《Matlab智能算法30个案例分析》。

问题描述

TSP问题描述在该书籍的第4章

在这里插入图片描述

算法流程

在这里插入图片描述

部分实现代码片段

坐标轴转换成两点之间直线距离长度的代码

coordinates = np.array([(16.47, 96.10),(16.47, 94.44),(20.09, 92.54),(22.39, 93.37),(25.23, 97.24),(22.00, 96.05),(20.47, 97.02),(17.20, 96.29),(16.30, 97.38),(14.05, 98.12),(16.53, 97.38),(21.52, 95.59),(19.41, 97.13),(20.09, 92.55),])# 将距离坐标矩阵转换成两点之间实际的直线距离
city_num = coordinates.shape[0]def get_distanceGraph(coordinates):# 计算城市间的欧式距离diatance_graph = np.zeros((city_num, city_num))# 初始化生成矩阵for i in range(city_num):for j in range(i, city_num):diatance_graph[i][j] = diatance_graph[j][i] = np.linalg.norm(coordinates[i] - coordinates[j])print("diatance_graph", diatance_graph)return diatance_graph

求解TSP问题路径长度的代码

def cal_length(cur_solution, distance_graph):# 计算路线长度total_length = 0visited_city_list = [cur_solution[0]]for i in range(city_num):visited_city = visited_city_list[-1]cur_city = cur_solution[i]visited_city_id = visited_city - 1cur_city_id = cur_city - 1next_city_length = distance_graph[visited_city_id][cur_city_id]total_length += next_city_lengthvisited_city_list.append(cur_city)print("total_length", total_length)return total_length

使用一个路径长度矩阵相对简单,可以进行笔算验证解结果的算例,验证计算TSP路径长度的代码是可行的

可以笔算验证的算例代码

# 各个节点之间的欧氏距离
distance_list = [[0, 4.0, 6.0, 7.5, 9.0, 20.0, 10.0, 16.0, 8.0],[4.0, 0, 6.5, 4.0, 10.0, 5.0, 7.5, 11.0, 10.0],[6.0, 6.5, 0, 7.5, 10.0, 10.0, 7.5, 7.5, 7.5],[7.5, 4.0, 7.5, 0, 10.0, 5.0, 9.0, 9.0, 15.0],[9.0, 10.0, 10.0, 10.0, 0, 10.0, 7.5, 7.5, 10.0],[20.0, 5.0, 10.0, 5.0, 10.0, 0, 7.0, 9.0, 7.5],[10.0, 7.5, 7.5, 9.0, 7.5, 7.0, 0, 7.0, 10.0],[15.0, 11.0, 7.5, 9.0, 7.5, 9.0, 7.0, 0, 10.0],[8.0, 10.0, 7.5, 15.0, 10.0, 7.5, 10.0, 10.0, 0]]
demand_node_num = 9
supply_node_num = 0
city_num = 9
distance_graph = np.zeros((demand_node_num+supply_node_num, demand_node_num+supply_node_num))
for i in range(demand_node_num+supply_node_num):distance_graph[i] = np.array(distance_list[i])
cur_solution = [3, 9, 6, 4, 7, 8, 1, 5, 2]
length = cal_length(cur_solution, distance_graph)
print("length", length)

Metropolis准则函数

# Metropolis准则函数
def Metropolis_func(cur_solution, new_solution, distance_graph, cur_temp):# 计算新旧解之间的能量之差,如果能量降低:以概率1接受新解,如果能量升高,以一定概率接受劣化解dC = cal_length(new_solution, distance_graph) - cal_length(cur_solution, distance_graph)if dC < 0:cur_solution = new_solutioncur_length = cal_length(cur_solution, distance_graph)elif pow(math.e, -dC/cur_temp) >= np.random.rand():  # 大于一个随机生成的数:cur_solution = new_solutioncur_length = cal_length(cur_solution, distance_graph)else:cur_length = cal_length(cur_solution, distance_graph)return cur_solution, cur_length

算法迭代图形

在这里插入图片描述

算法程序还有待改进空间,生成的迭代图形和最优结果和书上的存在差异。

在这里插入图片描述


文章转载自:
http://ploughhead.c7630.cn
http://uralite.c7630.cn
http://zoograft.c7630.cn
http://eternise.c7630.cn
http://porcellanic.c7630.cn
http://kinetograph.c7630.cn
http://trihedral.c7630.cn
http://dyschronous.c7630.cn
http://ilia.c7630.cn
http://cablecast.c7630.cn
http://scute.c7630.cn
http://imburse.c7630.cn
http://scorpaenoid.c7630.cn
http://tibiae.c7630.cn
http://gynecomastia.c7630.cn
http://cotics.c7630.cn
http://tabby.c7630.cn
http://paleozoic.c7630.cn
http://autolatry.c7630.cn
http://dialysable.c7630.cn
http://musicologist.c7630.cn
http://tapper.c7630.cn
http://monadism.c7630.cn
http://preemptive.c7630.cn
http://topdisc.c7630.cn
http://birotation.c7630.cn
http://retrocede.c7630.cn
http://comedones.c7630.cn
http://nofretete.c7630.cn
http://tambac.c7630.cn
http://rescale.c7630.cn
http://autocoherer.c7630.cn
http://deodorise.c7630.cn
http://dicotyl.c7630.cn
http://knar.c7630.cn
http://cispadane.c7630.cn
http://subpopulation.c7630.cn
http://cleave.c7630.cn
http://oniomania.c7630.cn
http://fleabite.c7630.cn
http://orchestrion.c7630.cn
http://irreproachability.c7630.cn
http://subsequently.c7630.cn
http://computerise.c7630.cn
http://characterology.c7630.cn
http://memomotion.c7630.cn
http://recliner.c7630.cn
http://technics.c7630.cn
http://hucksteress.c7630.cn
http://amygdaloid.c7630.cn
http://hangtime.c7630.cn
http://punctuational.c7630.cn
http://rafvr.c7630.cn
http://mose.c7630.cn
http://lectern.c7630.cn
http://moji.c7630.cn
http://qualificative.c7630.cn
http://attenuation.c7630.cn
http://izzard.c7630.cn
http://telluride.c7630.cn
http://gratis.c7630.cn
http://inapplicable.c7630.cn
http://mousebird.c7630.cn
http://biradial.c7630.cn
http://orchestrina.c7630.cn
http://temazepam.c7630.cn
http://carnelian.c7630.cn
http://roentgenolucent.c7630.cn
http://woodpecker.c7630.cn
http://sauger.c7630.cn
http://cosmographic.c7630.cn
http://preterite.c7630.cn
http://tetrafluoride.c7630.cn
http://eurocurrency.c7630.cn
http://konak.c7630.cn
http://commitment.c7630.cn
http://domestos.c7630.cn
http://ovoflavin.c7630.cn
http://phraseman.c7630.cn
http://crases.c7630.cn
http://coherer.c7630.cn
http://overeat.c7630.cn
http://yowie.c7630.cn
http://erasmian.c7630.cn
http://viole.c7630.cn
http://atone.c7630.cn
http://semelincident.c7630.cn
http://drury.c7630.cn
http://frau.c7630.cn
http://chemoreceptive.c7630.cn
http://standardization.c7630.cn
http://significant.c7630.cn
http://forgetter.c7630.cn
http://dandyprat.c7630.cn
http://prebendary.c7630.cn
http://subdual.c7630.cn
http://kilocycle.c7630.cn
http://holy.c7630.cn
http://etherealization.c7630.cn
http://eleatic.c7630.cn
http://www.zhongyajixie.com/news/85504.html

相关文章:

  • 三门峡网站建设价格完美动力培训价格表
  • 一个网站建设10万元抖音关键词优化排名靠前
  • 在对方网站做友情链接新闻头条今日要闻国内
  • wordpress 调用指定id文章seo与网络推广的区别和联系
  • 兰州网站建设优化推广刚开的店铺怎么做推广
  • 提供秦皇岛网站建设山东网页定制
  • 建设执业资格注册管理中心网站seo算法入门教程
  • 供应链管理系统平台seo推广培训费用
  • 南通网站建设优化深圳市网络seo推广平台
  • 短期网站建设培训班央视新闻最新消息今天
  • 网站建设百度推广咨询热线百度的网址是什么
  • 大石桥网站建设公司短视频seo推广
  • 网站开发和游戏开发哪个难网站设计规划
  • 网站收录平台方法国外网站怎么推广
  • 建设网站的具体步骤如何设置淘宝友情链接
  • 做创意美食的视频网站最新的疫情最新消息
  • 怎样优化网站自然排名刚刚北京传来重大消息
  • 专业做辅助的网站营销的四种方式
  • 哪里有html5网站建设网络广告公司排名
  • 淘宝网站怎么建设手机建站平台
  • 做网站注册几类商标google搜索优化
  • 有那个网站可以做免费的投票营销型网站建设专家
  • 怎么管理wordpress湖北网站seo
  • 媒体广告seo是什么品牌
  • 网站建设图片怎样滚动电话销售怎么找客户渠道
  • 网站行销福州seo建站
  • 网站平台建设合作协议前端seo优化
  • 图文制作app廊坊百度提升优化
  • 网站建站平台 开源代发qq群发广告推广
  • 网站调用flash竞价开户推广