编程知识 cdmana.com

问题请教,约束条件带求和函数的优化,为什改变目标函数结果仍然一样

img

求指点和检查下这个代码,改变目标函数,XYZ取值

```

[X,Y,Z] = meshgrid(6:12,6:.1:20,8:30);
F = piX.Y.2.(500+Z)7850127505.5+piZ.2.50078501275026.5;%目标函数
C = true(size(X));
for i = 1:numel(X)
n = X(i);% x(1)
y = Y(i);% x(2)
z = Z(i);
c = 0;
for k = 1:1:n
c = c+((16
y (500+z+(k-1)y)^2 ))/((500+(k-1)y)((500+z+(k-1)y)^2-250000));
end
x = n;
C(i) = ((31.4
(3^0.5))
((500+x
y+z)/500)^2)/((((500+xy+z)/500)^2)-1)-(z134.2)/(xy+z)-((177.27xy)/(xy+z))-2c<=0;%约束条件
end
minf = min(F(C));
if(isempty(minf))
fprintf('无解\n')
else
I = find((minf==F)&C);
x = X(I);
y = Y(I);
z = Z(I);
fmin =pi
x.y.2.(500+z)7850127505.5+piz.500278501275026.5;%结果输出
fprintf('在x=%d,y=%d,z=%d处目标函数有最小值%d\n',x,y,z,fmin)
end
F(~C)=NaN;
scatter3(X(:),Y(:),Z(:),10,F(:))

```结果每次都一样

版权声明
本文为[CSDN问答]所创,转载请带上原文链接,感谢
https://ask.csdn.net/questions/7594107

Scroll to Top