资源简介
资源包含“遗传算法解决TSP问题”的相关代码(.cpp和.h)以及TSP相关的城市数据。
代码片段和文件信息
#include
#include
#include // 本文用于输出对齐
#include
#include
#include
#include “GA.h“
using namespace std;
int IndexCross_i;
int IndexCross_j;
// int _iter = 0;
int main(){
time_t T_begin = clock();
Graph G;
CreateGraph(G);
srand ( unsigned ( time(0) ) );
InitialGroup(G);
TSP_Evolution(G); // 遗传算法
time_t T_end = clock();
double RunningTime = double(T_end - T_begin) / CLOCKS_PER_SEC;
cout<
system(“pause“);
return 0;
}
void CreateGraph(Graph &G){
ifstream read_in;
read_in.open(“L:\\Coding\\TSP_遗传算法\\TSP_遗传算法\\city_150.txt“);
if (!read_in.is_open())
{
cout<<“文件读取失败.“< return;
}
read_in >> G.vex_num;
// read_in >> G.arc_num;
G.arc_num = 0;
for (int i = 0;i < G.vex_num; i++)
{
read_in >> G.vexs[i];
}
G.vexs[G.vex_num] = ‘\0‘; // char的结束符.
for (int i = 0; i < G.vex_num;i++
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 758 2016-11-13 00:07 GA_TSP\city_10.txt
文件 1098 2016-11-05 18:46 GA_TSP\city_12.txt
文件 1741 2016-11-15 01:25 GA_TSP\city_15.txt
文件 177347 2016-11-12 19:39 GA_TSP\city_150.txt
文件 1713 2017-01-17 20:37 GA_TSP\GA.h
文件 16909 2017-01-17 20:37 GA_TSP\TSP_遗传算法.cpp
目录 0 2017-01-17 21:46 GA_TSP
----------- --------- ---------- ----- ----
199566 7
相关资源
- 胡伟武_计算机体系结构课件_2017.zip
- ComputerArchitectureAQuantitativeApproach5th.p
- Classificationoftime-seriesimagesusingdeepcnn.
- 微擎小程序榆落微时光1.0.23小程序前
- S7-1200仿真教程.pdf
- 6908d19c7e04dbde289b4dec5403d7fb.rar
- 泛函分析:理论和应用.pdf
- _源代码.rar
- sogoupinyin-2.2.0.0102-2.zip
- 模式分析的核方法中文版和英文版合
- zw_qq_41143492-10381309-学生考试系统.zip
- zw_feifan50-9720417-MissionPlanner1.3.32PlayUA
- zw_weixin_42810059-10567648-数学分析考研笔
- 刺客.rar
- zw_DXF转G代码.zip
- 彩票开发源码.zip
- 斯坦福-IntroductiontoRobotics.zip
- zw_gephi-0.8.2-beta.setup.zip
- zw_嵌入式网络那些事(完整中文版)
- zw_WINDOWSAPI程序设计参考大全.zip
- zw_ssm-crm-new.zip
- zw_SolidWorks2014中文版基础教程.zip
- zw_Altera官方元件封装库.zip
- zw_AutofacIOC.zip
- zw_ionicDemo.zip
- Location虚拟定位ios12.1破解版.zip
- 流体模拟插件NextLimitRealFlowC4D2.6.5.00
- 老虎淘宝客v6.0.15.zip
- iSkysoft Video Converter Ultimate 5.1简体中文
- 20180704全彩种彩票网站源码.rar
评论
共有 条评论