用lingo解决一个指派问题,要求写出程序,万分感谢
有一份中文说明书,需翻译成英。日。德,俄四种语言,分别记作EJGR。现有甲乙丙丁四个人,问如何指派时间最少EJGR甲215134乙1041415丙9141613丁7811...
有一份中文说明书,需翻译成英。日。德,俄 四种语言,分别记作E J G R。现有甲乙丙丁四个人,问如何指派时间最少
E J G R
甲 2 15 13 4
乙 10 4 14 15
丙 9 14 16 13
丁 7 8 11 9 展开
E J G R
甲 2 15 13 4
乙 10 4 14 15
丙 9 14 16 13
丁 7 8 11 9 展开
2个回答
展开全部
其实题目是不够全的 需要指出是否四个人必须要分别翻译四种语言 还有指派时间指的是加起来还是最长的那个 这里按照每人必须对应一个语言 指派时间是加起来算
model:
sets:
person/1..4/;
language/1..4/;
translate(person,language):time,x;
endsets
data:
time=
2 15 13 4
10 4 14 15
9 14 16 13
7 8 11 9;
enddata
min=@sum(translate:time*x);
@for(person(i):@sum(language(j):x)=1);
@for(language(j):@sum(person(i):x)=1);
@for(translate:@bin(x));
end
model:
sets:
person/1..4/;
language/1..4/;
translate(person,language):time,x;
endsets
data:
time=
2 15 13 4
10 4 14 15
9 14 16 13
7 8 11 9;
enddata
min=@sum(translate:time*x);
@for(person(i):@sum(language(j):x)=1);
@for(language(j):@sum(person(i):x)=1);
@for(translate:@bin(x));
end
展开全部
同LS指定每人翻译且只翻译一种语言
model:
sets:
r/1..4/:;
c/1..4/:;
link(r,c):time,x;
endsets
data:
time= 2 15 13 4
10 4 14 15
9 14 16 13
7 8 11 9;
enddata
min=@sum(link:x*time);
@for(link:@bin(x));
@for(r(i):@sum(c(j):x(i,j))=1);
@for(c(j):@sum(r(i):x(i,j))=1);
end
Global optimal solution found.
Objective value: 28.00000
Extended solver steps: 0
Total solver iterations: 0
Variable Value Reduced Cost
X( 1, 4) 1.000000 4.000000
X( 2, 2) 1.000000 4.000000
X( 3, 1) 1.000000 9.000000
X( 4, 3) 1.000000 11.00000
LS仁兄
@for(person(i):@sum(language(j):x)=1);
@for(language(j):@sum(person(i):x)=1);
没有写成x(i,j)结果得不到正确答案
Global optimal solution found.
Objective value: 22.00000
Extended solver steps: 0
Total solver iterations: 0
Variable Value Reduced Cost
X( 1, 1) 1.000000 2.000000
X( 2, 2) 1.000000 4.000000
X( 3, 1) 1.000000 9.000000
X( 4, 1) 1.000000 7.000000
不满足每列和为1
model:
sets:
r/1..4/:;
c/1..4/:;
link(r,c):time,x;
endsets
data:
time= 2 15 13 4
10 4 14 15
9 14 16 13
7 8 11 9;
enddata
min=@sum(link:x*time);
@for(link:@bin(x));
@for(r(i):@sum(c(j):x(i,j))=1);
@for(c(j):@sum(r(i):x(i,j))=1);
end
Global optimal solution found.
Objective value: 28.00000
Extended solver steps: 0
Total solver iterations: 0
Variable Value Reduced Cost
X( 1, 4) 1.000000 4.000000
X( 2, 2) 1.000000 4.000000
X( 3, 1) 1.000000 9.000000
X( 4, 3) 1.000000 11.00000
LS仁兄
@for(person(i):@sum(language(j):x)=1);
@for(language(j):@sum(person(i):x)=1);
没有写成x(i,j)结果得不到正确答案
Global optimal solution found.
Objective value: 22.00000
Extended solver steps: 0
Total solver iterations: 0
Variable Value Reduced Cost
X( 1, 1) 1.000000 2.000000
X( 2, 2) 1.000000 4.000000
X( 3, 1) 1.000000 9.000000
X( 4, 1) 1.000000 7.000000
不满足每列和为1
本回答被提问者和网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询
广告 您可能关注的内容 |