蚁群算法 C语言程序(已运行).doc
Basic Ant Colony Algorithm for TSP include include include include include include include define N 31 city size define M 31 ant number double inittao1; double taoNN; double detataoNN; double distanceNN; double yitaNN; int tabuMN; int routeMN; double solutionM; int BestRouteN; double BestSolution10000000000; double alfa,beta,rou,Q; int NcMax; void initparametervoid; initialize the parameters of basic ACA double ueSolutionint *a; uate the solution of TSP, and calculate the length of path void InCityXY double x, double y, char *infile ; the nodes coordinates of TSP void initparametervoid alfa1; beta5; rou0.9; Q100; NcMax200; void mainvoid int NC0; initparameter; double xN; double yN; InCityXY x, y, “city31.tsp“ ; forint i0;idrand break; tabukj1; routeksj; s; the pheromone is updated fori0;i20 taoij20; fork0;k filen“; exit0; result filen“; exit0; int i0; while inxyfile.eof inxyfilexiyi; if i N break; 本文来自 CSDN 博客,转载请标明出处