欢迎来到天天文库
浏览记录
ID:56031149
大小:26.00 KB
页数:5页
时间:2020-06-18
《复合形法解决有约束优化问题.doc》由会员上传分享,免费在线阅读,更多相关内容在行业资料-天天文库。
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[n]);//objec
2、tivefunctionintconstrii(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]<=4))&&((D[1]>=0.5)&&(D[1
3、]<=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、;i5、[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、[0];Fl=FF[0];h=0;g=0;l=0;for(j=0;jFh)//Badpoint{Fh=FF[j];h=j;}if(FF[j]Fg)&&(j!=h))//Secondmaximumpoint{Fg=FF[j];g=j;}for(i=0;i7、,2);EE=pow((1/(k+0.0)*EE),0.5);if(EE<=E1){printf("F(Xmin)=%lf",funct1(Xl));prXl=&X[1][0];break;}for(i=0;i
4、;i5、[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、[0];Fl=FF[0];h=0;g=0;l=0;for(j=0;jFh)//Badpoint{Fh=FF[j];h=j;}if(FF[j]Fg)&&(j!=h))//Secondmaximumpoint{Fg=FF[j];g=j;}for(i=0;i7、,2);EE=pow((1/(k+0.0)*EE),0.5);if(EE<=E1){printf("F(Xmin)=%lf",funct1(Xl));prXl=&X[1][0];break;}for(i=0;i
5、[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、[0];Fl=FF[0];h=0;g=0;l=0;for(j=0;jFh)//Badpoint{Fh=FF[j];h=j;}if(FF[j]Fg)&&(j!=h))//Secondmaximumpoint{Fg=FF[j];g=j;}for(i=0;i7、,2);EE=pow((1/(k+0.0)*EE),0.5);if(EE<=E1){printf("F(Xmin)=%lf",funct1(Xl));prXl=&X[1][0];break;}for(i=0;i
6、[0];Fl=FF[0];h=0;g=0;l=0;for(j=0;jFh)//Badpoint{Fh=FF[j];h=j;}if(FF[j]Fg)&&(j!=h))//Secondmaximumpoint{Fg=FF[j];g=j;}for(i=0;i7、,2);EE=pow((1/(k+0.0)*EE),0.5);if(EE<=E1){printf("F(Xmin)=%lf",funct1(Xl));prXl=&X[1][0];break;}for(i=0;i
7、,2);EE=pow((1/(k+0.0)*EE),0.5);if(EE<=E1){printf("F(Xmin)=%lf",funct1(Xl));prXl=&X[1][0];break;}for(i=0;i
此文档下载收益归作者所有