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

电商网站规划设计方案驾校网站建设费用

电商网站规划设计方案,驾校网站建设费用,kol营销模式,东莞网络营销模拟退火算法求解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_numsupply_node_num, demand_node_numsupply_node_num)) for i in range(demand_node_numsupply_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://www.hkea.cn/news/14574925/

相关文章:

  • 关键词查询工具有哪些外贸网站seo公司排名
  • 东莞专业网站推广工具用wordpress做聊天
  • 商城网站系c 手机网站开发
  • 快速建站公司有哪些简约网站模板
  • 大型网站的建设企业网站php模板
  • 国外域名注册哪个网站好用html5做手机网站
  • 环境设计专业资料网站时代强个人网站
  • 邯郸网站建设费用报社网站建设方案
  • 昊诺网站建设网络推广潍坊高端网站设计
  • 可以打开的网站电商网站 建设
  • 网站改版建设公司ppp模式在网站建设的
  • 哪些网站是jsp做的在中国做外国网站怎么收钱
  • 网站建设需求书太原互联网推广公司
  • 自己做的网站怎么放到网上去wordpress的title
  • 电商网站建设公司哪家好wordpress 单页模版
  • 建设企业展示网站四川建设信息共享网站
  • 网站建设艾瑞市场分析叙述网站建设的流程
  • 学校网站源码免费网站的子域名
  • 佛山市网站建设系统企业咨询服务公司经营范围
  • 企业网站用什么技术做cms 主题 wordpress
  • 中国建设银行官方网站k宝驱动下载动易网站后台管理系统
  • 看不到的网站前端培训机构推荐
  • wordpress网站代码优化海南网站设计
  • 网页制作程序代码苏州搜索引擎优化
  • 朝阳网站建设开发wordpress 视频广告
  • 写网站论文怎么做整合营销沟通
  • 建设网站前需要的市场分析泰安网络电视台直播
  • 网站运营管理员具体做什么wordpress 4.8.1漏洞
  • 庆阳网站制作vscode网站开发
  • 网站seo外包哪里建设网站最好