欢迎来到天天文库
浏览记录
ID:41032847
大小:55.50 KB
页数:5页
时间:2019-08-14
《优化设计复合形法 C语言程序》由会员上传分享,免费在线阅读,更多相关内容在工程资料-天天文库。
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=2657863.0;doubleF(doubleC[n]){doubleF;F=pow(C[0]
2、-3,2)+pow(C[1]-4,2);returnF;}intcons(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;5a[1]=0;b[1]=8;}doubler(){doubler1,r2,r3,rr;r1=pow(2,35);r2=pow(2,36);r3=
3、pow(2,37);rm=5*rm;if(rm>=r3){rm=rm-r3;}if(rm>=r2){rm=rm-r2;}if(rm>=r1){rm=rm-r1;}rr=rm/r1;returnrr;}voidproduce(doubleA[n],doubleB[n]){intjj;doubleS;sl:for(i=0;i4、;}for(j=1;j5、0;i6、lp++){lp1=lp+1;if(FF[lp]7、[i];}Xs[i]=1/(k+0.0)*Xs[i];}EE=0;for(j=0;j8、c[i]+af*(Xc[i]-Xh[i]);}if(cons(Xr)==1){5if(F(Xr)>=F(Xh)){if(af<=ep){for(i=0;i
4、;}for(j=1;j5、0;i6、lp++){lp1=lp+1;if(FF[lp]7、[i];}Xs[i]=1/(k+0.0)*Xs[i];}EE=0;for(j=0;j8、c[i]+af*(Xc[i]-Xh[i]);}if(cons(Xr)==1){5if(F(Xr)>=F(Xh)){if(af<=ep){for(i=0;i
5、0;i6、lp++){lp1=lp+1;if(FF[lp]7、[i];}Xs[i]=1/(k+0.0)*Xs[i];}EE=0;for(j=0;j8、c[i]+af*(Xc[i]-Xh[i]);}if(cons(Xr)==1){5if(F(Xr)>=F(Xh)){if(af<=ep){for(i=0;i
6、lp++){lp1=lp+1;if(FF[lp]7、[i];}Xs[i]=1/(k+0.0)*Xs[i];}EE=0;for(j=0;j8、c[i]+af*(Xc[i]-Xh[i]);}if(cons(Xr)==1){5if(F(Xr)>=F(Xh)){if(af<=ep){for(i=0;i
7、[i];}Xs[i]=1/(k+0.0)*Xs[i];}EE=0;for(j=0;j8、c[i]+af*(Xc[i]-Xh[i]);}if(cons(Xr)==1){5if(F(Xr)>=F(Xh)){if(af<=ep){for(i=0;i
8、c[i]+af*(Xc[i]-Xh[i]);}if(cons(Xr)==1){5if(F(Xr)>=F(Xh)){if(af<=ep){for(i=0;i
此文档下载收益归作者所有