亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? farthestinsertion.cpp

?? vrpsd 4---------------------------------------------------------
?? CPP
字號:
#include "Problem.h"#include "Solution.h"/*  farthestInsertion.cpp  Program with the implementation of the function farthestInsertion(), which   generates a vrpsd solution  according to the farthest insertion heuristic.  The solution to be built must be given in input.*/#include <fstream.h>#include <iostream.h>#include <vector>using namespace std;#include <cstdlib>#ifndef DBLMAX    #define DBLMAX 1E37#endifvoid farthestInsertion( Solution& solution ){  //Read problem pointer from input solution.  Problem* pp = solution.getProblem();  int n = pp->numberOfCustomers;  int s = 0; //The starting city MUST be 0, that is, the depot!  int end1=0, end2=0, farthest=0, i, index, j;  int  nextindex;  double  maxdist, inscost, newcost;    /* initialization */  vector<int> cycle(n);  vector<double> dist(n);  for (i=0; i<n; i++)    cycle[i] = -1;  cycle[s] = 0; //the depot is the starting customer.  /*	printf("\n");	for (i=0; i<n; i++)	for (j=0; j<n; j++) {		printf(" %i %i %4.0f  ",i,j,w[i,j]);	}  */    /* calcolo le distanze tra il nodo di partenza e tutti gli altri      in dist[i] c'e' sempre la distanza massima tra tra i nodi appartenenti al ciclo     e il nodi i  */  double* ptr;  double* w=(double *) malloc(n * n*sizeof(double));  for(int i=0; i<n; i++)    for (int j=0; j<n; j++)      w[n*i+j] = pp->distanceMatrix[i][j];  for (i=0, ptr=w+n*s ; i<n; i++, ptr++){    dist[i] = *ptr;    //cout << s << " " << i << " " << dist[i] << " " << w[s*n+i] << endl;// equivale al w /////////  }      /* main loop */    for (i=0; i<n-1; i++) {    maxdist = -DBLMAX;    for (j=0; j<n; j++)      if (cycle[j] == -1 && dist[j] > maxdist) {	maxdist = dist[j];	farthest = j;	/*				printf("max %f %i \n",maxdist,j);*/      }    inscost = DBLMAX;    index = s;    for (j=0; j<=i; j++) {      nextindex = cycle[index];      newcost = *(w+index*n+farthest) +	*(w+farthest*n+nextindex) - 	*(w+index*n+nextindex);      if (newcost < inscost) {	inscost = newcost;	end1 = index;	end2 = nextindex;      }      index = nextindex;    }    cycle[farthest] = end2;    cycle[end1] = farthest;        /* printf("%i %i %i \n",farthest,end1,end2);       printf("%f %f %f %f\n",inf,inscost,newcost,*tweight); */    for (j=0, ptr=w+farthest*n; j<n; j++, ptr++)      if (cycle[j] == -1 && *ptr < dist[j])	{	  /*			printf(" %i %i %4.10f  %4.10f  %4.10f\n",farthest,j,dist[j],*ptr);				inserisco le nuove distanza tra il nodo e gli altri nodi 				in modo da sapere quelli che si sono avvicinati (saranno sfavoriti				dopo per  > maxdist */	  dist[j] = *ptr;	}  }  index = s;  for (i=0; i<n; i++) {    solution[i] = index;	    index = cycle[index];  }  free(w);  }void randomizedFarthestInsertion(Random* rnd, Solution& solution ){  //Read problem pointer from input solution.  Problem* pp = solution.getProblem();  int n = pp->numberOfCustomers;  int s = (int)(rnd->next() * n);   int end1=0, end2=0, farthest=0, i, index, j;  int  nextindex;  double  maxdist, inscost, newcost;    /* initialization */  vector<int> cycle(n);  vector<double> dist(n);  for (i=0; i<n; i++)    cycle[i] = -1;  cycle[s] = s; //the initial cycle is the trivial one.  /*	printf("\n");	for (i=0; i<n; i++)	for (j=0; j<n; j++) {		printf(" %i %i %4.0f  ",i,j,w[i,j]);	}  */    /* calcolo le distanze tra il nodo di partenza e tutti gli altri      in dist[i] c'e' sempre la distanza massima tra tra i nodi appartenenti al ciclo     e il nodi i  */  double* ptr;  double* w=(double *) malloc(n * n*sizeof(double));  for(int i=0; i<n; i++)    for (int j=0; j<n; j++)      w[n*i+j] = pp->distanceMatrix[i][j];  for (i=0, ptr=w+n*s ; i<n; i++, ptr++){    dist[i] = *ptr;    //cout << s << " " << i << " " << dist[i] << " " << w[s*n+i] << endl;// equivale al w /////////  }      /* main loop */    for (i=0; i<n-1; i++) {    maxdist = -DBLMAX;    for (j=0; j<n; j++)      if (cycle[j] == -1 && dist[j] > maxdist) {	maxdist = dist[j];	farthest = j;	/*				printf("max %f %i \n",maxdist,j);*/      }    inscost = DBLMAX;    index = s;    for (j=0; j<=i; j++) {      nextindex = cycle[index];      newcost = *(w+index*n+farthest) +	*(w+farthest*n+nextindex) - 	*(w+index*n+nextindex);      if (newcost < inscost) {	inscost = newcost;	end1 = index;	end2 = nextindex;      }      index = nextindex;    }    cycle[farthest] = end2;    cycle[end1] = farthest;        /* printf("%i %i %i \n",farthest,end1,end2);       printf("%f %f %f %f\n",inf,inscost,newcost,*tweight); */    for (j=0, ptr=w+farthest*n; j<n; j++, ptr++)      if (cycle[j] == -1 && *ptr < dist[j])	{	  /*			printf(" %i %i %4.10f  %4.10f  %4.10f\n",farthest,j,dist[j],*ptr);				inserisco le nuove distanza tra il nodo e gli altri nodi 				in modo da sapere quelli che si sono avvicinati (saranno sfavoriti				dopo per  > maxdist */	  dist[j] = *ptr;	}  }  index = 0; //The starting city MUST be 0, that is, the depot!  for (i=0; i<n; i++) {    solution[i] = index;	    index = cycle[index];  }  free(w);  }

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
综合自拍亚洲综合图不卡区| 在线成人免费观看| 色婷婷亚洲婷婷| 日韩午夜三级在线| 一区二区三区在线观看网站| 国产在线精品一区二区三区不卡| 91啦中文在线观看| 国产精品久线在线观看| 另类小说图片综合网| 欧美三级日韩在线| 亚洲欧美电影院| 岛国精品在线播放| 精品国产污网站| 免费看黄色91| 欧美一区二区三区在线观看| 一区二区久久久| 91蝌蚪porny九色| 国产精品久久久久一区二区三区| 久久99精品国产麻豆婷婷| 欧美日本国产视频| 天涯成人国产亚洲精品一区av| www.在线欧美| 国产精品乱码一区二区三区软件 | 欧美日韩一区不卡| 一区二区在线看| 色一情一乱一乱一91av| 亚洲人午夜精品天堂一二香蕉| 成人av一区二区三区| 中文天堂在线一区| 成人av在线资源网| 亚洲欧洲色图综合| 色偷偷成人一区二区三区91| 亚洲精品日韩专区silk| 一道本成人在线| 亚洲自拍偷拍av| 欧美日韩激情一区二区| 亚洲成人激情综合网| 91精选在线观看| 精品中文字幕一区二区小辣椒| 日韩一区二区三区精品视频| 美女国产一区二区三区| 精品国产123| 粉嫩嫩av羞羞动漫久久久 | 亚洲免费在线视频一区 二区| www.欧美精品一二区| 亚洲私人影院在线观看| 欧洲av一区二区嗯嗯嗯啊| 性欧美大战久久久久久久久| 日韩一区和二区| 国产精品中文有码| 亚洲色图视频网| 欧美日韩极品在线观看一区| 麻豆91在线看| 中文字幕巨乱亚洲| 欧美性猛交xxxx黑人交| 老司机免费视频一区二区 | 欧美日韩dvd在线观看| 青青草97国产精品免费观看无弹窗版| 精品国产乱码久久久久久夜甘婷婷| 国产精品一二三四区| 亚洲精品中文字幕在线观看| 久久久久国产精品人| 成人开心网精品视频| 一区二区三区美女| 久久久久久毛片| 欧美影院一区二区三区| 韩国v欧美v日本v亚洲v| 亚洲视频一区在线观看| 日韩欧美精品在线| 99久久婷婷国产综合精品| 日韩av午夜在线观看| 国产精品免费网站在线观看| 在线成人午夜影院| kk眼镜猥琐国模调教系列一区二区| 亚洲一区在线电影| 久久精品一区二区三区不卡| 欧美在线视频全部完| 国产91丝袜在线观看| 五月天婷婷综合| 中文字幕一区二区在线观看| 日韩女优视频免费观看| 色婷婷久久久亚洲一区二区三区| 精品亚洲免费视频| 亚洲成在线观看| 日韩码欧中文字| 日本一二三不卡| 精品国产一区二区三区忘忧草 | **网站欧美大片在线观看| 日韩欧美久久久| 欧美日韩情趣电影| av一区二区三区在线| 国产精选一区二区三区 | 亚洲一区在线免费观看| 国产亚洲一区二区三区四区| 欧美一三区三区四区免费在线看| av在线综合网| 99视频有精品| 粉嫩aⅴ一区二区三区四区五区| 蜜臀精品久久久久久蜜臀| 亚洲午夜私人影院| 亚洲精品老司机| 一区二区中文视频| 日韩美女视频一区二区| 国产精品日产欧美久久久久| xnxx国产精品| 久久久精品免费观看| ww亚洲ww在线观看国产| 精品国一区二区三区| 欧美成人a在线| 欧美不卡一二三| 欧美精品一区二区在线播放| 日韩女优制服丝袜电影| 欧美本精品男人aⅴ天堂| 日韩欧美视频一区| 欧美mv日韩mv| 久久久久国产精品麻豆| 精品国产成人系列| 国产亚洲精品资源在线26u| 26uuu国产在线精品一区二区| 亚洲精品一线二线三线| 久久亚洲精华国产精华液 | 国产91综合网| 国产91在线看| 99久久久精品免费观看国产蜜| 99久久精品免费看| 欧洲av一区二区嗯嗯嗯啊| 欧美日韩高清不卡| 日韩欧美一区在线观看| 久久精品欧美一区二区三区不卡| 国产欧美精品一区aⅴ影院| 国产精品美女www爽爽爽| 一区二区三区在线视频播放| 亚洲成人三级小说| 激情久久五月天| 暴力调教一区二区三区| 91福利社在线观看| 日韩一区二区在线播放| 欧美极品少妇xxxxⅹ高跟鞋| 亚洲欧美日韩精品久久久久| 午夜精品123| 国产精品99久久久久久久女警 | 免费成人av在线| 国产精品一二三四区| 91麻豆免费在线观看| 欧美一区二区三区免费视频| 国产视频911| 一区二区三区视频在线看| 蜜臀av一级做a爰片久久| 高清在线成人网| 欧美精品乱码久久久久久 | 成人一二三区视频| 欧美日韩一区二区在线观看| 久久综合国产精品| 亚洲国产成人tv| 国产精品99久久久久久久vr| 欧洲色大大久久| 久久亚洲捆绑美女| 亚洲123区在线观看| 国产91精品久久久久久久网曝门| 欧美日韩中文字幕一区二区| 精品999久久久| 亚洲成人动漫在线观看| 成人av电影免费观看| 日韩欧美一区二区视频| 1区2区3区欧美| 国产原创一区二区三区| 欧美日韩日本视频| 综合激情网...| 国产iv一区二区三区| 日韩亚洲欧美中文三级| 亚洲综合色在线| 99精品久久只有精品| 久久久另类综合| 老司机一区二区| 欧美精品在线视频| 一区二区在线观看免费| 成人av在线影院| 久久伊人中文字幕| 九色综合国产一区二区三区| 欧美三级一区二区| 一区二区三区丝袜| 91麻豆福利精品推荐| 国产视频一区二区在线| 激情欧美一区二区| 欧美成人vr18sexvr| 国产a久久麻豆| 日韩一区二区三区电影| 亚瑟在线精品视频| 色婷婷一区二区| 日韩一区在线看| av网站免费线看精品| 国产拍欧美日韩视频二区| 国产精品性做久久久久久| 精品久久久久久最新网址| 玖玖九九国产精品| 精品国产一区二区三区久久影院| 青青草国产精品97视觉盛宴| 欧美肥妇bbw| 激情综合网av| 国产亚洲综合色|