欢迎来到天天文库
浏览记录
ID:38753625
大小:19.57 KB
页数:5页
时间:2019-06-18
《复合形法解决有约束优化问题》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库。
1、#include#include#include#include#include#include#include#defineE10.0001#defineep0.0001#definen2#definek4floataf=10;inti,j;doubleX0[n],XX[n],X[k][n],FF[k];voidproduce(doubleA[n],doubleB[n]);doublea[n],b[n];doublefunct1(doubleC
2、[n]);//objectivefunctionintconstrii(doubleD[n]);//constrictionsvoidboundarr();doubleA1=0,B1=0,C1=0,D1=0,EE1=0;doublefunct1(doubleC[n]){doubley;y=25/(C[0]*C[1]*C[1]*C[1]);returny;}intconstrii(doubleD[n]){if(((50-30/(D[0]*D[1]*D[1]))>=0)&&((0.001-0.0004*D[0]*D[1])>=0)&&((D[0]>=2)&&(D[0]<
3、=4))&&((D[1]>=0.5)&&(D[1]<=1)))return1;elsereturn0;}voidproduce(doubleA[n],doubleB[n]){doubleraa;intjin,N;do{//N=rand()%11;//raa=N/10.0;raa=rand();raa=raa/32767;for(i=0;i4、0.0;raa=rand();raa=raa/32767;for(i=0;i5、][i];}}}}voidboundarr(){a[0]=2;a[1]=0.5;b[0]=4;b[1]=1;}double*Complex(){doubleEE,Xc[n],Xh[n],Xg[n],Xl[n],Fh,Fg,Fl,Xr[n];double*prXl;inth,g,l;boundarr();produce(a,b);EE=E1+1;while(EE>E1){for(i=0;i6、r(i=0;iFh)//Badpoint{Fh=FF[j];h=j;}if(FF[j]Fg)&&(j!=h))//Secondmaximumpoint{Fg=FF[j];g=j;}for(i=0;i7、]=X[g][i];Xl[i]=X[l][i];}EE=0;for(j=0;j
4、0.0;raa=rand();raa=raa/32767;for(i=0;i5、][i];}}}}voidboundarr(){a[0]=2;a[1]=0.5;b[0]=4;b[1]=1;}double*Complex(){doubleEE,Xc[n],Xh[n],Xg[n],Xl[n],Fh,Fg,Fl,Xr[n];double*prXl;inth,g,l;boundarr();produce(a,b);EE=E1+1;while(EE>E1){for(i=0;i6、r(i=0;iFh)//Badpoint{Fh=FF[j];h=j;}if(FF[j]Fg)&&(j!=h))//Secondmaximumpoint{Fg=FF[j];g=j;}for(i=0;i7、]=X[g][i];Xl[i]=X[l][i];}EE=0;for(j=0;j
5、][i];}}}}voidboundarr(){a[0]=2;a[1]=0.5;b[0]=4;b[1]=1;}double*Complex(){doubleEE,Xc[n],Xh[n],Xg[n],Xl[n],Fh,Fg,Fl,Xr[n];double*prXl;inth,g,l;boundarr();produce(a,b);EE=E1+1;while(EE>E1){for(i=0;i6、r(i=0;iFh)//Badpoint{Fh=FF[j];h=j;}if(FF[j]Fg)&&(j!=h))//Secondmaximumpoint{Fg=FF[j];g=j;}for(i=0;i7、]=X[g][i];Xl[i]=X[l][i];}EE=0;for(j=0;j
6、r(i=0;iFh)//Badpoint{Fh=FF[j];h=j;}if(FF[j]Fg)&&(j!=h))//Secondmaximumpoint{Fg=FF[j];g=j;}for(i=0;i7、]=X[g][i];Xl[i]=X[l][i];}EE=0;for(j=0;j
7、]=X[g][i];Xl[i]=X[l][i];}EE=0;for(j=0;j
此文档下载收益归作者所有