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

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? accl.c~

?? 螞蟻聚類算法源代碼(ant based clustering algorithm)
?? C~
?? 第 1 頁 / 共 2 頁
字號:
	/* check whether the spot is free	   and start search for near free position,            if necessary	*/            pos = env->searchdroppingsite(pos, dat); 	/* add item to grid, possibly remember it */	env->add(pos, dat);	if (memsize > 0) {	    mem->remember(dat, pos, alpha);	}	dat = FREE;      			/* now look for a data item to pick up */	while (dat == FREE) {	    /* try next candidate */	    position<int> temp_pos = env->next();	    int temp_data = (*env)(temp_pos[0],temp_pos[1]);	    /* examine local neighbourhood */	    double fvalue = env->f(temp_data, temp_pos, radius, int(nsize), scalefactor, par->clusterphase);	   	    /* probabilistic picking decision */	    if (ran0(&idum) < th_pick(fvalue)) {		/* pick up data item and remove it from the grid */		pos = temp_pos;		lastpos = pos;		dat = temp_data;		env->remove(pos);		return;	    }	}    }    else {	/* keep track of failures for alpha adaptation */	if (adapt == TRUE) {	    failure_ctr++;	}    }}/* computation of picking probability */inline double accl::ant::th_pick(double f) {      if (par->newprob == FALSE) {	return square(kp / (kp + f));    }    else {	if (f <= 1.0) return 1.0;	return 1.0 / (pow(f,2));    }}/* computation of dropping probability */inline double accl::ant::th_drop(double f) {     if (par->newprob == FALSE) {	return square(f / (kd + f));    }    else {	if (f >= 1.0) return 1.0;	return pow(f,4);    }}// well.... inline double accl::ant::square(double x) {    return x*x;}inline int accl::ant::ithmemory(int i) {    return mem->index[i];}inline int accl::ant::ithmemoryx(int i) {    return mem->pos[i][0];}inline int accl::ant::ithmemoryy(int i) {    return mem->pos[i][1];}/***************************************************     accl***************************************************//* constructor for an ACCL instance   memory allocation and computation of normalization factor*/accl::accl(conf * par, databin<USED_DATA_TYPE> * bin, evaluation * e):clalg(par, bin, e){    par->radius = par->initradius;    /* construction of the grid */    env = new grid(par, bin);      /* par->mu must have been computed before       the construction of the antcolony    */    colony = new antcolony(par, env);}/* destructor:   deletion of grid and ant colony*/accl:: ~accl() {    delete env;    delete colony;}/* initialisation of the algorithm:   requires the intialization of both the environment and the colony   environment muts be initialized first*/void accl::init() {       par->radius = par->initradius;    generation_ctr = 0;    env->init();}/* main routine of the algorithm   requires previous initialization*/void accl::run() {    par->clusterphase = TRUE;   /* let ants pick up a first data item */    colony->init();     generation_ctr++;        time_t start;    time_t end;     /* main loop        consisting of repeated phases of the algorithm       (subdivision used for evaluation purposes)    */    while (generation_ctr <= par->generations) {//	cout << generation_ctr << endl;	/* increase of radius */	if (generation_ctr % (int)(0.21*par->generations) == 0) {	    double nsize = 0.0;	    par->radius += 1;		    if (par->weighting == TRUE) {		for (int dx=0; dx <= par->radius; dx++) {		    for (int dy=1; dy <= par->radius; dy++) {			nsize += 4*exp(-double(max(dx, dy))/double(par->radius));		    }		}	    }	    if (par->increase == TRUE) {		for (int i=0; i<par->colonysize; i++) {   		    (*colony)[i].radius += 1;		    if (par->weighting == FALSE) {				    }		    else {			(*colony)[i].nsize = nsize;		    }		}	    }	}		/* clustering phases */	if (par->clustering == TRUE) {	    if (generation_ctr > 0.7*par->generations) {		if (generation_ctr > 0.55*par->generations) {		    par->clusterphase  = TRUE;		    		}		else if (generation_ctr > 0.45*par->generations) {		    par->clusterphase = TRUE;		}		else par->clusterphase = FALSE;	    }	}	// one generation consists of many individual actions	colony->cometolive();		generation_ctr++;    }     /* end of main loop */    colony->finish();}/* agglomerative construction of the clustering   starting from spatial mapping*/void accl::constructclustering() {    cout << "Cluster construction (using agglomerative clustering)" << endl;    /* distance matrixto reduce computational complexity */    tmatrix<USED_DATA_TYPE> dmatrix(par->binsize);    tmatrix<USED_DATA_TYPE> slinkmatrix(par->binsize);    int * currentsize = new int[par->binsize];    /* memory allocation */    int ** clusters = new int * [par->binsize];    position<double> ** docindex = new position<double>*[par->binsize];    for (int i=0; i<par->imax; i++) {	for (int j=0; j<par->jmax; j++) {	    if ((*env)(i,j) != FREE) {		docindex[(*env)(i,j)] = new position<double>(i, j);	    }	}    }    int num = par->binsize;    position<double> * centre = new position<double>[par->binsize];    /* initially each cluster contains one data element */    for (int i=0; i<par->binsize; i++) {	currentsize[i] = 1;	clusters[i] = new int[par->binsize+1];	clusters[i][0] = i;	for (int j=1; j<par->binsize+1; j++) {	    clusters[i][j] = FREE;	}    }    /* intialize distance matrix */    for (int i=0; i<par->binsize; i++) {	for (int j=0; j<i; j++) {	    dmatrix(i,j) = minlink(clusters[i], clusters[j], docindex);	    slinkmatrix(i,j) = dmatrix(i,j) / 2.0;	}    }    double minval = 0;    /* merge clusters until only one cluster is left       or stopping criteria is met */    while ( num > 1 ) {	minval = par->imax*par->jmax;	int minindex1 = 0;	int minindex2 = 0;    	/* determine the two closest clusters */	for (int i=0; i<par->binsize; i++) {	    if (clusters[i] == NULL) continue;	    for (int j=0; j<i; j++) {		if (clusters[j] == NULL) continue;			// This is the spot where we save computations, we just need to update the 		// matrix after each merging procedure (only one row though!!)		double d = dmatrix(i,j);		if (d < minval) {		    minval = d;		    minindex1 = i;		    minindex2 = j;		}	    }	}		//	if (minval >= 5) break;		if (minval >= par->radius) {	  break;	}	/* merge the two clusters */	int ptr=0;	while (clusters[minindex1][ptr] != FREE) {	    ptr++;	}	int i=0;	while (clusters[minindex2][i] != FREE) {	    clusters[minindex1][ptr++] = clusters[minindex2][i];	    i++;	}	delete [] clusters[minindex2];	clusters[minindex2] = NULL;	currentsize[minindex1] += currentsize[minindex2];	num--;	/* update row of distance matrix */	double quot; 	for (int i=0; i<par->binsize; i++) {	    if ( i!= minindex1 && clusters[i] != NULL) {		slinkmatrix(minindex1, i) = min(slinkmatrix(minindex1,i),slinkmatrix(minindex2,i));			if (currentsize[minindex1] < currentsize[i]) {		    quot = double(currentsize[minindex1]) / double(currentsize[i]);		}		else {		    quot = double(currentsize[i]) / double(currentsize[minindex1]);		}		double weight = 1.0+log10(1.0+9.0*quot);		dmatrix(minindex1,i) = slinkmatrix(minindex1,i)*weight;	    }	}    }     /* detect clusters that are too small (smaller or equal to 2) */    int * toosmall = new int[par->binsize];    int toosmallctr = 0;     for (int i=0; i<par->binsize; i++) {	if (clusters[i] == NULL) continue;	else {	    int j=0; 	    	 	    while (clusters[i][j] != FREE) {		j++;	    }	    if (j <= 2) { 		toosmall[toosmallctr] = i;		toosmallctr++;    		num--;		    }	    else cout << j << endl;	}    }    /* remove the small clusters by merging them with the closest cluster */    int minindex = 0;    double mind = par->imax*par->jmax;    double d;    for (int i=0; i<toosmallctr; i++) {	cout << "Small cluster " << toosmall[i] << " corrected" << endl;	/* detect closest cluster */	for (int j=0; j<par->binsize; j++) {	start:	    if (toosmall[i] == j) continue;	    for (int k=0; k<toosmallctr; k++) {		if (toosmall[k] == j) {		    if (j < par->binsize-1) {			j++;			goto start;		    }		    else goto ende;		}	    }	    if (clusters[j] != NULL) {		d = minlink(clusters[toosmall[i]], clusters[j], docindex);		if (d < mind) {		    minindex = j;		    mind = d;		}	    }	}    ende:	cout << "Merging cluster " << minindex << " and " << toosmall[i] << endl;	/* merge them */    	int ptr=0;	while (clusters[minindex][ptr] != FREE) {	    ptr++;	}	int j=0;	while (clusters[toosmall[i]][j] != FREE) {	    clusters[minindex][ptr++] = clusters[toosmall[i]][j];	    j++;	}	delete [] clusters[toosmall[i]];	clusters[toosmall[i]] = NULL;    }    /* generate clustering object */    clust = new clustering(par);    clust->init(num);    int ctr = 0;    for (int i=0; i<par->binsize; i++) {	if (clusters[i] == NULL) continue;	else {	    int j=0; 	    data<USED_DATA_TYPE> datacentre(par);	 	    while (clusters[i][j] != FREE) {		int index = clusters[i][j];		(*clust)[index] = ctr;		datacentre.add((*bin)[index]);		j++;	    }	    datacentre.div(j);	    clust->newcentre(ctr, &datacentre);	    ctr++;	}    }    cout << "Number of clusters: " << num << endl;    }/* modified single link linkage metric */double accl::minlink(int * cluster1, int * cluster2, position<double> ** docindex) {    double mind = par->imax*par->jmax;    int i=0;    int ctr1 = 0;    int ctr2 = 0;    int ctr = 0;     while (cluster1[i] != FREE) {	int j=0;	int d1 = cluster1[i];	ctr1++;	ctr2 = 0;	while (cluster2[j] != FREE) {	    int d2 = cluster2[j];	    double d = env->spatialdistance(docindex[d1], docindex[d2], TRUE);	    mind = min(mind, d);	    j++;	    ctr2++;	    ctr++;	}	i++;    }    /* weighting factor */    double quot = double(ctr1) / double(ctr2);    if (ctr1 > ctr2) {	quot = double(ctr2) / double(ctr1);    }    quot = 1.0 + log10(1.0+9.0*quot);	    return mind*quot;}            

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
91久久久免费一区二区| 玖玖九九国产精品| 日韩国产一区二| 激情成人综合网| 成人激情图片网| 91官网在线观看| 日韩女优视频免费观看| 欧美国产精品久久| 亚洲黄色免费电影| 久久国产日韩欧美精品| 成人污视频在线观看| 欧美在线一区二区三区| 精品播放一区二区| 亚洲欧美精品午睡沙发| 日本欧美久久久久免费播放网| 国产乱码精品一区二区三区av| 色哟哟国产精品| 欧美大肚乱孕交hd孕妇| 亚洲日本在线天堂| 另类小说欧美激情| 91免费观看在线| 日韩欧美aaaaaa| 夜夜揉揉日日人人青青一国产精品| 男男视频亚洲欧美| 日本久久电影网| 国产无一区二区| 日韩高清国产一区在线| 99在线精品免费| 精品精品欲导航| 亚洲最新视频在线播放| 国产精品一区二区视频| 欧美日韩精品欧美日韩精品一综合| 中文字幕欧美国产| 美女mm1313爽爽久久久蜜臀| 91丝袜高跟美女视频| 久久综合九色综合欧美就去吻| 一个色在线综合| 99视频精品免费视频| 337p粉嫩大胆色噜噜噜噜亚洲| 亚洲国产一区二区三区青草影视| 国产成人免费9x9x人网站视频| 欧美一区二区不卡视频| 亚洲永久精品国产| 99精品国产91久久久久久| 久久久蜜桃精品| 久久精品噜噜噜成人av农村| 欧美色涩在线第一页| 中文字幕日韩欧美一区二区三区| 国产综合久久久久久久久久久久 | ㊣最新国产の精品bt伙计久久| 看片的网站亚洲| 欧美精品久久久久久久久老牛影院| 国产精品久久久一本精品| 国产一区二区毛片| 日韩视频一区二区| 婷婷综合久久一区二区三区| 色综合久久中文综合久久牛| 中文字幕乱码亚洲精品一区| 激情综合五月天| 日韩女优av电影| 日韩不卡手机在线v区| 欧美主播一区二区三区美女| 日韩伦理av电影| www.亚洲色图.com| 国产欧美一区二区精品性色| 国产精品一区二区视频| 久久精品夜色噜噜亚洲a∨| 久久av老司机精品网站导航| 日韩女优制服丝袜电影| 伦理电影国产精品| 精品精品欲导航| 国产精品一区二区三区乱码| 久久精品视频在线免费观看| 国产精品一区二区免费不卡 | 国产精品伊人色| 久久视频一区二区| 国产乱人伦偷精品视频不卡 | 懂色一区二区三区免费观看| 国产欧美精品一区二区色综合| 国产酒店精品激情| 久久久噜噜噜久噜久久综合| 国产成人精品一区二区三区网站观看| 久久久一区二区三区捆绑**| 国产精品一区二区你懂的| 中文子幕无线码一区tr| 97精品超碰一区二区三区| 亚洲乱码精品一二三四区日韩在线| 一本色道久久综合亚洲91| 一区二区三区四区激情 | 婷婷综合久久一区二区三区| 欧美一级高清大全免费观看| 久久精品99国产精品日本| 欧美mv日韩mv| 波多野结衣中文一区| 一区二区三区四区在线免费观看 | 日本91福利区| 精品国产乱码久久久久久久| 国产精品一色哟哟哟| 亚洲欧洲日韩在线| 欧美性欧美巨大黑白大战| 日韩成人免费电影| 国产亚洲成aⅴ人片在线观看 | 亚洲日本护士毛茸茸| 色999日韩国产欧美一区二区| 一区二区三区不卡视频 | 久久精品久久精品| 亚洲国产精品t66y| 色综合久久中文字幕综合网| 首页国产欧美久久| 2023国产精品| 91天堂素人约啪| 秋霞电影网一区二区| 中文字幕欧美国产| 欧美日韩中文国产| 韩国中文字幕2020精品| 亚洲欧美怡红院| 日韩一级二级三级精品视频| 懂色av一区二区三区蜜臀| 一卡二卡欧美日韩| 精品国产成人系列| 99re亚洲国产精品| 免费成人av在线播放| 国产精品久久久久久久岛一牛影视 | 精品国精品自拍自在线| 99久久国产综合精品女不卡| 奇米影视7777精品一区二区| 中文字幕乱码一区二区免费| 欧美日韩1区2区| av成人免费在线| 精品亚洲免费视频| 亚洲激情校园春色| 久久新电视剧免费观看| 欧美性生活久久| 成a人片亚洲日本久久| 日本va欧美va精品发布| 亚洲乱码中文字幕| 国产欧美一区二区三区在线老狼| 欧美二区三区的天堂| 91免费视频网址| 国产精品自产自拍| 日韩va亚洲va欧美va久久| 亚洲视频在线观看三级| 久久一留热品黄| 91精品国产美女浴室洗澡无遮挡| 99久久精品国产精品久久| 激情深爱一区二区| 石原莉奈一区二区三区在线观看| 国产精品福利av| 欧美成人精品1314www| 欧美系列日韩一区| 99re成人精品视频| 国产精品白丝jk白祙喷水网站| 日韩高清国产一区在线| 亚洲一区二区三区视频在线| 国产精品欧美一区二区三区| 久久综合国产精品| 日韩无一区二区| 欧美人狂配大交3d怪物一区| 91蜜桃在线观看| 成人av片在线观看| 国产成人免费在线观看不卡| 久久99精品一区二区三区| 五月开心婷婷久久| 亚洲v日本v欧美v久久精品| 亚洲精品国产成人久久av盗摄 | 成人精品国产免费网站| 久草中文综合在线| 男人的j进女人的j一区| 亚洲成人自拍网| 亚洲一区欧美一区| 亚洲精品成a人| 亚洲免费在线观看| 亚洲精品日韩一| 亚洲理论在线观看| 亚洲欧美另类小说视频| 日韩理论电影院| 亚洲你懂的在线视频| 亚洲美女少妇撒尿| 亚洲人成在线播放网站岛国| 中文字幕欧美区| 亚洲欧美在线高清| 亚洲日本青草视频在线怡红院| 亚洲欧美在线另类| 亚洲欧美成人一区二区三区| 综合av第一页| 亚洲曰韩产成在线| 天堂va蜜桃一区二区三区漫画版 | 日韩精品自拍偷拍| 日韩午夜精品电影| 久久综合五月天婷婷伊人| 久久综合九色综合欧美亚洲| 国产日韩在线不卡| 国产精品国产自产拍高清av| 亚洲特级片在线| 夜夜精品视频一区二区| 亚洲国产aⅴ天堂久久| 亚洲成人av中文| 天堂va蜜桃一区二区三区| 日本欧美久久久久免费播放网| 精品一区二区三区欧美|