matlab 多参数优化问题 求更正

matlab 多参数优化问题 求更正,第1张

程序问题:1.主晌让团程序提供的msg0,子程序却用msg,子程序不接受,应统一

2.msg0所示值不在VLB和VUB之间,滑桥按下面改:

function f=cpro(msg)

x=zeros(7,1000)

y=zeros(1,1000)

c(1)=25

c(5)=50

c(7)=50

for i=3

if abs(msg(i+7)*3-msg(i))/msg(i)<=0.01

c(i)=200

elseif abs(msg(i+7)*3-msg(i))/msg(i)>0.01&&abs(msg(i+7)*3-msg(i))/msg(i)<=0.05

c(i)=50

else

c(i)=20

end

end

for i=4

if abs(msg(i+7)*3-msg(i))/msg(i)<=0.01

c(i)=500

elseif abs(msg(i+7)*3-msg(i))/msg(i)>0.01&&abs(msg(i+7)*3-msg(i))/msg(i)<=0.05

c(i)=100

else

c(i)=50

end

end

for i=6

if abs(msg(i+7)*3-msg(i))/msg(i)<=0.01

c(i)=100

elseif abs(msg(i+7)*3-msg(i))/msg(i)>0.01&&abs(msg(i+7)*3-msg(i))/msg(i)<=0.05

c(i)=25

else

c(i)=10

end

end

for i=1:7

for j=1:1000

x(i,j)=normrnd(msg(i),msg(i+7))

end

end

for j=1:1000

y(j)=174.42*(x(1,j)/x(5,j))*(x(3,j)/(x(2,j)-x(1,j)))^0.85*sqrt((1-2.62*(1-0.36*(x(4,j)/x(2,j))^-0.56)^1.5*(x(4,j)/x(2,j))^1.16)/(x(6,j)*x(7,j)))

end

for j=1:1000

if abs(y(j)-1.5)<=0.1

w(j)=0

elseif abs(y(j)-1.5)<=0.3&&abs(y(j)-1.5)>=0.1

w(j)=1000

else

w(j)=9000

end

end

f=sum(w)/1000+sum(c)

%{

主程序

msg=[0.1 0.25 0.1 0.1 1.5 16 0.7 0.5 0.5 0.5 0.5 0.5 0.5 0.5]

VLB=[0.075 0.225 0.075 0.075 1.125 12 0.5625 0 0 0 0 0 0 0]

VUB=[0.125 0.375 0.125 0.125 1.875 20 0.935 0.7 0.7 0.7 0.9 0.9 0.9 0.9]

[msg0,fval]=fmincon('cpro',msg,[],[],[],[],VLB,VUB)

%}

保存后在命令行输入主程宴橘序,结果:

Warning: Trust-region-reflective method does not currently solve this type of problem,

using active-set (line search) instead.

>In fmincon at 422

Maximum number of function evaluations exceeded

increase OPTIONS.MaxFunEvals.

msg0 =

0.07500.36560.07810.07501.1720 12.00200.56260.01610.00020.00020.02360.69860.0002 0

fval =

6890

当δ=b^2-4ac≥迟数0时,x=[-b±(b^2-4ac)^(1/2)]/2a

当δ=b^2-4ac<0时,x={-b±[(4ac-b^2)^(1/2)]i}/首旦悔2a(i是者正虚数单位)matlab不会,c或者c#很容易实现

Sv,Sh,C,则昌Fz你的程序中没有唤弊用到

MaxFunEvals 3000次不够,建议迭代次数都用默认

四组数据中有些有问题

算出来的结果当然和你给的图和盯族不一样


欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/yw/8197840.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-04-14
下一篇 2023-04-14

发表评论

登录后才能评论

评论列表(0条)

保存