資源描述:
《復(fù)合形法解決有約束優(yōu)化問題.doc》由會員上傳分享,免費在線閱讀,更多相關(guān)內(nèi)容在行業(yè)資料-天天文庫。
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