非线性规划料场选址目标函数

pull/2/head
盘荣博 4 months ago
parent 97a3f6598d
commit d032cbab43

@ -0,0 +1,15 @@
function f=fun2(x)
a=[1.25,8.75,0.5,5.75,3,7.25];
b=[1.25,0.75,4.75,5,6.5,7.25];
f1 = 0; % 初始化f1
f2 = 0; % 初始化f2
for i=1:6
s=sqrt((a(i)-x(13))^2+(b(i)-x(14))^2);
f1=x(i)*s+f1;
end
for i=7:12
s=sqrt((a(i-6)-x(15))^2+(b(i-6)-x(16))^2);
f2=s*x(i)+f2;
end
f=f1+f2;
end
Loading…
Cancel
Save