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

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

?? sa_floor.cpp

?? test the resut l llke mjhue hbjhw hhww
?? CPP
字號:
/* File: SimulatedAnnealing.cpp * Author: Dan Gibson *         ECE 556 HW 3 * Contents: * The implementation of the functions required * for problem 1 of hw 3 * * Last modified: * Development platforms: Solaris 9, MS-DOS, WINNT * Intended platforms: Solaris 9 */#include "SA_floor.h"#include <stdio.h>				/* for fprintf */#include <math.h>				/* for floor and exp */#include <stdlib.h>				/* rand() and srand() */#include <time.h>				/* for time() */#include <string.h>				/* for strtok() */#ifndef NULL#define NULL 0x00000000#endif/********************************************************** * Function name: SimulatedAnnealing() * Author: Dan Gibson * * Parameters: * E0			A Floorplan object representing a starting *				solution. * lambda		The cooling rate parameter (0<lambda<1) *				Recommended = 0.85 * * Return value * * SimulatedAnnealing() returns the best solution found. * **********************************************************/void SimulatedAnnealing(Floorplan * E0,							   double lambda = 0.85,							   double T0 = 65536.0,							   double Tf = 10.0,							   unsigned int M1_prob = 4,							   unsigned int M2_prob = 2,							   unsigned int M3_prob = 1){	/* Variable declaration */	Floorplan * E;				 /* Current solution */	Floorplan * newE;			 /* Proposed next solution */	Floorplan * Best;			 /* Best solution so far */	double T;					 /* current temperature */	unsigned int uphill;		 /* Number of uphill moves									at a given temperature */	unsigned int MT;			 /* Total # moves at a given									temperature */	unsigned int prob_radix;	 /* Used to determine likelihood									of a given move type */	unsigned int reject;		 /* Number of rejections */	unsigned int N;				 /* An increasing function of									the number of modules */	unsigned int nModules;		 /* the number of modules in								    the floorplan */	unsigned int nOperators;	 /* the number of operators								    in the floorplan */	unsigned int best_cost;		 /* the cost of the best solution */	unsigned int current_cost;	 /* the cost of the current solution */	unsigned int new_cost;		 /* the cost of the new solution */	bool verbose;				 /* used to determine output */	int printed;				 /* used to format output */	unsigned int step;			 /* Keeps track of how many solutions									have been considered */	int delta_cost;		/* Parameter checking */	bool parameter_errors = false;	if(E0==NULL) {		fprintf(stderr,"SimulatedAnnealing: Parameter 1 (Floorplan * E0) is NULL\n");		parameter_errors = true;	}	if(lambda<=0||lambda>=1) {		fprintf(stderr,"SimulatedAnnealing: Parameter 2 (double lambda) is not 0<lambda<1\n");		parameter_errors = true;	}	if(parameter_errors) {		fprintf(stderr,"SimulatedAnnealing: Exited under abnormal conditions\n");		return;	}	/* Random number generator initialization (seed) */	srand(time(NULL));	/* Variable initialization */	E      = E0;	Best   = E0->Clone();	uphill = 0;	MT     = 0;	reject = 0;	step   = 0;		prob_radix = M1_prob+M2_prob+M3_prob;	nModules = E->getModuleCount();	nOperators = E->getOperatorCount();	if(nModules<15) N = nModules*nModules;
	else N = 2*nModules;	current_cost = E->getArea();	best_cost = current_cost;	verbose = nModules < 20;		// to define T:	T  = T0;	// print the initial solution	if(verbose) {		fprintf(stdout,"Initial Floorplan: ");		E->dumpList(); // dumpList faster than dumpTree	} else {		fprintf(stdout,"Initial");	}	fprintf(stdout," Cost: %i",current_cost);	fprintf(stdout,"\n\n***Start of Simulated Annealing***\n\n");	// outer REPEAT/UNTIL statement	// Note: ignores the OUT_OF_TIME concept	do{		// reset inner-loop variables		MT = uphill = reject = 0;		// inner REPEAT/UNTIL statement		do{			// Select a move to perform according			// to the probability parameters			unsigned int r = RandOnRange(1,prob_radix);			int M;			if(r<=M1_prob) M = 1;			else if(r<=M1_prob+M2_prob) M = 2;			else M = 3;			newE = E->Clone();			switch(M) {			case 1:				// do an M1-type move: swap two adjacent				// operators				// we want to swap a random pair of modules				while(!newE->M1( RandOnRange(1,nModules) )) {					//fprintf(stdout,"a");				}								break;			case 3:				// do an M3-type move: swap operand/operator				// if the floorplan is in a state to accept				// ANY M3-type move, then do it,				// otherwise do an inversion				if(newE->M3OK()) {					// want to swap Nth and (N+1)th operand/operator					while(newE->M3(RandOnRange(0,nModules+nOperators-1))!=0) {					//	fprintf(stdout,"c");					}					break;				}			case 2:
				// do an M2-type move: chain-invert operators

				// want to invert a random chain of operators
				while(newE->M2( RandOnRange(0,nOperators-1))==0) {
					//fprintf(stdout,"b");
				}

				break;			default:				// this can't happen, but it makes the compiler				// happy to have a default statement				return;			}			// considering another solution			step++;			// pretty-print the current step			printed = fprintf(stdout,"%i ",step);			for(int i=0;i<10-printed;i++) fprintf(stdout," ");			// pretty-print the polish expression if needed			if(verbose) newE->dumpList();			// something has been done to newE to make			// it different from E			new_cost = newE->getArea();			// print the cost			printed = fprintf(stdout,"  %i ",new_cost);			for(int j=0;j<10-printed;j++) fprintf(stdout," ");			// if verbose, print the temperature			if(verbose) fprintf(stdout,"%f ",T);			// increment # moves at current temerature			MT++;			// compute the difference in costs between current and			// new solutions			delta_cost = ((int) new_cost) - ((int) current_cost);			// if this happens to be the best solution so far,			// save it off!			if(new_cost<best_cost) {				// newE is better than Best!				best_cost = new_cost;				delete Best;				Best = newE->Clone();			}						if(delta_cost<0) {				// newE is better than E!, so				// automaticaly accept the solution				delete E;				E = newE;
				current_cost = new_cost;				// print acceptance				fprintf(stdout,"Y\n");			} else {				// newE is uphill from E				if(Rand01() < exp(((double)-delta_cost)/T)) {					// accept the new solution anyway,					// despite being and uphill move					uphill++;					delete E;					E = newE;					// print acceptance					fprintf(stdout,"Y\n");									} else {					// reject the move					reject++;					delete newE;					// print rejection					fprintf(stdout,"N\n");				}			}		} while(uphill<=N && MT <= 2*N);		// Temperature cools down		T = lambda * T;	}while(((double)reject) <= 0.99 * ((double) MT) &&		   (T>=Tf));	fprintf(stdout,"\n***End of Simulated Annealing***\n");	fprintf(stdout,"Final solution:\n");	Best->dumpList();	fprintf(stdout,"\n\nCost: %i\n",best_cost);

	// do the memory cleanup	delete E;	delete Best;
	return;	}unsigned int RandOnRange(unsigned int low, unsigned int high) {	return (rand()%(high-low+1))+low;};double Rand01() {	double retval;	retval = 0.001 * RandOnRange(0,999);	return retval;}Floorplan * ReadFloorplanFromFile(char * filename) {	Floorplan * f;	FILE * infile;	// open the file	infile = fopen(filename,"r");	if(infile==NULL) return NULL; // if file can't be opened, signal error	// file format is	// M<index> <height> <width>	int i1,h1,w1,i2,h2,w2;	char buff_in[1024];	char * token;	// read the first two lines separately from the	// rest, since the first two modules are 	// used in Floorplan's constructor	if(!fgets(buff_in,1024,infile)) return NULL;	// get the index of the first mod	token = strtok(buff_in,"M \t\n");	i1 = atoi(token);	// get the height of the first mod	token = strtok(NULL," \t\n");	if(token!=NULL) h1 = atoi(token);	else return NULL;	// get the width of the first mod	token = strtok(NULL," \t\n");	if(token!=NULL) w1 = atoi(token);	else return NULL;	// read in the second line	if(!fgets(buff_in,1024,infile)) return NULL;	// get the index of the second mod	token = strtok(buff_in,"M \t\n");	i2 = atoi(token);	// get the height of the second mod	token = strtok(NULL," \t\n");	if(token!=NULL) h2 = atoi(token);	else return NULL;	// get the width of the second mod	token = strtok(NULL," \t\n");	if(token!=NULL) w2 = atoi(token);	else return NULL;	// ready to call the constructor	f = new Floorplan(i1,w1,h1,i2,w2,h2);	// loop to read in the rest of the modules	while(fgets(buff_in,1024,infile)) {		token = strtok(buff_in,"M \t\n");		if(token!=NULL) i1 = atoi(token);		else continue; // ignore blank lines		token = strtok(NULL," \t\n");		if(token!=NULL) h1 = atoi(token);		else return f; // truncate file at incommplete specification		token = strtok(NULL," \t\n");		if(token!=NULL) w1 = atoi(token);		else return f;		f->AddModule(i1,w1,h1);	}	// close the file	fclose(infile);		return f;}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
91丨porny丨中文| 国产女人aaa级久久久级| 欧美mv日韩mv国产网站app| 国产精品麻豆一区二区| 日韩av电影天堂| 91色在线porny| 久久精品一区二区三区不卡 | 伊人开心综合网| 韩国成人精品a∨在线观看| 欧美怡红院视频| ...中文天堂在线一区| 精品一区二区三区视频在线观看| 欧美私模裸体表演在线观看| 欧美国产日韩在线观看| 麻豆精品一区二区| 欧美丰满少妇xxxbbb| 亚洲人亚洲人成电影网站色| 国产成人在线观看| 欧美精品一区二区久久久| 夜夜嗨av一区二区三区| av资源网一区| 国产精品美女一区二区| 国产成人8x视频一区二区| 日韩欧美中文字幕精品| 日日夜夜免费精品| 欧美日韩aaaaa| 亚洲一区二区美女| 欧美午夜在线观看| 一区二区三区四区国产精品| 94-欧美-setu| 亚洲欧美日韩中文字幕一区二区三区 | 精品sm捆绑视频| 日本不卡在线视频| 日韩一区二区高清| 久久99国产精品免费网站| 欧美一区二区在线视频| 免费欧美在线视频| 精品久久久久久综合日本欧美| 日本中文字幕一区| 26uuu另类欧美亚洲曰本| 激情五月婷婷综合网| 久久精品夜色噜噜亚洲aⅴ| av亚洲精华国产精华精| 亚洲视频在线一区二区| 欧美中文字幕不卡| 亚洲成人免费观看| 日韩一区二区高清| 国产成人一区二区精品非洲| 国产精品亲子乱子伦xxxx裸| 成人99免费视频| 亚洲国产美国国产综合一区二区| 欧美性视频一区二区三区| 日韩和欧美一区二区| 日韩免费福利电影在线观看| 国产一区视频导航| ...av二区三区久久精品| 欧美三级乱人伦电影| 奇米精品一区二区三区四区 | 欧美国产日韩精品免费观看| 91麻豆国产在线观看| 五月激情六月综合| 国产偷国产偷精品高清尤物| 99re这里只有精品6| 天天色天天爱天天射综合| 精品免费99久久| 91免费小视频| 强制捆绑调教一区二区| 欧美国产精品一区二区三区| 91电影在线观看| 国产一区二区电影| 一区二区在线观看视频| 欧美mv日韩mv亚洲| 欧美在线观看禁18| 国内精品视频一区二区三区八戒 | 日韩中文字幕av电影| 久久伊99综合婷婷久久伊| 99re亚洲国产精品| 久久精品理论片| 一区二区三区四区亚洲| 国产欧美一区视频| 欧美日韩国产综合久久 | 亚洲国产高清aⅴ视频| 欧美剧情片在线观看| 成人三级在线视频| 精品一区二区在线观看| 亚洲黄色性网站| 国产精品毛片无遮挡高清| 日韩欧美一级精品久久| 欧美在线观看18| thepron国产精品| 国产真实精品久久二三区| 亚洲国产日韩在线一区模特| 国产精品色在线观看| 精品国产免费久久| 91麻豆精品国产自产在线 | 国模一区二区三区白浆| 亚洲制服丝袜av| 中文字幕永久在线不卡| 欧美精品一区二区三区在线 | 色婷婷av一区| 成人a区在线观看| 国产激情视频一区二区在线观看| 亚洲h在线观看| 亚洲国产日韩av| 一区二区三区加勒比av| 亚洲三级在线免费观看| 国产精品欧美经典| 国产精品久久免费看| 久久精品亚洲麻豆av一区二区 | 国产精品久久久久影院亚瑟 | 国产福利一区二区三区视频| 日韩av在线播放中文字幕| 午夜欧美在线一二页| 亚洲一区二区不卡免费| 亚洲影院免费观看| 亚洲香蕉伊在人在线观| 一区二区三区四区在线播放| 一卡二卡三卡日韩欧美| 亚洲一区二区在线视频| 亚洲小说欧美激情另类| 偷拍自拍另类欧美| 日本aⅴ免费视频一区二区三区| 五月婷婷综合网| 青青草原综合久久大伊人精品| 午夜电影一区二区| 久久精品国产99国产精品| 免费观看一级欧美片| 久久99久久99精品免视看婷婷| 久久99深爱久久99精品| 精品夜夜嗨av一区二区三区| 韩国欧美国产1区| 国产.欧美.日韩| 一本大道久久a久久综合婷婷| 一本久道久久综合中文字幕| 欧美亚洲另类激情小说| 欧美一区二区三区视频免费播放| 精品三级在线观看| 亚洲国产成人自拍| 一区二区三区日韩欧美| 日韩av一区二| 国产精品 欧美精品| 91免费看片在线观看| 欧美丰满少妇xxxbbb| 久久久www免费人成精品| 欧美国产精品中文字幕| 亚洲综合色网站| 精品一区二区在线免费观看| 成人av中文字幕| 欧美亚洲动漫精品| 精品国产成人系列| 亚洲丝袜美腿综合| 奇米色一区二区| 91丨九色丨蝌蚪富婆spa| 在线播放视频一区| 国产亚洲美州欧州综合国| 亚洲柠檬福利资源导航| 麻豆成人久久精品二区三区红| 成人av在线播放网站| 欧美日韩黄色影视| 中文成人综合网| 蜜桃视频一区二区| 一本一道波多野结衣一区二区| 日韩一区二区三区视频在线观看| 国产精品毛片a∨一区二区三区| 亚洲综合偷拍欧美一区色| 国产精品一品视频| 欧美精品v国产精品v日韩精品| 国产精品久久影院| 精品一区二区三区不卡| 欧美在线一二三四区| 国产网红主播福利一区二区| 日韩经典一区二区| 色哟哟国产精品| 国产日本亚洲高清| 日本中文字幕一区| 色综合 综合色| 国产精品―色哟哟| 国产自产视频一区二区三区| 欧美日韩一级黄| 亚洲一区二区在线免费观看视频 | 亚洲成人三级小说| 成人国产亚洲欧美成人综合网| 日韩精品最新网址| 亚洲成年人影院| 色综合av在线| 亚洲精品亚洲人成人网在线播放| 国产乱淫av一区二区三区| 日韩一级黄色大片| 青青青伊人色综合久久| 欧美日韩在线播放一区| 亚洲精品免费看| 日本精品一级二级| 国产精品成人免费| 成人h动漫精品一区二区| 国产午夜久久久久| 国产盗摄视频一区二区三区| 日韩精品一区二区在线| 美女被吸乳得到大胸91| 日韩视频免费直播| 久久av老司机精品网站导航|