lingo求均方差最小值的点model:sets:xx/1..100/:a;yy/1..100/:b;zz/1..100/:c;dd/1..100/:d;endsetsdata:a=@file('c:\x.txt');b=@file('c:\y.txt');c=@file('c:\z.txt');enddatad(I)=@sqrt((x-xx(I))^2+(y-yy(I))^2+(z-zz(I))^2);min=@sum((d(I)-@SUM(d(I))/101)^2);END提示d(i)这里出错.
问题描述:
lingo求均方差最小值的点
model:
sets:
xx/1..100/:a;
yy/1..100/:b;
zz/1..100/:c;
dd/1..100/:d;
endsets
data:
a=@file('c:\x.txt');
b=@file('c:\y.txt');
c=@file('c:\z.txt');
enddata
d(I)=@sqrt((x-xx(I))^2+(y-yy(I))^2+(z-zz(I))^2);
min=@sum((d(I)-@SUM(d(I))/101)^2);
END
提示d(i)这里出错.
答
model:
sets:
s/1..100/:x,y,z,d;
endsets
data:
enddata
@for(s(i):d(i)=@sqrt((x0-x(i))^2+(y0-y(i))^2+(z0-z(i))^2));
min=@sum(s(i):(d(i)-@sum(s(j):d(j))/100)^2);
end