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

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

?? scs.cpp

?? (其中已經(jīng)包含5個(gè)源碼)所附源程序C或C++代碼文件及其可執(zhí)行文件 Scs.cpp 基本分類算法源程序
?? CPP
?? 第 1 頁 / 共 3 頁
字號(hào):
 child2->c[j]=mutation(parent1->c[j],pmutation,nmutation);
 child1->c[j]=mutation(parent2->c[j],pmutation,nmutation);
 j=j+1;
}
j=0;
while(j<sitecross)
{
 child1->c[j]=mutation(parent1->c[j],pmutation,nmutation);
 child2->c[j]=mutation(parent2->c[j],pmutation,nmutation);
 j=j+1;
}
inheritance=avg(parent1->strength,parent2->strength);
child1->strength=inheritance;child1->matchflag=0;
child1->ebid=0.0;child1->bid=0.0;
child1->specificity=counterspecificity(child1->c,nposition);
child2->strength=inheritance;child2->matchflag=0;
child2->ebid=0.0;child2->bid=0.0;
child2->specificity=counterspecificity(child2->c,nposition);
}

int worstofn(struct poptype *population, int n)
{
int j,worst,candidate;
float worststrength;
worst=rnd(0, population->nclassifier-1);
worststrength=population->classifier[worst].strength;
if(n>0)
{
   for(j=1;j<=n-1;j++)
 {
  candidate=rnd(0,population->nclassifier-1);
  if(worststrength>population->classifier[candidate].strength)
    {
    worst=candidate;
    worststrength=population->classifier[worst].strength;
    }
 }
}
return(worst);
}

int matchcount(struct classtype *classifier1,struct classtype *classifier2,int nposition)
{
int tempcount,j;
   if(classifier1->a==classifier2->a)
     tempcount=1;
   else
     tempcount=0;
  for(j=0;j<=nposition-1;j++)
     if( classifier1->c[j]==classifier2->c[j])    tempcount=tempcount+1;
   return(tempcount);    
}

int crowding(struct classtype *child,struct poptype *population,int &crowdingfactor,int crowdingsubpop)
{
int popmember,j,match,matchfmax,mostsimilar;
matchfmax=-1;  mostsimilar=0;
if(crowdingfactor<1)  crowdingfactor=1;
for(j=0;j<=crowdingfactor-1;j++)
{
   popmember=worstofn(population,crowdingsubpop);
   match=matchcount(child,&population->classifier[popmember],population->nposition);
   if(match>matchfmax)
    {
     matchfmax=match;
     mostsimilar=popmember;
    }
 }
return(mostsimilar);
}

void statistics(struct poptype *population)
{
 int j;
 population->fmaxstrength=population->classifier[0].strength;
 population->fminstrength=population->classifier[0].strength;
 population->sumstrength=population->classifier[0].strength;
j=1;
while(j<=population->nclassifier-1)
  {
  population->fmaxstrength=fmax(population->fmaxstrength,population->classifier[j].strength);
  population->fminstrength=fmin(population->fminstrength,population->classifier[j].strength);
  population->sumstrength=population->sumstrength+population->classifier[j].strength;
  j++;
  }
  population->avgstrength=population->sumstrength/population->nclassifier;
}

void ga(struct grecord *garec,struct poptype *population)
{
int j;
struct classtype *child;
int nbytes;
child=(struct classtype *)malloc(2*sizeof(struct classtype));
nbytes=population->nposition*sizeof(int);
child[0].c = (int *) malloc(nbytes);
child[1].c = (int *) malloc(nbytes);

statistics(population);
for(j=0;j<=garec->nselect-1;j++)
  {
   garec->mating[j].mate1=select(population);
   garec->mating[j].mate2=select(population);
   crossover(&population->classifier[garec->mating[j].mate1],&population->classifier[garec->mating[j].mate1],&child[0],&child[1], garec->pcrossover,
              garec->pmutation,garec->mating[j].sitecross,population->nposition,garec->ncrossover,garec->nmutation);
  
   garec->mating[j].mort1=crowding(&child[0],population,garec->crowdingfactor,garec->crowdingsubpop);
   population->sumstrength=population->sumstrength-population->classifier[garec->mating[j].mort1].strength+child[0].strength;
   population->classifier[garec->mating[j].mort1]=child[0];
   garec->mating[j].mort2=crowding(&child[1],population,garec->crowdingfactor,garec->crowdingsubpop);
   population->sumstrength=population->sumstrength-population->classifier[garec->mating[j].mort2].strength+child[1].strength;
   population->classifier[garec->mating[j].mort2]=child[1];
  }
}

void reportga(struct grecord *garec,struct poptype *population )
{
  int j;
 skip(1);
 rep<<"           遺傳算法報(bào)告: "<<endl;
 rep<<" --------------------------------------------"<<endl;
 rep<<"  對數(shù)   父1   父2  交叉位置  子1   子2  "<<endl;
 rep<<" ---------------------------------------------"<<endl;
   for(j=0; j<=garec->nselect-1;j++)
   {
   rep<<setw(6)<<j<<setw(6)<< garec->mating[j].mate1;
   rep<<setw(6)<<garec->mating[j].mate2<<setw(6)<<garec->mating[j].sitecross;
   rep<<setw(6)<<garec->mating[j].mort1<<setw(6)<<garec->mating[j].mort2<<endl;
   }
 rep<<" 統(tǒng)計(jì)數(shù)據(jù): "<<endl;
 rep<<"----------------------"<<endl;
 rep<<" 平均權(quán)值 ="<<population->avgstrength<<endl;
 rep<<" 最大權(quán)值 ="<<population->fmaxstrength<<endl;
 rep<<" 最小權(quán)值 ="<<population->fminstrength<<endl;
 rep<<" 權(quán)值和   ="<<population->sumstrength<<endl;
 rep<<" 交叉數(shù)目 ="<<garec->ncrossover<<endl;
 rep<<" 變異數(shù)目 ="<<garec->nmutation<<endl;
}

float rndreal(float lo ,float hi)    /*在浮點(diǎn)數(shù)lo和hi之間產(chǎn)生一個(gè)隨機(jī)實(shí)數(shù)*/
{
    return((float)(rand()/32767. * (hi - lo)) + lo);
}

void initrandomnormaldeviate()      /* 隨機(jī)標(biāo)準(zhǔn)差的初始化 */
{
    rndcalcflag = 1;
}

double randomnormaldeviate()        /* 產(chǎn)生隨機(jī)標(biāo)準(zhǔn)差 */
{
    double t, rndx1;
    if(rndcalcflag)
    {   rndx1 = sqrt(- 2.0*log((double) rand()/32767.));
        t = 6.2831853072 * (double) rand()/32767.;
        rndx2 = rndx1 * sin(t);
        rndcalcflag = 0;
        return(rndx1 * cos(t));
    }
    else
    {
        rndcalcflag = 1;
        return(rndx2);
    }
}


float noise(float mu ,float sigma)    /* 產(chǎn)生具有給定均值和標(biāo)準(zhǔn)均方差的隨機(jī)數(shù) */
{
    return((float)(randomnormaldeviate()*sigma) + mu);
}

void skip(int skipcount)
{
    int j;
    for (j = 1; j <= skipcount; j++) rep<<endl;
}

int flip(float prob)             /* 以一定概率產(chǎn)生0或1 */
{
    if(prob==1.0)
        return(1);
    else
        return((rand()/32767. <= prob));
}

int rnd(int low,int high) /*在整數(shù)low和high之間產(chǎn)生一個(gè)隨機(jī)整數(shù)*/
{
    int i;
      if(low >= high)
        i = low;
    else
    {
        i = (int)(rand()/32767. * (high - low + 1)) + low;
        if(i > high) i = high;
    }
    return(i);
}


float fmax(float x,float y)
{
if(x>y)
return(x);
else
return(y);
}

float fmin(float x,float y)
{
if(x<y)
return(x);
else
return(y);
}

float avg(float x,float y)
{
return((float)(0.5*(x+y)));
}

int halt()
{
const times=1000;
int temp;
int j;
/* int ch;*/
j=0;
 do
 {
  j++;
 }while(j<times);
 temp=(j<times);
 /*
 cout<<"是否繼續(xù)?(1/0)";
 cin>>ch;
 if(ch==1) 
	return(0);
 else
    return(1); */
 return(temp);
}

void initmalloc()     /*為全局?jǐn)?shù)據(jù)變量分配空間 */
{
  int nbytes,ncbytes;
  int j;
  int fmaxc,fmaxp;
  cfile>>fmaxp;
  cfile>>fmaxc;
  ncbytes =fmaxc*(fmaxp*sizeof(int)+3*sizeof(int)+3*sizeof(float));
     if((pop->classifier = (struct classtype *) malloc(ncbytes)) == NULL)
        { cout<<"malloc: out of memory making !!"<<endl;
         exit(-1);
        } 
   nbytes=fmaxp*sizeof(int);
   for(j=0;j<=fmaxc-1;j++)
   {
      if((pop->classifier[j].c = (int *) malloc(nbytes)) == NULL)
        { cout<<"malloc: out of memory making !!"<<endl;
        exit(-1);
	  }
   }
   nbytes=fmaxp*sizeof(int);
     if((envmessage = (int *) malloc(nbytes)) == NULL)
        { cout<<"malloc: out of memory making !!\n"<<endl;
        exit(-1);
        }
   if((matchl->clist = (int *) malloc(pop->nclassifier*sizeof(int))) == NULL)
    { cout<<"malloc: out of memory making !!\n"<<endl;
     exit(-1);
    }

   nbytes=fmaxp*sizeof(int);
       if((environrec.signal = (int *) malloc(nbytes)) == NULL)
        { cout<<"malloc: out of memory making !!\n"<<endl;
        exit(-1);
        }
   nbytes = fmaxmating*sizeof(struct mrecord);
       if((garec.mating = (struct mrecord *) malloc(nbytes)) == NULL)
        { cout<<"malloc: out of memory making !!\n"<<endl;
        exit(-1);
        }
  pop->nclassifier=fmaxc;
  pop->nposition=fmaxp;
}

void generatecfile()
{
    int nclassifier,nposition;      
    float pgeneral,cbid,bidsigma,bidtax,lifetax,bid1,bid2,ebid1,ebid2;  
    float strength;
	int i,j;
	float temprand;
    ofstream rcfile("c:\\scs\\cfile.txt");   

    cout<<" 分類器前件碼長=";
    cin>>nposition;
    rcfile<<nposition<<endl;
		
	cout<<" 分類器數(shù)目= ";
    cin>>nclassifier;
	rcfile<<nclassifier<<endl;
    
	cout<<" 隨機(jī)概率= ";
    cin>>pgeneral;
	rcfile<<pgeneral<<endl;

	cout<<" 投標(biāo)系數(shù)= ";   
    cin>>cbid;
    rcfile<<cbid<<endl;

    cout<<" 有效投標(biāo)中隨機(jī)噪聲的均方差 = ";
    cin>>bidsigma;
	rcfile<<bidsigma<<endl;
	
    cout<<" 投標(biāo)稅= ";
	cin>>bidtax;
	rcfile<<bidtax<<endl;

    cout<<" 存活稅  = ";
    cin>>lifetax;
	rcfile<<lifetax<<endl;

	cout<<" 投標(biāo)確定性基數(shù) = ";
    cin>>bid1;
	rcfile<<bid1<<endl;

    cout<<" 投標(biāo)確定性倍率 = ";
    cin>>bid2;
	rcfile<<bid2<<endl;

    cout<<" 有效投標(biāo)確定性基數(shù) = ";
	cin>>ebid1;
	rcfile<<ebid1<<endl;

	cout<<" 有效投標(biāo)確定性倍率 = ";
    cin>>ebid2;
    rcfile<<ebid2<<endl;
  
	cout<<" 分類器初始權(quán)值 = ";
    cin>>strength;
    
   for(i=0;i<=nclassifier-1;i++)
   {
	   for(j=0;j<=nposition-1;j++)
	   {
		temprand=(float)(rand()/32767.);
	   if(temprand<1./3)
	    rcfile<<"0";
	   else if((temprand>=1/3.)&&(temprand<2/3.))
	    rcfile<<"1";
	   else
	   rcfile<<"#";
	   }
       rcfile<<":";
	   temprand=(float)(rand()/32767.);
	   if(temprand<1/2.)
	    rcfile<<"0";
	   else
	    rcfile<<"1";
       rcfile<<" "<<strength<<endl;	   
   }
   rcfile<<"n"<<endl;
}

void freeall()    /* 釋放內(nèi)存空間 */
{
int j;
free(pop->classifier);
for(j=0;j<=pop->nclassifier-1;j++)
  free(pop->classifier[j].c);
free(matchl->clist);
free(envmessage); 
free(environrec.signal);
free(garec.mating);
   }

void main()  /*  主程序 */
{
/* generatecfile();*/
initialization();
detectors(&environrec,envmessage);
report();
do {
    timekeeper(&timekeeprec);
    environment(&environrec);
    detectors(&environrec,envmessage);
	matchl->nactive=0;
	matchclassifiers(pop,envmessage,matchl);
	aoc(pop,matchl,&clearingrec);
    environrec.classifieroutput=pop->classifier[clearingrec.winner].a;
    reinforcement(&reinforcementrec,pop,&clearingrec,&environrec);
    if(timekeeprec.reportflag)   report();
    if(timekeeprec.consolereportflag)   consolereport(&reinforcementrec);
    if(timekeeprec.plotreportflag)   plotreport(&reinforcementrec);
    advance(&clearingrec);
    if(timekeeprec.gaflag)
     {
     ga(&garec,pop);
     if(timekeeprec.reportflag)   reportga(&garec,pop);
     }
   }while(halt()==0);
   report();
   freeall();
 }


?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲成人777| 国产一区二区导航在线播放| 日韩女优电影在线观看| 成人av免费在线| 日韩经典中文字幕一区| 亚洲欧洲精品一区二区三区不卡 | 日韩电影一二三区| 中文乱码免费一区二区| 欧美一区二区免费观在线| 色综合久久天天综合网| 韩国精品久久久| 亚洲国产sm捆绑调教视频 | 亚洲视频一区在线观看| 精品国产亚洲在线| 欧美日韩中文国产| 91麻豆国产精品久久| 国产·精品毛片| 久久精品国产99国产| 五月激情丁香一区二区三区| 亚洲欧洲日韩在线| 亚洲国产岛国毛片在线| 精品国产乱码久久久久久久久| 欧美性猛片xxxx免费看久爱| 99久久99精品久久久久久| 丰满亚洲少妇av| 久久66热re国产| 免费在线成人网| 日本中文字幕一区二区视频| 亚洲高清不卡在线| 亚洲午夜一二三区视频| 一区二区在线观看不卡| 亚洲男人的天堂一区二区| 欧美国产日韩亚洲一区| 欧美国产亚洲另类动漫| 国产女人18水真多18精品一级做| 久久日韩粉嫩一区二区三区| 欧美成人精品高清在线播放| 欧美videos大乳护士334| 日韩欧美国产综合| 欧美大胆人体bbbb| 精品成人免费观看| 久久久99精品免费观看不卡| 久久综合成人精品亚洲另类欧美| 精品蜜桃在线看| 精品国产91亚洲一区二区三区婷婷| 亚洲欧美一区二区三区国产精品| 中文字幕二三区不卡| 国产精品每日更新在线播放网址 | 婷婷国产v国产偷v亚洲高清| 亚洲高清久久久| 人禽交欧美网站| 精品一区二区免费在线观看| 国产一区二区导航在线播放| 国产**成人网毛片九色 | 久久嫩草精品久久久精品一| 久久免费的精品国产v∧| 国产欧美一区二区精品久导航| 国产精品伦一区| 亚洲黄色片在线观看| 亚洲va国产天堂va久久en| 美日韩黄色大片| 国产精品一二三区在线| 99riav一区二区三区| 欧美日韩一区小说| 欧美sm美女调教| 中文字幕乱码日本亚洲一区二区 | 久久精品国产精品亚洲红杏| 久久精品国产久精国产爱| 国产精品一区二区黑丝| 91香蕉视频污在线| 91精品国产综合久久久久久漫画| 精品对白一区国产伦| 国产精品国产三级国产普通话99 | 精品国产一区二区在线观看| 久久久亚洲综合| 亚洲乱码国产乱码精品精小说 | 99久久精品99国产精品 | 国产精品无码永久免费888| 一区二区三区在线观看视频| 毛片av一区二区| 99精品久久99久久久久| 欧美一区二区三区在线电影| 亚洲国产成人一区二区三区| 亚洲高清免费一级二级三级| 国产麻豆91精品| 欧美日本在线视频| 国产亚洲欧美日韩俺去了| 亚洲一区二区三区四区在线观看 | 美国欧美日韩国产在线播放| 成人福利视频网站| 91精品国产福利| 亚洲丝袜美腿综合| 日本欧美一区二区在线观看| 91丝袜国产在线播放| 精品美女一区二区| 亚洲精品水蜜桃| 国内成人精品2018免费看| 欧美在线你懂的| 中文字幕久久午夜不卡| 蜜桃视频第一区免费观看| 色综合天天综合色综合av| 精品国产乱码91久久久久久网站| 亚洲综合激情另类小说区| 国产91精品欧美| 日韩精品一区二区三区三区免费| 亚洲乱码中文字幕| 丰满白嫩尤物一区二区| 91麻豆精品国产91久久久资源速度| 国产精品乱码一区二三区小蝌蚪| 日本精品裸体写真集在线观看 | 国产清纯在线一区二区www| 五月激情综合网| 色欧美片视频在线观看在线视频| 久久婷婷一区二区三区| 日韩电影免费一区| 欧美影院一区二区三区| 国产精品久久久久久亚洲伦| 精品一区二区av| 欧美一级理论片| 五月开心婷婷久久| 欧美三级电影在线看| 亚洲欧美偷拍三级| av亚洲精华国产精华| 中文字幕欧美三区| 国产精品99精品久久免费| 精品欧美乱码久久久久久 | 99久久精品免费| 国产精品午夜电影| 国产精品91一区二区| 久久久久久99久久久精品网站| 久久疯狂做爰流白浆xx| 日韩欧美成人午夜| 久久国产夜色精品鲁鲁99| 日韩一级黄色片| 久久av中文字幕片| 久久综合色8888| 国产精品白丝jk黑袜喷水| 国产日韩欧美电影| 成人精品鲁一区一区二区| 国产精品免费看片| 99re这里只有精品6| 亚洲人成精品久久久久| 欧美中文字幕一区| 午夜精品久久久久久久久| 9191精品国产综合久久久久久| 午夜精彩视频在线观看不卡| 亚洲特黄一级片| 91久久国产综合久久| 亚洲1区2区3区4区| 欧美一级黄色片| 国产风韵犹存在线视精品| 中文子幕无线码一区tr| 91麻豆国产精品久久| 亚洲国产精品一区二区www| 7777精品伊人久久久大香线蕉的 | 97se亚洲国产综合自在线 | 亚洲精品欧美激情| 欧美剧在线免费观看网站| 蜜桃一区二区三区四区| 久久免费看少妇高潮| 99国内精品久久| 午夜精品福利一区二区三区av | 国产精品理论片| 欧美性生活大片视频| 视频一区视频二区中文| 精品伦理精品一区| aa级大片欧美| 天天影视涩香欲综合网| 26uuuu精品一区二区| 99精品久久只有精品| 日韩精品视频网站| 国产欧美日韩精品a在线观看| 色综合一区二区| 美女视频黄久久| 1024成人网| 日韩视频免费直播| 成人av资源网站| 日韩国产高清在线| 国产精品人妖ts系列视频| 欧美日韩情趣电影| 风间由美中文字幕在线看视频国产欧美| 亚洲日本中文字幕区| 欧美一个色资源| 一本久道久久综合中文字幕 | 久久一区二区三区四区| 色综合天天综合在线视频| 免费高清在线视频一区·| 国产精品青草久久| 538prom精品视频线放| 成人国产精品视频| 蜜桃精品在线观看| 一区二区三区在线观看欧美| 久久日一线二线三线suv| 欧美日韩综合不卡| 国产精品99久久久久久久女警 | 夫妻av一区二区| 美女视频黄 久久| 尤物在线观看一区| 中文一区在线播放| 欧美α欧美αv大片|