欢迎来到天天文库
浏览记录
ID:55559214
大小:47.50 KB
页数:5页
时间:2020-05-17
《优化设计复合形法-C语言程序.doc》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库。
1、题目:求如下约束优化问题的最优解()=S.t.已知:N=2,取k=4,#include"math.h"#include"stdio.h"#include"stdlib.h"#defineE10.001#defineep0.00001#definen2#definek4doubleaf;inti,j;doubleX0[n],XX[n],X[k][n],FF[k];doublea[n],b[n];doublerm=.0;doubleF(doubleC[n]){doubleF;F=pow(C[0]-3,2)+pow(C[1]-4,2);returnF;}int
2、cons(doubleD[n]){if((D[0]>=0)&&(D[1]>=0)&&(D[0]<=6)&&(D[1]<=8)&&((2.5-D[0]+D[1])>=0)&&((5-D[0]-D[1])>=0))return1;elsereturn0;}voidbou(){a[0]=0;b[0]=6;a[1]=0;b[1]=8;}doubler(){doubler1,r2,r3,rr;r1=pow(2,35);r2=pow(2,36);r3=pow(2,37);rm=5*rm;if(rm>=r3){rm=rm-r3;}if(rm>=r2){rm=rm-r2
3、;}if(rm>=r1){rm=rm-r1;}rr=rm/r1;returnrr;}voidproduce(doubleA[n],doubleB[n]){intjj;doubleS;sl:for(i=0;i4、j++){for(i=0;i5、Xs[n],w;intl,lp,lp1;bou();s111:produce(a,b);s222:for(j=0;j6、;}}}}for(i=0;i7、;j++){Xc[i]+=X[j][i];}Xc[i]=1/(k-1.0)*Xc[i];}if(cons(Xc)==1){af=1.3;ss:for(i=0;i=F(Xh)){if(af<=ep){for(i=0;i8、}else{af=1/2.0*af;gotoss;}}else{for(i=0;
4、j++){for(i=0;i5、Xs[n],w;intl,lp,lp1;bou();s111:produce(a,b);s222:for(j=0;j6、;}}}}for(i=0;i7、;j++){Xc[i]+=X[j][i];}Xc[i]=1/(k-1.0)*Xc[i];}if(cons(Xc)==1){af=1.3;ss:for(i=0;i=F(Xh)){if(af<=ep){for(i=0;i8、}else{af=1/2.0*af;gotoss;}}else{for(i=0;
5、Xs[n],w;intl,lp,lp1;bou();s111:produce(a,b);s222:for(j=0;j6、;}}}}for(i=0;i7、;j++){Xc[i]+=X[j][i];}Xc[i]=1/(k-1.0)*Xc[i];}if(cons(Xc)==1){af=1.3;ss:for(i=0;i=F(Xh)){if(af<=ep){for(i=0;i8、}else{af=1/2.0*af;gotoss;}}else{for(i=0;
6、;}}}}for(i=0;i7、;j++){Xc[i]+=X[j][i];}Xc[i]=1/(k-1.0)*Xc[i];}if(cons(Xc)==1){af=1.3;ss:for(i=0;i=F(Xh)){if(af<=ep){for(i=0;i8、}else{af=1/2.0*af;gotoss;}}else{for(i=0;
7、;j++){Xc[i]+=X[j][i];}Xc[i]=1/(k-1.0)*Xc[i];}if(cons(Xc)==1){af=1.3;ss:for(i=0;i=F(Xh)){if(af<=ep){for(i=0;i8、}else{af=1/2.0*af;gotoss;}}else{for(i=0;
8、}else{af=1/2.0*af;gotoss;}}else{for(i=0;
此文档下载收益归作者所有