优化设计方法剖析.docx
- 文档编号:9536303
- 上传时间:2023-02-05
- 格式:DOCX
- 页数:20
- 大小:47.40KB
优化设计方法剖析.docx
《优化设计方法剖析.docx》由会员分享,可在线阅读,更多相关《优化设计方法剖析.docx(20页珍藏版)》请在冰豆网上搜索。
优化设计方法剖析
《优化设计方法》
实验报告
姓名:
陈辰
学号:
10104013
院系:
工学院
专业:
机械设计制造及其自动化
班级:
10机制一班
第四章例题
functiony=OPT_fun0(x)
y=3*x
(1)*x
(1)-2*x
(1)*x
(2)+x
(2)*x
(2);
formatlong;
x0=[1,1];
[x,f_opt,c,d]=fminsearch(@OPT_fun0,x0);
x,f_opt
结果:
x=
1.0e-004*
-0.109658670799670.198********638
f_opt=
1.192541061251568e-009
第四章课后习题
4-1
①functiony=OPT_fun0(x)
y=1.5*x
(1)*x
(1)+0.5*x
(2)*x
(2)-x
(1)*x
(2)-2*x
(1);
formatlong;
x0=[2,2];
[x,f_opt,c,d]=fminsearch(@OPT_fun0,x0);
x,f_opt,c,d
结果:
x=
0.999996954049381.00001655313968
f_opt=
-0.99999999979866
c=
1
d=
iterations:
39
funcCount:
77
algorithm:
'Nelder-Meadsimplexdirectsearch'
用Hession矩阵进行证明:
已知f(x)=3/2x
(1)*x
(1)+1/2x
(2)*x
(2)-x
(1)*x
(2)-2x
(1)
对该函数进行求导:
一阶导为:
f`(x1)=3x
(1)-x
(2)-2;f`(x2)=x
(2)-x
(1);
二阶导为:
f``(x1)=3;f``(x2)=1;f``(x1x2)=f``(x2x1)=-1;
由Hession矩阵判定条件之,令一阶导数值为0,固有
f`(x1)=3x
(1)-x
(2)-2=0;f`(x2)=x
(2)-x
(1)=0;
得:
x
(1)=1;x
(2)=1
该函数的Hession矩阵为:
由该Hession矩阵知,一阶主子式为3>0,二阶主子式为:
3*1–(-1)*(-1)=2>0.所以该Hession矩阵为正定。
即可知X=[11]为该函数的极小值点。
即可知Matlab软件所算的值是正确的。
②functiony=OPT_fun0(x)
y=x
(1)*x
(1)+x
(1)*x
(2)+2*x
(2)*x
(2)+4*x
(1)+6*x
(2)+10;
formatlong;
x0=[0,0];
[x,f_opt,c,d]=fminsearch(@OPT_fun0,x0);
x,f_opt,c
结果:
x=
-1.42857209403050-1.14288457948509
f_opt=
3.71428571580995
c=
1
结论:
由结果可知该函数的最优点为:
X=[-1.43-1.14]
故此函数的极值为:
fopt=3.71
③functiony=a123(x)
y=x
(1)*x
(1)*x
(1)+x
(1)*x
(2)-3*x
(2)*x
(2)*x
(2)+3*x
(1)*x
(1)+3*x
(2)*x
(2)-9*x
(1);
formatlong;
x0=[0,0]
[x,f_opt,c,d]=fminsearch(@a123,x0);
x,f_opt,c
结果:
x0=
00
x=
1.01162643167122-0.139********890
f_opt=
.0737********
c=
1
结论:
由上述结果知该函数的最优解点为:
X=[1.01-0.14]
故此函数的极值为:
f_opt=-5.07
④functiony=a123(x)
y=x
(1)*x
(1)*x
(1)*x
(1)+2*x
(1)*x
(1)*x
(2)+x
(2)*x
(2)+x
(1)*x
(1)-2*x
(2)+5;
formatlong;
x0=[0,0]
[x,f_opt,c,d]=fminsearch(@a123,x0);
x,f_opt,c
结果:
x0=
00
x=
0.000018156900600.99998886868293
f_opt=
4.00000000111292
c=
1
结论:
由上述结果知该函数的最优解点为:
X=[01]
故此函数的极值为:
f_opt=4.00
4-2
functiony=OPT_fun0(x)
y=4*x
(1)*x
(2)+4/x
(1)+4/x
(2);
formatlong;
x0=[0.5,0.5];
[x,f_opt,c,d]=fminsearch(@OPT_fun0,x0);
x,f_opt,c
结果:
x=
1.000018783361701.00000069475736
f_opt=
12.00000000146536
c=
1
结论:
由上述结果知该函数的最优解点为:
X=[11]
故此函数的极值为:
f_opt=12.00
4-3
functiony=OPT_fun1(x)
y=x
(1)*x
(1)-x
(1)*x
(2)+3*x
(2)*x
(2);
formatlong;
x0=[1,1]
[x,f_opt,c,d]=fminsearch(@OPT_fun1,x0);
x,f_opt,c
结果:
x0=
11
x=
1.0e-004*
.024*********
f_opt=
2.776385560476180e-009
c=
1
结论:
有输出的结果可知,最终在x(0)=[0.020.31]处约束,且最优解值为:
f(x)=2.78
4-4
functiony=OPT_fun1(x)
y=4+4.5*x
(1)-4*x
(2)+x
(1)*x
(1)+2*x
(2)*x
(2)-2*x
(1)*x
(2)+x
(1)*x
(1)*x
(1)*x
(1)-2*x
(1)*x
(1)*x
(2);
formatlong;
x0=[-2,2]
[x,f_opt,c,d]=fminsearch(@OPT_fun1,x0);
x,f_opt,c
结果:
x0=
-22
x=
-1.052756318166731.02772085864556
f_opt=
-0.51340925137577
c=
1
结论:
由上述结果知该函数的最优解点为:
X=[1.051.03]
故此函数的极值为:
f_opt=-0.51
4-5
functiony=OPT_fun1(x)
y=x
(1)*x
(1)+2*x
(2)*x
(2);
formatlong;
x0=[1,1]
[x,f_opt,c,d]=fminsearch(@OPT_fun1,x0);
x,f_opt
结果:
x0=
11
x=
1.0e-004*
0.034546445759640.175********544
f_opt=
6.305748878049377e-010
c=
1
结论:
由上述结果知该函数的最优解点为:
X=[00.18]
故此函数的极值为:
f_opt=6.31
4-6
functiony=OPT_fun1(x)
y=x
(1)*x
(1)-x
(1)*x
(2)+x
(2)*x
(2)+2*x
(1)-4*x
(2);
formatlong;
x0=[2,2]
[x,f_opt,c,d]=fminsearch(@OPT_fun1,x0);
x,f_opt,c
结果:
x0=
22
x=
0.000031318899142.00001969820371
f_opt=
-3.99999999924803
c=
1
结论:
由上述结果知该函数的最优解为:
X=[02]
故此函数的极值为:
f_opt=-4.00
第五章例题
Aeq=[];Beq=[];
f=[-60,-120];
A=[9,4;3,10;4,5];
B=[360;300;200];
LB=zeros(2,1);UB=[];
[X,fopt,key]=linprog(f,A,B,Aeq,Beq,LB,UB);
X,fopt,key
>>A11
Optimizationterminatedsuccessfully.
X=
20.0000
24.0000
fopt=
-4.0800e+003
key=
1
第五章课后习题
5-1
①Aeq=[1,1,1,0;1,2,2.5,3];Beq=[4;5];
f=[-1.1,-2.2,3.3,-4.4];
A=[];B=[];
LB=zeros(4,1);UB=[];
[X,fopt,key]=linprog(f,A,B,Aeq,Beq,LB,UB);
X,fopt,key
>>cc2
Optimizationterminatedsuccessfully.
X=
3.99999999991453
0.00000000008539
0.00000000000014
0.33333333330478
fopt=
-5.86666666663444
key=
1
结论:
由上述结果知该函数的最优点为:
X=
4.0
0.0
0.0
0.3
故此函数的极小值为:
fopt=-5.87
②Aeq=[];Beq=[];
f=[-7,-12];
A=[9,4;4,5;3,10];
B=[360;200;300];
LB=zeros(2,1);UB=[];
[X,fopt,key]=linprog(f,A,B,Aeq,Beq,LB,UB);
X,fopt,key
>>cc3
Optimizationterminatedsuccessfully.
X=
19.99999999999513
23.99999999999991
fopt=
-4.279999999999648e+002
key=
1
结论:
由上述结果知该函数的最优解点为:
X=
20.0
24.0
故此函数的最小值为:
fopt=-4.28e+002
5-2
Aeq=[];Beq=[];
f=[-7000,-12000];
A=[9,4;4,5;3,10];B=[360;200;300];
LB=zeros(2,1);UB=[];
[X,fopt,key]=linprog(f,A,B,Aeq,Beq,LB,UB);
X,fopt,key
Optimizationterminatedsuccessfully.
X=
19.99999999999673
23.99999999999963
fopt=
-4.279999999999726e+005
key=
1
结论:
由上述结果知该函数的最优解点为:
X=
20.0
24.0
故此函数的最小值为:
fopt=-4.28e+005
5-4
Aeq=[];Beq=[];
f=[-0.30,-0.15];
A=[-1,-1;1,1];B=[-600;1000];
LB=zeros(2,1);UB=[800;1200];
[X,fopt,key]=linprog(f,A,B,Aeq,Beq,LB,UB);
X,fopt,key
X=
7.99999999999976
1.99999999999523
fopt=
-2.699999999999213e+002
key=
1
结论:
由上述结果知该函数的最优解点为:
X=
8.0
2.0
故此函数的最小值为:
fopt=-2.70e+002
5-6
Aeq=[];Beq=[];
f=[1,-2];
A=[1,1;-2,-1];
B=[5;-3];
LB=zeros(2,1);UB=[];
[X,fopt,key]=linprog(f,A,B,Aeq,Beq,LB,UB);
X,fopt,key
>>cc4
Optimizationterminatedsuccessfully.
X=
0.00000000016734
4.99999999277444
fopt=
-9.99999998538153
key=
1
结论:
由上述结果知该函数的最优解点为:
X=
0.0
5.0
故此函数的最小值为:
fopt=-10.00
5-7
Aeq=[1,2,1];Beq=[6];
f=[-5,-4,-8];
A=[5,3,0;2,-1,0];
B=[15;4];
LB=zeros(3,1);UB=[];
[X,fopt,key]=linprog(f,A,B,Aeq,Beq,LB,UB);
X,fopt,key
Optimizationterminatedsuccessfully.
X=
0.00000000000002
0.00000000000000
5.99999999999997
fopt=
-47.99999999999991
key=
1
结论:
由上述结果知该函数的最优解点为:
X=
0.0
0.0
6.0
故此函数的最小值为:
fopt=-48.00
第六章
6-2已知约束优化问题:
min
s.t.
试以
,
为复合型的初始点,用复合型法进行二次迭代计算。
主程序:
functionf=exefun(x)
f=4*x
(1)-x
(2)*x
(2)-12;
function[c,ceq]=execonfun(x)
c=[x
(1)*x
(1)+x
(2)*x
(2)-25;
-x
(1);
-x
(2)];
ceq=[];
x0=[2,1];
lb=[0,0];
ub=[];
options=optimset('LargeScale','off','display','iter','tolx',1e-6);
[x,fval,exitflag,output]=fmincon('exefun',x0,[],[],[],[],lb,ub,'execonfun',options)
输出结果:
maxDirectionalFirst-order
IterF-countf(x)constraintStep-sizederivativeoptimalityProcedure
17-2101-206
211-44.11117.1111-30.25.53Hessianmodifiedtwice
315-37.39370.393716.320.409Hessianmodifiedtwice
419-37.00150.00152610.3910.1
523-372.327e-00810.001530.1Hessianmodified
627-374.416e-02212.3e-0084Hessianmodifiedtwice
Optimizationterminatedsuccessfully:
Searchdirectionlessthan2*options.TolXand
maximumconstraintviolationislessthanoptions.TolCon
ActiveConstraints:
3
x=-05
fval=-37
exitflag=1
output=iterations:
6
funcCount:
27
stepsize:
1
algorithm:
'medium-scale:
SQP,Quasi-Newton,line-search'
firstorderopt:
4.0000
cgiterations:
[]
6-3用外点法求解下列问题的最优解,并用MATLAB计算下列约束优化问题。
min
s.t.
主程序为:
functionf=exefun(x)
f=x
(1)+x
(2);
function[c,ceq]=execonfun(x)
c=[3-x
(2);
-x
(1);
x
(2)];
ceq=[];
x0=[2,1];
lb=[0,0];
ub=[];
options=optimset('LargeScale','off','display','iter','tolx',1e-6);
[x,fval,exitflag,output]=fmincon('exefun',x0,[],[],[],[],lb,ub,'execonfun',options)
输出结果:
maxDirectionalFirst-order
IterF-countf(x)constraintStep-sizederivativeoptimalityProcedure
173.51.510.51infeasible
2113.51.51-8.59e-0091Hessianmodifiedtwice;infeasible
Optimizationterminated:
Nofeasiblesolutionfound.
Searchdirectionlessthan2*options.TolXbutconstraintsarenotsatisfied.
x=21.5
fval=3.5000
exitflag=-1
output=iterations:
2
funcCount:
11
stepsize:
1
algorithm:
'medium-scale:
SQP,Quasi-Newton,line-search'
firstorderopt:
1.0000
cgiterations:
[]
6-4用内点法求解下列问题的最优解,并用Matlab计算下列约束优化问题。
min
s.t.
,
主程序为:
functionf=exefun(x)
f=x
(1)+x
(2);
function[c,ceq]=execonfun(x)
c=[x
(1)*x
(1)-x
(2);
-x
(1)];
ceq=[];
x0=[2,1];
lb=[0,0];
ub=[];
options=optimset('LargeScale','off','display','iter','tolx',1e-6);
[x,fval,exitflag,output]=fmincon('exefun',x0,[],[],[],[],lb,ub,'execonfun',options)
输出结果:
maxDirectionalFirst-order
IterF-countf(x)constraintStep-sizederivativeoptimalityProcedure
17111-21
2115.02476e-0092.525e-0171-10.62Hessianmodifiedtwice
315001-5.02e-0092.22e-016Hessianmodified
Optimizationterminatedsuccessfully:
First-orderoptimalitymeasurelessthanoptions.TolFunand
maximumconstraintviolationislessthanoptions.TolCon
ActiveConstraints:
1;2
x=00
fval=0
exitflag=1
output=iterations:
3
funcCount:
15
stepsize:
1
algorithm:
'medium-scale:
SQP,Quasi-Newton,line-search'
firstorderopt:
2.2204e-016
cgiterations:
[]
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- 优化 设计 方法 剖析