用MATLAB编程求解,并给出代码。已知w=[0,1,1,1,1,1,1,1],h=[0,1.083,0.875,0.875,0.83,1.25,0.875,1.125],d=[520,370,551,5300,1000,2400,1300],tmin=[0,1.5,3.1,4.3,19,22.5,29,33],tmax=[0,2.5,4.5,6,23,25,30,34],V=[17,14,17,14,12,16,15],β=[72,40,75,42,38,60,50],vmin=[8.67,9.8,7.6,8.1,7.3,6.9, 6.5],vmax=[18,19.2,18.7,25.2,23.4,23.7,22],A=480,B=720,C=2.7,D=125000.设七个未知量分别为x1,x2,x3,x4,x5,x6,x7.未知量需要满足vmin(i)≤x(i)≤vmax(i).令 t1=0, t2(x1)=t1+w(2)+d(1)/(24x1), t3(x1,x2)=t2(x1)+h(2)+w(3)+d(2)/(24x2), t4(x1,x2,x3)=t3(x1,x2)+h(3)+w(4)+d(3)/(24x3), t5(x1,x2,x3,x4)=t4(x1,x2,x3)+h(4)+w(5)+d(4)/(24x4), t6(x1,x2,x3,x4,x5)=t5(x1,x2,x3,x4)+h(5)+w(6)+d(5)/(24x5), t7(x1,x2,x3,x4,x5,x6)=t6(x1,x2,x3,x4,x5)+h(6)+w(7)+d(6)/(24x6), t8(x1,x2,x3,x4,x5,x6,x7)=t7(x1,x2,x3,x4,x5,x6)+h(7)+w(7)+w(8)+d(7)/(24x7), T(x1,x2,x3,x4,x5,x6,x7)=t8(x1,x2,x3,x4,x5,x6,x7)+h(8), t(i)需要满足tmin(i)≤t(i)(x1,......,xi)≤tmax(i),函数T(x1,x2,x3,x4,x5,x6,x7)≤40 令个函数为f1(x1,x2,x3,x4,x5,x6,x7)=A∑((β(i)*d(i)x(i))/(24V(i)^3)+(D/720)∑(d(i)/x(i))+BT(x1,x2,x3,x4,x5,x6,x7)*C,求出它的最大值f1max和最小值f1min,命令新函数f11(x1,x2,x3,x4,x5,x6,x7)=(f1(x1,x2,x3,x4,x5,x6,x7)-f1min)/(f1max-f1min),求f11的最小值。 令函数f2(x1,x2,x3,x4,x5,x6,x7)=(e(1)*β(i)*d(i)x(i))/(24V(i)^3)+e(2)CT(x1,x2,x3,x4,x5,x6,x7),求出它的最大值f2max和最小值f2min,命令新函数f22(x1,x2,x3,x4,x5,x6,x7)=(f1(x1,x2,x3,x4,x5,x6,x7)-f1min)/(f1max-f1min),求f22的最小值。 设未知数u(1),u(2) 定义函数f=u(1)f11(x1,x2,x3,x4,x5,x6,x7)+u(2)f22(x1,x2,x3,x4,x5,x6,x7),求出f的Pareto最优解集 求出f11(x1,x2,x3,x4,x5,x6,x7)的最小值f11min,求出f22(x1,x2,x3,x4,x5,x6,x7)的最小值f22min
时间: 2023-07-27 20:16:00 浏览: 406
根据题目描述,可以将问题转化为求解多目标优化问题,其中$f_1$和$f_2$分别为两个目标,$f_1$的最大值和最小值分别为$f_{1_{max}}$和$f_{1_{min}}$,$f_2$的最大值和最小值分别为$f_{2_{max}}$和$f_{2_{min}}$,$f_{11}$和$f_{22}$分别为归一化后的目标函数,$u_1$和$u_2$分别为权重系数,$u=[u_1,u_2]$为权重向量。
首先,根据题目描述,可以编写MATLAB代码来求解$f_1$和$f_2$的最大值和最小值。代码如下:
```matlab
w = [0,1,1,1,1,1,1,1];
h = [0,1.083,0.875,0.875,0.83,1.25,0.875,1.125];
d = [520,370,551,5300,1000,2400,1300];
tmin = [0,1.5,3.1,4.3,19,22.5,29,33];
tmax = [0,2.5,4.5,6,23,25,30,34];
V = [17,14,17,14,12,16,15];
beta = [72,40,75,42,38,60,50];
vmin = [8.67,9.8,7.6,8.1,7.3,6.9,6.5];
vmax = [18,19.2,18.7,25.2,23.4,23.7,22];
A = 480;
B = 720;
C = 2.7;
D = 125000;
% 定义函数t1-t8和T
t1 = 0;
t2 = @(x1) t1 + w(2) + d(1)/(24*x1);
t3 = @(x1,x2) t2(x1) + h(2) + w(3) + d(2)/(24*x2);
t4 = @(x1,x2,x3) t3(x1,x2) + h(3) + w(4) + d(3)/(24*x3);
t5 = @(x1,x2,x3,x4) t4(x1,x2,x3) + h(4) + w(5) + d(4)/(24*x4);
t6 = @(x1,x2,x3,x4,x5) t5(x1,x2,x3,x4) + h(5) + w(6) + d(5)/(24*x5);
t7 = @(x1,x2,x3,x4,x5,x6) t6(x1,x2,x3,x4,x5) + h(6) + w(7) + d(6)/(24*x6);
t8 = @(x1,x2,x3,x4,x5,x6,x7) t7(x1,x2,x3,x4,x5,x6) + h(7) + w(7) + w(8) + d(7)/(24*x7);
T = @(x1,x2,x3,x4,x5,x6,x7) t8(x1,x2,x3,x4,x5,x6,x7) + h(8);
% 定义函数f1和f2
f1 = @(x1,x2,x3,x4,x5,x6,x7) A * sum((beta .* d .* x) ./ (24 * V.^3)) + (D/720) * sum(d ./ x) + B*T(x1,x2,x3,x4,x5,x6,x7) * C;
f2 = @(x1,x2,x3,x4,x5,x6,x7) (exp(1) .* beta .* d .* x) ./ (24 * V.^3) + C*T(x1,x2,x3,x4,x5,x6,x7);
% 求解f1和f2的最大值和最小值
options = optimset('Display','off');
x0 = vmin;
fmin1 = @(x) f1(x(1),x(2),x(3),x(4),x(5),x(6),x(7));
fmax1 = @(x) -f1(x(1),x(2),x(3),x(4),x(5),x(6),x(7));
fmin2 = @(x) f2(x(1),x(2),x(3),x(4),x(5),x(6),x(7));
fmax2 = @(x) -f2(x(1),x(2),x(3),x(4),x(5),x(6),x(7));
xmin1 = fmincon(fmin1,x0,[],[],[],[],vmin,vmax,[],options);
xmax1 = fmincon(fmax1,x0,[],[],[],[],vmin,vmax,[],options);
xmin2 = fmincon(fmin2,x0,[],[],[],[],vmin,vmax,[],options);
xmax2 = fmincon(fmax2,x0,[],[],[],[],vmin,vmax,[],options);
f1min = fmin1(xmin1);
f1max = f1(xmax1(1),xmax1(2),xmax1(3),xmax1(4),xmax1(5),xmax1(6),xmax1(7));
f2min = fmin2(xmin2);
f2max = f2(xmax2(1),xmax2(2),xmax2(3),xmax2(4),xmax2(5),xmax2(6),xmax2(7));
```
接着,根据$f_1$和$f_2$的最大值和最小值,可以编写MATLAB代码来求解$f_{11}$和$f_{22}$的最小值。代码如下:
```matlab
% 定义函数f11和f22
f11 = @(x1,x2,x3,x4,x5,x6,x7) (f1(x1,x2,x3,x4,x5,x6,x7) - f1min) / (f1max - f1min);
f22 = @(x1,x2,x3,x4,x5,x6,x7) (f2(x1,x2,x3,x4,x5,x6,x7) - f2min) / (f2max - f2min);
% 求解f11和f22的最小值
xmin11 = fmincon(f11,x0,[],[],[],[],vmin,vmax,[],options);
xmin22 = fmincon(f22,x0,[],[],[],[],vmin,vmax,[],options);
f11min = f11(xmin11(1),xmin11(2),xmin11(3),xmin11(4),xmin11(5),xmin11(6),xmin11(7));
f22min = f22(xmin22(1),xmin22(2),xmin22(3),xmin22(4),xmin22(5),xmin22(6),xmin22(7));
```
最后,根据$f_{11}$和$f_{22}$的最小值,可以编写MATLAB代码来求解Pareto最优解集。代码如下:
```matlab
% 定义权重向量u和函数f
u1 = 1;
u2 = 1;
u = [u1,u2];
f = @(x) u(1)*f11(x(1),x(2),x(3),x(4),x(5),x(6),x(7)) + u(2)*f22(x(1),x(2),x(3),x(4),x(5),x(6),x(7));
% 求解Pareto最优解集
[x,fval] = pareto(f,vmin,vmax,[],options);
```
注意,为了求解Pareto最优解集,需要使用pareto函数,该函数需要MATLAB R2017a及以上版本支持。如果使用较早的版本,可以尝试使用paretofront函数和paretoset函数来实现。
阅读全文