欢迎来到天天文库
浏览记录
ID:20360888
大小:54.00 KB
页数:14页
时间:2018-10-12
《简单分布估计算法》由会员上传分享,免费在线阅读,更多相关内容在行业资料-天天文库。
1、简单的分布估计算法#include#include#include#include#include#definePIacos(-1.0)structPoint{double*x;doubley;};intitercount=0;intdimension;doublelocalbest;doublecurrentbest;intOptFound;intOptNum[4]={3,18,81,324};intlambda;double*C;double*U;double**X;double*Y;s
2、tructPoint*Optqueue;double(*fitness)(double*MX,intDim);voidTofile();intInsertOpt(double*ex,doubleey);voidAllocateMemory(intdim,intlam);voidInit();voidSamplerIndiv(double*randx,intDim,double*C,double*u);intIsPeak(double*u,doubley);voidMatrixTimes(double*lm,double*rm,double*tm,intm,intd,intn);voi
3、dAdaptCU(double*C,double*U,double*Xbest,intdimension);voidprintMatrix(double*M,intN,intc){inti;for(i=1;i<=N*c;i++){printf("%.8f",M[i-1]);if(i%c==0)printf("");}}inttestBound(double*x,intdim){inti;for(i=0;i10)
4、
5、(x[i]<-10))return0;}return1;}doublef5(double*X,intN){doublesum=1;
6、doubletemp=0;for(inti=0;i7、ce=0;for(i=0;i8、double)u1))*cos((double)2*PI*u2);returnre;}voidDestruct(){free(C);free(U);inti;for(i=0;i9、i]<1e-6)C[i]=1e-6;}else{C[i]=0;}}}voidmain(){inti;intj;unsignedintseed;seed=time(0);srand(seed);cout<<"inputthedimension"<>dimension;cout<<"inputthescaleoftheselectedpopulation"<>lambda;AllocateMemory(dimension
7、ce=0;for(i=0;i8、double)u1))*cos((double)2*PI*u2);returnre;}voidDestruct(){free(C);free(U);inti;for(i=0;i9、i]<1e-6)C[i]=1e-6;}else{C[i]=0;}}}voidmain(){inti;intj;unsignedintseed;seed=time(0);srand(seed);cout<<"inputthedimension"<>dimension;cout<<"inputthescaleoftheselectedpopulation"<>lambda;AllocateMemory(dimension
8、double)u1))*cos((double)2*PI*u2);returnre;}voidDestruct(){free(C);free(U);inti;for(i=0;i9、i]<1e-6)C[i]=1e-6;}else{C[i]=0;}}}voidmain(){inti;intj;unsignedintseed;seed=time(0);srand(seed);cout<<"inputthedimension"<>dimension;cout<<"inputthescaleoftheselectedpopulation"<>lambda;AllocateMemory(dimension
9、i]<1e-6)C[i]=1e-6;}else{C[i]=0;}}}voidmain(){inti;intj;unsignedintseed;seed=time(0);srand(seed);cout<<"inputthedimension"<>dimension;cout<<"inputthescaleoftheselectedpopulation"<>lambda;AllocateMemory(dimension
此文档下载收益归作者所有