model:
sets:
chan/c1..c10/:p,q,w,f;
xie/1..5/:d;
links(chan,xie):x,c,l,a,b,t;
endsets
@for(chan(i):
@sum(xie(j):x(i,j))<=f(i)*8*60*154/5);
@for(chan(i):
x(i,1)+x(i,2)+x(i,5)<=p(i)*10000;
x(i,3)+x(i,4)<=q(i)*10000);
@for(xie(j):
@sum(chan(i):x(i,j))>=d(j));
@for(xie(j):
@sum(chan(i):x(i,j)*(w(i)-30.5))<=0);
@for(xie(j):
@sum(chan(i):x(i,j)*(w(i)-28.5))>=0);
@sum(chan(i):f(i))<=7;
@for(chan(i):
@bin(f(i)));
@sum(links(i,j):x(i,j)/(154*b(i,j)))<=20;
@for(links(i,j):
t(i,j)=c(i,j)*2000/v+8;
a(i,j)=t(i,j)/5;
b(i,j)=(8*60-(a(i,j)-1)*5)/t(i,j);
l(i,j)=a(i,j)*b(i,j);
x(i,j)<=154*l(i,j));
@for(links(i,j):
@floor(x(i,j)/154)=x(i,j)/154);
min=@sum(links(i,j):x(i,j)*c(i,j));
data:
v=28000/60;
p=0.95 1.05 1.00 1.05 1.10 1.25 1.05 1.30 1.35 1.25;
q=1.25 1.10 1.35 1.05 1.15 1.35 1.05 1.15 1.35 1.25;
w=30 28 29 32 31 33 32 31 33 31;
d=1.2 1.3 1.3 1.9 1.3;
c=5.26 1.90 5.89 0.64 4.42
5.19 0.99 5.61 1.76 3.86
4.21 1.90 5.61 1.27 3.72
4.00 1.13 4.56 1.83 3.16
2.95 1.27 3.51 2.74 2.25
2.74 2.25 3.65 2.60 2.81
2.46 1.48 2.46 4.21 0.78
1.90 2.04 2.46 3.72 1.62
0.64 3.09 1.06 5.05 1.27
1.27 3.51 0.57 6.10 0.50;
enddata
end
lingo运行错误improper use of attribute name,求高手???
答案:2 悬赏:0 手机版
解决时间 2021-03-05 17:46
- 提问者网友:那叫心脏的地方装的都是你
- 2021-03-05 03:53
最佳答案
- 五星知识达人网友:洒脱疯子
- 2021-03-05 04:52
修改如下,用设置全局求解器求解可得到结果
model:
sets:
chan/c1..c10/:p,q,w,f;
xie/1..5/:d;
links(chan,xie):x,c,l,a,b,t;
endsets
@for(chan(i):
@sum(xie(j):x(i,j))<=f(i)*8*60*154/5);
@for(chan(i):
x(i,1)+x(i,2)+x(i,5)<=p(i)*10000;
x(i,3)+x(i,4)<=q(i)*10000);
@for(xie(j):
@sum(chan(i):x(i,j))>=d(j));
@for(xie(j):
@sum(chan(i):x(i,j)*(w(i)-30.5))<=0);
@for(xie(j):
@sum(chan(i):x(i,j)*(w(i)-28.5))>=0);
@sum(chan(i):f(i))<=7;
@for(chan(i):
@bin(f(i)));
@sum(links(i,j):x(i,j)/(154*b(i,j)))<=20;
@for(links(i,j):
t(i,j)=c(i,j)*2000/v+8;
a(i,j)=t(i,j)/5;
b(i,j)=(8*60-(a(i,j)-1)*5)/t(i,j);
l(i,j)=a(i,j)*b(i,j);
x(i,j)<=154*l(i,j));
@for(links(i,j):
@floor(x(i,j)/154)=x(i,j)/154);
min=@sum(links(i,j):x(i,j)*c(i,j));
v=28000/60;!包含算式的不能写在data里面;
data:
p=0.95 1.05 1.00 1.05 1.10 1.25 1.05 1.30 1.35 1.25;
q=1.25 1.10 1.35 1.05 1.15 1.35 1.05 1.15 1.35 1.25;
w=30 28 29 32 31 33 32 31 33 31;
d=1.2 1.3 1.3 1.9 1.3;
c=5.26 1.90 5.89 0.64 4.42
5.19 0.99 5.61 1.76 3.86
4.21 1.90 5.61 1.27 3.72
4.00 1.13 4.56 1.83 3.16
2.95 1.27 3.51 2.74 2.25
2.74 2.25 3.65 2.60 2.81
2.46 1.48 2.46 4.21 0.78
1.90 2.04 2.46 3.72 1.62
0.64 3.09 1.06 5.05 1.27
1.27 3.51 0.57 6.10 0.50;
enddata
end
model:
sets:
chan/c1..c10/:p,q,w,f;
xie/1..5/:d;
links(chan,xie):x,c,l,a,b,t;
endsets
@for(chan(i):
@sum(xie(j):x(i,j))<=f(i)*8*60*154/5);
@for(chan(i):
x(i,1)+x(i,2)+x(i,5)<=p(i)*10000;
x(i,3)+x(i,4)<=q(i)*10000);
@for(xie(j):
@sum(chan(i):x(i,j))>=d(j));
@for(xie(j):
@sum(chan(i):x(i,j)*(w(i)-30.5))<=0);
@for(xie(j):
@sum(chan(i):x(i,j)*(w(i)-28.5))>=0);
@sum(chan(i):f(i))<=7;
@for(chan(i):
@bin(f(i)));
@sum(links(i,j):x(i,j)/(154*b(i,j)))<=20;
@for(links(i,j):
t(i,j)=c(i,j)*2000/v+8;
a(i,j)=t(i,j)/5;
b(i,j)=(8*60-(a(i,j)-1)*5)/t(i,j);
l(i,j)=a(i,j)*b(i,j);
x(i,j)<=154*l(i,j));
@for(links(i,j):
@floor(x(i,j)/154)=x(i,j)/154);
min=@sum(links(i,j):x(i,j)*c(i,j));
v=28000/60;!包含算式的不能写在data里面;
data:
p=0.95 1.05 1.00 1.05 1.10 1.25 1.05 1.30 1.35 1.25;
q=1.25 1.10 1.35 1.05 1.15 1.35 1.05 1.15 1.35 1.25;
w=30 28 29 32 31 33 32 31 33 31;
d=1.2 1.3 1.3 1.9 1.3;
c=5.26 1.90 5.89 0.64 4.42
5.19 0.99 5.61 1.76 3.86
4.21 1.90 5.61 1.27 3.72
4.00 1.13 4.56 1.83 3.16
2.95 1.27 3.51 2.74 2.25
2.74 2.25 3.65 2.60 2.81
2.46 1.48 2.46 4.21 0.78
1.90 2.04 2.46 3.72 1.62
0.64 3.09 1.06 5.05 1.27
1.27 3.51 0.57 6.10 0.50;
enddata
end
全部回答
- 1楼网友:慢性怪人
- 2021-03-05 06:24
虽然我很聪明,但这么说真的难到我了
我要举报
如以上问答信息为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
推荐资讯