数学建模与数学实验(第3版)课件+matlab
源代码在线查看: gying1.m
clear
a=[1.25 8.75 0.5 5.75 3 7.25];
b=[1.25 0.75 4.75 5 6.5 7.75];
d=[3 5 4 7 6 11];
x=[5 2];
y=[1 7];
e=[20 20];
for i=1:6
for j=1:2
aa(i,j)=sqrt((x(j)-a(i))^2+(y(j)-b(i))^2);
end
end
CC=[aa(:,1); aa(:,2)]';
A=[1 1 1 1 1 1 0 0 0 0 0 0
0 0 0 0 0 0 1 1 1 1 1 1];
B=[20;20];
Aeq=[1 0 0 0 0 0 1 0 0 0 0 0
0 1 0 0 0 0 0 1 0 0 0 0
0 0 1 0 0 0 0 0 1 0 0 0
0 0 0 1 0 0 0 0 0 1 0 0
0 0 0 0 1 0 0 0 0 0 1 0
0 0 0 0 0 1 0 0 0 0 0 1 ];
beq=[d(1);d(2);d(3);d(4);d(5);d(6)];
VLB=[0 0 0 0 0 0 0 0 0 0 0 0];VUB=[];
x0=[1 2 3 0 1 0 0 1 0 1 0 1];
[xx,fval]=linprog(CC,A,B,Aeq,beq,VLB,VUB,x0)