请教lingo程序已知两点坐标(0.54396095,2.119993265),(0.69667726,2.031854
来源:学生作业帮 编辑:大师作文网作业帮 分类:综合作业 时间:2024/11/18 07:58:33
请教lingo程序
已知两点坐标(0.54396095,2.119993265),(0.69667726,2.031854138)
求其余八个点中到已知两点距离最短的点.
我是这样编的,不过报错
model:
sets:
chshi/1..8/:a,b;
juli/1,2..8/:c;
endsets
min=@smin(6371*@acos(@cos(0.543961)*@cos(b(i))*@cos(2.119993-a(i))+@sin(0.696677)*@sin(b(i))+6371*@acos(@cos(0.696677)*@cos(b(i))*@cos(2.031854-a(i))+@sin(0.696677)*@sin(b(i)))));
data:
a=0.913970752 0.69667726 0.662643339 -0.643444718 0.239982772 0.722275422 0.69667726 0.916297857;
b=0.085230245 0.574504212 0.413933921 3.049962868 1.754055898 0.037524579 2.031854138 0.234165008;
enddata
end
已知两点坐标(0.54396095,2.119993265),(0.69667726,2.031854138)
求其余八个点中到已知两点距离最短的点.
我是这样编的,不过报错
model:
sets:
chshi/1..8/:a,b;
juli/1,2..8/:c;
endsets
min=@smin(6371*@acos(@cos(0.543961)*@cos(b(i))*@cos(2.119993-a(i))+@sin(0.696677)*@sin(b(i))+6371*@acos(@cos(0.696677)*@cos(b(i))*@cos(2.031854-a(i))+@sin(0.696677)*@sin(b(i)))));
data:
a=0.913970752 0.69667726 0.662643339 -0.643444718 0.239982772 0.722275422 0.69667726 0.916297857;
b=0.085230245 0.574504212 0.413933921 3.049962868 1.754055898 0.037524579 2.031854138 0.234165008;
enddata
end
显然是程序写错了…
有几个地方需要改正,目标函数把cos函数写成了acos.修改的程序如下,但是没有结果.
model:
sets:
chshi/1..8/:a,b;
juli/1,2..8/:c;
endsets
min=@min(chshi(i):6371*@cos(@cos(0.543961)*@cos(b(i))*@cos(2.119993-a(i))+@sin(0.696677)*@sin(b(i))+6371*@cos(@cos(0.696677)*@cos(b(i))*@cos(2.031854-a(i))+@sin(0.696677)*@sin(b(i)))));
data:
a=0.913970752 0.69667726 0.662643339 -0.643444718 0.239982772 0.722275422 0.69667726 0.916297857;
b=0.085230245 0.574504212 0.413933921 3.049962868 1.754055898 0.037524579 2.031854138 0.234165008;
enddata
end
有几个地方需要改正,目标函数把cos函数写成了acos.修改的程序如下,但是没有结果.
model:
sets:
chshi/1..8/:a,b;
juli/1,2..8/:c;
endsets
min=@min(chshi(i):6371*@cos(@cos(0.543961)*@cos(b(i))*@cos(2.119993-a(i))+@sin(0.696677)*@sin(b(i))+6371*@cos(@cos(0.696677)*@cos(b(i))*@cos(2.031854-a(i))+@sin(0.696677)*@sin(b(i)))));
data:
a=0.913970752 0.69667726 0.662643339 -0.643444718 0.239982772 0.722275422 0.69667726 0.916297857;
b=0.085230245 0.574504212 0.413933921 3.049962868 1.754055898 0.037524579 2.031854138 0.234165008;
enddata
end