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

企业网站 建设公司长沙定制网站建设

企业网站 建设公司,长沙定制网站建设,网站建设要学哪些软件有哪些方面,久久诗歌网/* Simulated Annealing(模拟退火算法) 求解旅行商问题(TSP) 网上给的数据是31个省会的坐标#xff0c;蚁群算法得到的结果是#xff1a;15378 我算的结果中#xff0c;最好的一次是#xff1a;15495 */ #includeiostream #includecstdio #includecstd…  /* Simulated Annealing(模拟退火算法) 求解旅行商问题(TSP) 网上给的数据是31个省会的坐标蚁群算法得到的结果是15378 我算的结果中最好的一次是15495 */ #includeiostream #includecstdio #includecstdlib //#includectime #includecmath #includetime.h #define N 31 //城市个数 #define Tmax 8000 //初始温度 #define Tmin 1E-10 //终止温度 #define RATE 0.95 //温度衰减率 #define in_loop 13000 //内层循环次数 #define out_loop 2000 //外层循环次数 #define p_limit 10000 //概率选择次数using namespace std;//31个省会x和y的坐标 double x[N]{1304,3639,4177,3712,3488,3326,3238,4196,4312,4386,3007,2562,2788,2381,1332,3715,3918,4061,3780,3676,4029,4263,3429,3507,3394,3439,2935,3140,2545,2778,2370}; double y[N]{2312,1315,2244,1399,1535,1556,1229,1004,790,570,1970,1756,1491,1676,695,1678,2179,2370,2212,2578,2838,2931,1908,2367,2643,3201,3240,3550,2357,2826,2975};//两个城市之间的距离 double d[N][N];void init(){//初始化任意两个城市的距离for(int i0;iN;i)for(int j0;ji;j){d[i][j]d[j][i]sqrt((y[j]-y[i])*(y[j]-y[i])(x[j]-x[i])*(x[j]-x[i]));}for(int i0;iN;i)d[i][i]0;srand((unsigned)time(0)); }//路径 class path{ public:path(){}~path(){}int city[N]; //依次经过的城市编号double dis; //总的距离void totalLen(){dis0;for(int i0;iN-1;i)disd[city[i]][city[i1]];disd[city[0]][city[N-1]];} };//最优解 path bestpath;//产生新路径 path newpath(path prepath){path newp prepath;int x,y,t;do{xrand()%N;yrand()%N;}while(xy);tnewp.city[x];newp.city[x]newp.city[y];newp.city[y]t;newp.totalLen();return newp; }//Annealing void Anne() {init();//随机选一个初始解for(int i0;iN;i)bestpath.city[i]i;bestpath.totalLen();int out_t0,p_t0;double TTmax,delta,prob, rnd;path np,cp; //新路径当前路径cpbestpath;while(out_tout_loopTTmin){for(int i0;iin_loop;i){npnewpath(cp);if(np.discp.dis){cpnp;out_t0;p_t0;}else{deltanp.dis-cp.dis;probexp(-delta/T);rndrand()%10000/10000.0;if(probrnd)cpnp;p_t;}if(p_tp_limit){out_t;break;}}if(cp.disbestpath.dis)bestpathcp;T*RATE;printf(dis %f\n,bestpath.dis);} }int main() {Anne();return 0; }  转载于:https://www.cnblogs.com/littlehoom/p/3612306.html
http://www.yutouwan.com/news/367070/

相关文章:

  • 海淀营销型网站建设上海网站开发哪家好
  • 哪个网站做衣服的自己怎么设计公司的logo
  • 南宁北京网站建设网站做收录是什么意思
  • 怎么做淘宝优惠卷网站alexa网站排名
  • 公司做网站需要提供什么资料南昌二手网站开发方案
  • 美食网站建设的可行性定制网站建设推广服务
  • 小型网站建设参考文献重庆百度seo排名
  • cad做彩图那个网站应用好用做电影网站收入
  • 苏州品牌网站设计企业深圳软件定制开发服务
  • 网站开发女生可以做吗建设银行网站证书
  • 湖北省建设主管部门网站万户网站建设
  • 2023企业所得税300万以上宁陵县网站seo
  • 校园网站的作用简书网站开发
  • 苏州做网站公司速找苏州聚尚网络自己怎么设计3d装修图
  • 政务网站建设规范intitlt 山西大同网站建设
  • 做网站 橙色怎么搭配官方网站下载穿越火线
  • 东莞网站建设方案企业kindeditor wordpress
  • 常用的网站推广方法有哪些织梦网站自助申请友链代码
  • 爱站网关键字查询网站如何实现微
  • 贵州网站建设服务平台网站认证打款怎么做分录
  • 长沙网站设计宁波自助建网站
  • 网站制作的基本流程专门做黄昏恋的网站
  • 做网站流程内容珠海网站搜索引擎优化
  • 制作投票网站移动互联网开发专业怎么样
  • 网站有哪些功能如何制作餐馆网站
  • html5 学习网站自适应 WordPress 主题
  • 做笑话网站ps软件网站有哪些功能
  • 代理公司代理注册流程seo排名点击器曝光行者seo
  • 学习网站 现状桂林网络推广外包
  • 通州区住房和城乡建设部网站dede单本小说网站源码