最优化计算方法课件文稿演示
合集下载
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
最优化计算方法课件文稿演示
(优选)最优化计算方法课件
单变量优化
▪ 例3.1 再来考虑售猪问题。但现在考虑到猪 的生长率不是常数的事实。假设现在猪还 小,生长率是增加的。什么时候将猪售出 从而获得最大收益?
求解模型—图像法
clear all; close all; syms x y = (0.65-0.01*x)*200*exp(0.025*x)-0.45*x; ezplot(y,[0,20]); grid on
(approx)'), x1
灵敏性分析
▪ 考虑最优售猪时间关于小猪增长率c=0.025 的灵敏性。
xvalues = 0; for c = 0.022:0.001:0.028 y = (0.65-0.01*x)*200*exp(c*x)-0.45*x; dydx=diff(y,x); xmaxc=solve(dydx); xmaxc = double(xmaxc); xmaxc = xmaxc(1); xvalues = [xvalues; xmaxc]; end xvalues = xvalues(2:end);
F = dydx; F1 = diff(F,x); format long N = 10; % number of iterations x0 = 19 % initial guess fprintf(' iteration xvalue\n\n'); for i=1:N x1=x0-subs(F,x,x0)/subs(F1,x,x0); fprintf('%5.0f %1.16f\n', i, x1); x0 = x1; end display('Hence, the critical point (solution of F=0) is
数值方法求解--Matlab
dydx = diff(y,x) xmax = solve(dydx); xmax = double(xmax) xmax =xmax(1) ymax=subs(y,x,xmax)
Newton 法
▪ 求方程F(x)=0的根. ▪ 牛顿法: x(n)=x(n-1)-F(x(n-1))/F’(x(n-1))
0.91
0.91
8 (x 3)2 ( y 1)2 6 (x 5)2 ( y 1)2 ] / 84
▪ 问题为在区域0=<x=<6, 0=<y=<6上求z=f(x,y)的 最小值。
绘制目标函数图形
clear all syms x y r1 = sqrt((x-1)^2+(y-5)^2)^0.91; r2 = sqrt((x-3)^2+(y-5)^2)^0.91; r3 = sqrt((x-5)^2+(y-5)^2)^0.91; r4 = sqrt((x-1)^2+(y-3)^2)^0.91; r5 = sqrt((x-3)^2+(y-3)^2)^0.91; r6 = sqrt((x-5)^2+(y-3)^2)^0.91; r7 = sqrt((x-1)^2+(y-1)^2)^0.91; r8 = sqrt((x-3)^2+(y-1)^2)^0.91; r9 = sqrt((x-5)^2+(y-1)^2)^0.91; z = 3.2+1.7*(6*r1+8*r2+8*r3+21*r4+6*r5+3*r6+18*r7+8*r8+6*r9)/84; ezmesh(z)
16/5+...+17/140 (x2-10 x+26+y2-2 y)91/200
20
Hale Waihona Puke Baidu
15
10
5
5 0
5 0
-5
-5
y
x
绘制等值线图
135
130
125
120
0
5
10
15
20
25
30
35
40
x
ezplot(y,[18,22]); grid on
139.4
(130-2 x) exp(1/40 x)-9/20 x
139.35
139.3
139.25
139.2
139.15
18 18.5 19 19.5 20 20.5 21 21.5 22 x
ezplot(y,[19,20]); grid on
(130-2 x) exp(1/40 x)-9/20 x 139.395 139.394 139.393 139.392 139.391 139.39 139.389 139.388 139.387 139.386 139.385
19 19.1 19.2 19.3 19.4 19.5 19.6 19.7 19.8 19.9 20 x
z f (x, y)
0.91
3.2 1.7[6 (x 1)2 ( y 5)2
0.91
0.91
8 (x 2)2 ( y 5)2 8 (x 5)2 ( y 5)2
0.91
0.91
21 (x 1)2 ( y 3)2 6 (x 3)2 ( y 3)2
0.91
0.91
3 (x 5)2 ( y 3)2 18 (x 1)2 ( y 1)2
ezplot(y,[0,20])
(130-2 x) exp(1/40 x)-9/20 x 140 139 138 137 136 135 134 133 132 131 130
0
2
4
6
8 10 12 14 16 18 20
x
ezplot(y,[0,40])
(130-2 x) exp(1/40 x)-9/20 x 140
据的统计分析给出:对离救火站r英里打来
的求救电话,需要的响应时间估计
为
。下图给出了从消3.2防1管.7r0员.91 处得到
的从城区不同区域打来的求救电话频率的
估计数据。求新的消防站的最佳位置。
301421 211232 533012 852100 10 6 3 1 3 1 023111
▪ 设(x,y)为新消防站的位置,对求救电话的平均响 应时间为:
cvalues = 0.022:0.001:0.028; cvalues=cvalues'; % transposes the row into
a column format short; display([cvalues,xvalues])
3.2 多变量最优化
▪ 例3.2 更新消防站的位置。对响应时间数
(优选)最优化计算方法课件
单变量优化
▪ 例3.1 再来考虑售猪问题。但现在考虑到猪 的生长率不是常数的事实。假设现在猪还 小,生长率是增加的。什么时候将猪售出 从而获得最大收益?
求解模型—图像法
clear all; close all; syms x y = (0.65-0.01*x)*200*exp(0.025*x)-0.45*x; ezplot(y,[0,20]); grid on
(approx)'), x1
灵敏性分析
▪ 考虑最优售猪时间关于小猪增长率c=0.025 的灵敏性。
xvalues = 0; for c = 0.022:0.001:0.028 y = (0.65-0.01*x)*200*exp(c*x)-0.45*x; dydx=diff(y,x); xmaxc=solve(dydx); xmaxc = double(xmaxc); xmaxc = xmaxc(1); xvalues = [xvalues; xmaxc]; end xvalues = xvalues(2:end);
F = dydx; F1 = diff(F,x); format long N = 10; % number of iterations x0 = 19 % initial guess fprintf(' iteration xvalue\n\n'); for i=1:N x1=x0-subs(F,x,x0)/subs(F1,x,x0); fprintf('%5.0f %1.16f\n', i, x1); x0 = x1; end display('Hence, the critical point (solution of F=0) is
数值方法求解--Matlab
dydx = diff(y,x) xmax = solve(dydx); xmax = double(xmax) xmax =xmax(1) ymax=subs(y,x,xmax)
Newton 法
▪ 求方程F(x)=0的根. ▪ 牛顿法: x(n)=x(n-1)-F(x(n-1))/F’(x(n-1))
0.91
0.91
8 (x 3)2 ( y 1)2 6 (x 5)2 ( y 1)2 ] / 84
▪ 问题为在区域0=<x=<6, 0=<y=<6上求z=f(x,y)的 最小值。
绘制目标函数图形
clear all syms x y r1 = sqrt((x-1)^2+(y-5)^2)^0.91; r2 = sqrt((x-3)^2+(y-5)^2)^0.91; r3 = sqrt((x-5)^2+(y-5)^2)^0.91; r4 = sqrt((x-1)^2+(y-3)^2)^0.91; r5 = sqrt((x-3)^2+(y-3)^2)^0.91; r6 = sqrt((x-5)^2+(y-3)^2)^0.91; r7 = sqrt((x-1)^2+(y-1)^2)^0.91; r8 = sqrt((x-3)^2+(y-1)^2)^0.91; r9 = sqrt((x-5)^2+(y-1)^2)^0.91; z = 3.2+1.7*(6*r1+8*r2+8*r3+21*r4+6*r5+3*r6+18*r7+8*r8+6*r9)/84; ezmesh(z)
16/5+...+17/140 (x2-10 x+26+y2-2 y)91/200
20
Hale Waihona Puke Baidu
15
10
5
5 0
5 0
-5
-5
y
x
绘制等值线图
135
130
125
120
0
5
10
15
20
25
30
35
40
x
ezplot(y,[18,22]); grid on
139.4
(130-2 x) exp(1/40 x)-9/20 x
139.35
139.3
139.25
139.2
139.15
18 18.5 19 19.5 20 20.5 21 21.5 22 x
ezplot(y,[19,20]); grid on
(130-2 x) exp(1/40 x)-9/20 x 139.395 139.394 139.393 139.392 139.391 139.39 139.389 139.388 139.387 139.386 139.385
19 19.1 19.2 19.3 19.4 19.5 19.6 19.7 19.8 19.9 20 x
z f (x, y)
0.91
3.2 1.7[6 (x 1)2 ( y 5)2
0.91
0.91
8 (x 2)2 ( y 5)2 8 (x 5)2 ( y 5)2
0.91
0.91
21 (x 1)2 ( y 3)2 6 (x 3)2 ( y 3)2
0.91
0.91
3 (x 5)2 ( y 3)2 18 (x 1)2 ( y 1)2
ezplot(y,[0,20])
(130-2 x) exp(1/40 x)-9/20 x 140 139 138 137 136 135 134 133 132 131 130
0
2
4
6
8 10 12 14 16 18 20
x
ezplot(y,[0,40])
(130-2 x) exp(1/40 x)-9/20 x 140
据的统计分析给出:对离救火站r英里打来
的求救电话,需要的响应时间估计
为
。下图给出了从消3.2防1管.7r0员.91 处得到
的从城区不同区域打来的求救电话频率的
估计数据。求新的消防站的最佳位置。
301421 211232 533012 852100 10 6 3 1 3 1 023111
▪ 设(x,y)为新消防站的位置,对求救电话的平均响 应时间为:
cvalues = 0.022:0.001:0.028; cvalues=cvalues'; % transposes the row into
a column format short; display([cvalues,xvalues])
3.2 多变量最优化
▪ 例3.2 更新消防站的位置。对响应时间数