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

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

?? hgraph.cc

?? 實現把一個大電路劃分成兩個小電路
?? CC
字號:
#include <fstream.h>#include <math.h>#include <stdlib.h>#include <stdio.h>// #include <process.h>#include "hgraph.hpp"//#define debugvoid error(char* s, char* s2=""){   cerr<<s<<' '<<s2<<'\n';   exit(1);}cell::cell(int num,int side){   number=num;   block=side;   gainbucket=NULL;   gain=0;   gainfromlock=LOCKED;}net::net(int num){   number=num;   unlock[0]=unlock[1]=0;   lock[0]=lock[1]=0;}void parthgraph::getgraph(char *filename){   int side=0, count, padoffset, temp;   node *nnode;   char type, state, line[80];   FILE *fr;   srand(SEED);   balance[0]=0;   balance[1]=0;   fr = fopen(filename, "r");   if(!fr)  error("cannot open input file ",filename);   fscanf(fr, "%*d %*d %d %d %d", &numnets, &numcells, &padoffset);    cells=(cell*)new cell[numcells];   if(!cells) error("memory allocation error");   minsize[0]=minsize[1]=int(ceil(numcells*RATIO));   int size=numcells>>1;   int max[2]={size, numcells - size};  // max size of each part   // ***read in nodes   for(count=0;count<numcells;count++)   {	  cells[count].number=count;	  side=(rand() & 128)?1:0;	  if(balance[side]==max[side]) side=other(side);	  cells[count].block=side;	  cells[count].gainbucket=NULL;	  cells[count].gain=0;	  cells[count].gainfromlock=LOCKED;	  balance[side]++;   }   // ***read in nets   nets=(net*)new net[numnets];   if(!nets) error("memory allocation error");   count = -1;   while (fgets(line, 80, fr) != NULL)    {	  if (sscanf(line, "%c%d %c", &type, &temp, &state) != 3) 		 continue;	  if (type == 'p')		 temp += padoffset;	  if (state == 's') {		 count++;		 nets[count].number=0;		 nets[count].lock[0]=0;		 nets[count].lock[1]=0;		 nets[count].unlock[0]=0;		 nets[count].unlock[1]=0;	  }	  nnode=new node(count);	  if(!nnode) error("memory allocation error");	  cells[temp].first.addhead(nnode);//	  cells[temp].first.addtail(nnode);	  nnode=new node(temp);	  if(!nnode) error("memory allocation error");	  nets[count].first.addhead(nnode);//	  nets[count].first.addtail(nnode);	  nets[count].unlock[cells[temp].block]++;	  nets[count].number++;   }   pmax=0;   for(count=0;count<numcells;count++)   {	  if(cells[count].first.length>pmax)		 pmax=cells[count].first.length;   }   buckets[0]=(ll) new LL[2*pmax+1];   buckets[1]=(ll) new LL[2*pmax+1];   if(!buckets[0] || !buckets[1]) error("memory allocation error");}void parthgraph::initgains(void){   int count;   int from,to;   // ****calc gain of unlocked cells   for (count=0;count<numcells;count++)   {	  if(cells[count].gainfromlock==LOCKED)	  {		 cells[count].first.reset();		 from=cells[count].block;		 to=other(from);		 while(cells[count].first.current!=NULL)		 {			int nnum=cells[count].first.current->number;			if( (nets[nnum].unlock[from]+nets[nnum].lock[from])==1)			   cells[count].gain++;			if( (nets[nnum].unlock[to]+nets[nnum].lock[to])==0)			   cells[count].gain--;			cells[count].first++;		 }	  }   }   maxgain[0]=-pmax;   maxgain[1]=-pmax;   node *nnode;   for(count=0;count<numcells;count++)   {	  if(cells[count].gainbucket==NULL)	  {		 nnode=(node*)new node(count);		 if(!nnode) error("memory allocation error");		 cells[count].gainbucket=nnode;	  }	  else		 nnode=cells[count].gainbucket;	  buckets[cells[count].block][cells[count].gain+pmax].addhead(nnode);	  if(cells[count].gain>maxgain[cells[count].block])		 maxgain[cells[count].block]=cells[count].gain;   }#ifdef debug1   printCells();   exit(0);#endif}void parthgraph::part(void){   int prefix=0; // holds prefix sum of gains   int done=0;   //int joe=1;   passes=0;   // num of passes   while(!done)   {	  //  joe++;	  passes++;	  swapall();	  getprefix(prefix);	  	  //   if(prefix % 2)	  //     prefix--;	  if(prefix<=0)		 done=1;	  reinit(prefix);   }}void parthgraph::swapall(void){   int from,to;   cell *bestcell;   net *curnet;   int done=0;   bestcell=gethighest();   while(!done)   {#ifdef debug	  printBucket();	  printf("base cell=%d(%d) gain=%d\n", bestcell->number, bestcell->block, 			 bestcell->gain);	  char go;	  scanf(" %c", &go);#endif	  from=bestcell->block;	  to=other(from);	  bestcell->block=to;	  bestcell->gainfromlock=bestcell->gain;	  //bestcell->gainbucket=NULL;	  bestcell->first.reset();	  balance[from]--;	  balance[to]++;	  while(bestcell->first.current != NULL)	  {		 curnet=&nets[bestcell->first.current->number];		 if(curnet->lock[to]==0)		 {			if(curnet->unlock[to]==0)			   fixgain(curnet->first,1);			else if(curnet->unlock[to]==1)			   fixgain(curnet->first,-1,1,to);		 }		 curnet->unlock[from]--;		 curnet->lock[to]++;		 if(curnet->lock[from]==0)		 {			if(curnet->unlock[from]==0)			   fixgain(curnet->first,-1);			else if(curnet->unlock[from]==1)			   fixgain(curnet->first,1,1,from);		 }		 bestcell->first++;	  }	  bestcell=gethighest();	  if(bestcell==NULL)		 done=1;   }}void parthgraph::fixgain(LL &first,int operation,int single,int sameside){   cell *cellptr;   int block;   first.reset();   if(operation==1)   {	  while(first.current!=NULL)	  {		 cellptr=&cells[first.current->number];		 if(cellptr->gainfromlock==LOCKED)		 {			block=cellptr->block;			if( !single || (block==sameside) )			{			   if( cellptr->gain==maxgain[block] )				  maxgain[block]++;			   buckets[block][cellptr->gain+pmax].removenode(cellptr->gainbucket);			   cellptr->gain++;			   buckets[block][cellptr->gain+pmax].addhead(cellptr->gainbucket);			}		 }		 first++;	  }   }   else   {	  while(first.current!=NULL)	  {		 cellptr=&cells[first.current->number];		 if(cellptr->gainfromlock==LOCKED)		 {			block=cellptr->block;			if( !single || (block==sameside) )			{			   if( (cellptr->gain==maxgain[block]) && (buckets[block][cellptr->gain+pmax].length==1) )				  maxgain[block]--;			   buckets[block][cellptr->gain+pmax].removenode(cellptr->gainbucket);			   cellptr->gain--;			   buckets[block][cellptr->gain+pmax].addhead(cellptr->gainbucket);			}		 }		 first++;	  }   }}cell* parthgraph::gethighest(void){   cell *tmpcell=NULL;   node *tmpnode=NULL;   //static int swapside=0;  //*******force toggle swap   if( (maxgain[0]>=maxgain[1]) )   {	  if(balance[0]>=minsize[0])		 //  if(!swapside)  //******force toggle swap	  {		 tmpnode=buckets[0][maxgain[0]+pmax].removehead();		 if(tmpnode!=NULL)		 {			tmpcell=&cells[tmpnode->number];			free.addtail(tmpnode);		 }		 while( (!buckets[0][maxgain[0]+pmax].length) && (maxgain[0]>-pmax) )			maxgain[0]--;	  }   }   if(tmpcell==NULL)   {	  if(balance[1]>=minsize[1])		 //  if(swapside)  //*******force toggle swap	  {		 tmpnode=buckets[1][maxgain[1]+pmax].removehead();		 if(tmpnode!=NULL)		 {			tmpcell=&cells[tmpnode->number];			free.addtail(tmpnode);		 }		 while( (!buckets[1][maxgain[1]+pmax].length) && (maxgain[1]>-pmax) )			maxgain[1]--;	  }		 else		 {			tmpnode=buckets[0][maxgain[0]+pmax].removehead();			if(tmpnode!=NULL)			{			   tmpcell=&cells[tmpnode->number];			   free.addtail(tmpnode);			}			while( (!buckets[0][maxgain[0]+pmax].length) && (maxgain[0]>-pmax) )			   maxgain[0]--;		 }   }   //swapside=other(swapside);  //******force toggle swap   return tmpcell;}void parthgraph::getprefix(int& prenum){   int max=-pmax,current=0;   int curnum=0;   free.reset();   while(free.current!=NULL)   {	  current+=cells[free.current->number].gainfromlock;	  curnum++;	  if(max<current)	  {		 max=current;		 prenum=curnum;	  }	  free++;   }   if(max<=0)	  prenum=0;}void parthgraph::reinit(int prenum){   int count=0;   cell *cellptr;   if(free.length!=numcells)   {	  for(count=0;count<numcells;count++)	  {		 if(cells[count].gainfromlock==LOCKED)		 {			buckets[cells[count].block][cells[count].gain+pmax].removenode(cells[count].gainbucket);			cells[count].gain = 0;  // reset to 0 --WD		 }	  }   }   free.reset();   while(free.current!=NULL)   {	  count++;	  cellptr=&cells[free.current->number];	  if(count>prenum)	  {		 cellptr->block=other(cellptr->block);		 balance[cellptr->block]++;		 balance[other(cellptr->block)]--;	  }	  cellptr->gainfromlock=LOCKED;	  cellptr->gain=0;	  free.removenode(cellptr->gainbucket);	  free++;   }   for(count=0;count<numnets;count++)   {	  nets[count].lock[0]=0;	  nets[count].lock[1]=0;	  nets[count].unlock[0]=0;	  nets[count].unlock[1]=0;	  // ***build cell list for each net and initialize net	  nets[count].first.reset();	  while(nets[count].first.current!=NULL)	  {		 nets[count].unlock[ cells[nets[count].first.current->number].block ]++;		 nets[count].first++;	  }   }   initgains();}int parthgraph::cutset(void){   int cutset=0;   int count;   for(count=0;count<numnets;count++)   {	  //  if( ( (nets[count].unlock[0]>0) || (nets[count].lock[0]>0) ) &&	  //      ( (nets[count].unlock[1]>0) || (nets[count].lock[1]>0) ) )	  nets[count].first.reset();	  int sidezero=0;	  int sideone=0;	  while(nets[count].first.current!=NULL)	  {		 if(cells[nets[count].first.current->number].block==0)			sidezero=1;		 else			sideone=1;		 nets[count].first++;	  }	  if( (sideone==1) && (sidezero==1) )		 cutset++;   }   return cutset;}void parthgraph::print(char *str){   sprintf(str,"%i,%i,passes %i",balance[0],balance[1], passes);}void parthgraph::printCells(){   printf("Node\tPart\tGain\n");   for(int i=0; i<numcells; i++)   {      printf("%d\t%d\t%d\n", cells[i].number, cells[i].block, cells[i].gain);   }}void parthgraph::printBucket(){   for(int part=0; part<2; part++)   {      printf("****** Top Bucket in part %d *****\n", part);      buckets[part][maxgain[part]+pmax].reset();      while(buckets[part][maxgain[part]+pmax].current!=NULL)      {		 printf("%d\t", 				buckets[part][maxgain[part]+pmax].current->number);		 buckets[part][maxgain[part]+pmax]++;      }      printf("\n");   }}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲精品欧美综合四区| 一区二区不卡在线播放 | 亚洲精品一区二区三区蜜桃下载| 国产精品一区二区x88av| 亚洲国产va精品久久久不卡综合| 国产亚洲制服色| 欧美高清性hdvideosex| 99精品国产99久久久久久白柏| 免费成人av在线播放| 亚洲小说欧美激情另类| 国产精品免费网站在线观看| 日韩女优制服丝袜电影| 欧美日韩激情一区二区三区| eeuss鲁一区二区三区| 国产在线精品一区二区| 午夜精品久久久久影视| 亚洲三级视频在线观看| 欧美激情在线观看视频免费| 2欧美一区二区三区在线观看视频 337p粉嫩大胆噜噜噜噜噜91av | 91精品在线一区二区| 欧美亚一区二区| 色成年激情久久综合| 成人免费av在线| 国产aⅴ综合色| 国内欧美视频一区二区| 久久精品99国产精品| 日本中文一区二区三区| 丝袜诱惑制服诱惑色一区在线观看 | 91精品国产色综合久久ai换脸| 色婷婷av一区二区三区gif| 成人国产精品免费网站| 欧美猛男超大videosgay| 欧美影院精品一区| 色美美综合视频| 色久优优欧美色久优优| 成人免费视频国产在线观看| 精品一区二区三区视频| 久久不见久久见免费视频7| 免费亚洲电影在线| 麻豆精品视频在线观看免费| 久久国产综合精品| 国产综合久久久久久久久久久久 | 麻豆精品视频在线观看免费| 日本亚洲三级在线| 麻豆精品在线观看| 国产主播一区二区三区| 国产成人av影院| 国产99久久久国产精品潘金网站| 成人自拍视频在线| 日本精品视频一区二区| 精品污污网站免费看| 欧美一区二区久久| 精品日韩欧美一区二区| 久久综合九色欧美综合狠狠| 国产夜色精品一区二区av| 国产精品欧美综合在线| 一区二区三区成人在线视频| 日日骚欧美日韩| 激情综合一区二区三区| 成人午夜电影久久影院| 欧洲国产伦久久久久久久| 欧美老肥妇做.爰bbww| 精品国产污污免费网站入口| 中文字幕精品综合| 亚洲一区免费观看| 蜜臀av一区二区在线免费观看| 国产精一区二区三区| 一本色道久久综合狠狠躁的推荐| 欧美剧在线免费观看网站 | 99国产精品久久| 欧美久久高跟鞋激| 久久久九九九九| 亚洲激情在线播放| 九色综合狠狠综合久久| 99久久精品国产导航| 欧美午夜电影一区| 久久久久久一二三区| 亚洲制服丝袜一区| 韩国三级电影一区二区| 在线观看一区二区视频| 精品av久久707| 一区二区三区不卡在线观看| 九九视频精品免费| 欧美在线一区二区三区| 久久欧美一区二区| 午夜婷婷国产麻豆精品| 国产成人在线网站| 欧美电影在线免费观看| 国产精品超碰97尤物18| 日本不卡视频在线| 日本黄色一区二区| 天天综合色天天综合| 成人免费视频app| 欧美一级xxx| 亚洲精品ww久久久久久p站| 国产精品综合一区二区三区| 欧美日韩国产小视频| 中文字幕在线免费不卡| 久久草av在线| 欧美精品久久天天躁| 亚洲色图一区二区| 国产毛片精品视频| 日韩一卡二卡三卡四卡| 亚洲国产成人porn| 94-欧美-setu| 国产日韩欧美精品一区| 蜜臀久久99精品久久久画质超高清 | 国内精品自线一区二区三区视频| 欧美综合天天夜夜久久| 中文字幕在线观看不卡视频| 国产自产视频一区二区三区| 911精品国产一区二区在线| 亚洲精品老司机| 99热国产精品| 国产精品剧情在线亚洲| 国产成人8x视频一区二区| 精品久久久网站| 捆绑变态av一区二区三区| 欧美日韩一区 二区 三区 久久精品| 亚洲视频一区二区在线| 暴力调教一区二区三区| 中文字幕成人在线观看| 国产999精品久久久久久绿帽| 欧美精品一区二区三| 蜜臀av在线播放一区二区三区| 欧美区在线观看| 婷婷亚洲久悠悠色悠在线播放| 欧美色综合网站| 亚洲国产欧美另类丝袜| 欧美日韩一二区| 午夜a成v人精品| 欧美日韩一区中文字幕| 五月综合激情网| 69成人精品免费视频| 日韩高清不卡一区二区| 日韩一区和二区| 国内久久精品视频| 国产色一区二区| av一二三不卡影片| 亚洲免费观看高清在线观看| 91麻豆免费观看| 亚洲国产欧美日韩另类综合| 欧美军同video69gay| 青青草国产成人99久久| 26uuu国产电影一区二区| 国产在线视视频有精品| 久久久亚洲精品石原莉奈| 国产成人高清视频| 亚洲欧美日韩国产综合在线| 欧美在线看片a免费观看| 午夜a成v人精品| 26uuu另类欧美| 99久久免费视频.com| 一区二区三区四区不卡在线 | 日韩免费一区二区| 国产资源在线一区| 中文字幕一区二区三区视频 | 国产欧美日韩在线看| 99久久久国产精品免费蜜臀| 成人影视亚洲图片在线| 亚洲女子a中天字幕| 777亚洲妇女| 国产乱淫av一区二区三区| 中文字幕一区二区三区色视频| 欧美亚洲综合色| 精品一区免费av| 国产精品嫩草影院com| 欧美三级电影精品| 国产精品乡下勾搭老头1| 亚洲欧美日韩国产一区二区三区| 欧美久久久久免费| 懂色一区二区三区免费观看| 亚洲综合一二区| 精品不卡在线视频| 色94色欧美sute亚洲线路一久| 日韩福利电影在线| 国产精品免费久久| 欧美日韩精品欧美日韩精品一综合| 精品在线一区二区三区| 亚洲欧美激情小说另类| 日韩欧美电影一二三| av中文一区二区三区| 精品一区二区免费视频| 亚洲精品视频在线观看免费| 精品成人一区二区三区四区| 色婷婷av一区二区三区gif| 国产在线观看免费一区| 亚洲与欧洲av电影| 国产人妖乱国产精品人妖| 欧美二区在线观看| 91免费国产在线| 国产精品一区二区三区乱码| 亚洲成人综合网站| 亚洲欧美在线另类| 2019国产精品| 欧美丰满少妇xxxbbb| 一本到高清视频免费精品| 国产在线一区观看| 日本伊人精品一区二区三区观看方式| 136国产福利精品导航|