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
这个不是10个小图合成一个大图,是把10个图以不同的权重叠加在一起,这个权重就是要求的x。也就是x向量有10个标量对应10个图。然后,优化函数中,我把图形以 60*60大小进行划分, 也就是说整张图分成N个 60*60的 block。 优化的目标就是,图像中的游猜某些block内的像素进行羡念计算,求出该block块儿的梯度。优化目标是让该梯度 = 0.24 。 所以,会神派型有多个block 的梯度 都有要求, 相当于多个优化目标。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)