下面的lingo代码错在哪里?帮忙改正啊!

发布网友 发布时间:2024-10-24 12:54

我来回答

1个回答

热心网友 时间:2024-11-09 08:45

model:
title:第一题;
sets:
chanpin/1..7/:p,s,c;!p价格,s标准差,c成本;
month/1..6/;
shebei/1..5/:W;
link(month,chanpin):y,x,M,K,z,ymax,g;!x为生产的数量,y为存储量,M为最大需求量,z为销量,K为波动系数;
yueshe(month,shebei):A,f;!工作的设备;
jushe(chanpin,shebei):H;!生产单位产品i对应设备所需台时j;
endsets
data:
E1=0.8;E2=1.2;Wmax=70;u=5;
ymax=100,100,100,100,100,100,100, 100,100,100,100,100,100,100, 100,100,100,100,100,100,100, 100,100,100,100,100,100,100, 100,100,100,100,100,100,100, 50,50,50,50,50,50,50;
p=200,160,80,80,120,90,60;
s=50,40,10,15,20,8,2;
c=40,30,12,10,20,15,14;
A=3,2,3,1,1, 4,2,1,1,1, 4,2,3,0,1, 4,1,3,1,1, 3,1,3,1,1, 4,2,2,1,0;
H=0.5,0.1,0.2,0.05,0, 0.7,0.2,0,0.03,0, 0,0,0.8,0,0.01, 0,0.3,0,0.07,0, 0.3,0,0,0.1,0.05, 0.2,0.6,0,0,0, 0.5,0,0.6,0.08,0.05;
M=1000,1500,300,300,800,200,100, 800,600,200,0,400,300,150, 400,600,0,0,500,400,100, 400,500,400,500,200,0,100,
100,200,500,100,1000,300,0, 800,400,300,300,1500,500,80;
enddata
[obj] max=Q;
Q=@sum(link(t,i):z(t,i)*(p(i)+K(t,i)*s(i)))-@sum(link(t,i):c(i)*x(t,i))-@sum(link(t,i):y(t,i)*u)
-@sum(yueshe(t,j):@if(f(t,j)#eq#1,@sum(link(tt,i):x(tt,i)*H(tt,i)-240*E2)+240*E1*W(j),@sum(link(tt,i):x(tt,i)*H(i,j)*E1)));
@for(yueshe(t,j):f(t,j)=@sign(@sum(yueshe(t,j):x(t,j)*H(t,j)-240));@free(f(t,j)));
@for(link(t,i):x(t,i)<=M(t,i)+y(t,i));!数量约束;
@for(link(t,i):y(t,i)<=ymax(t,i));!存储量约束;
@for(link(t,i)|t#gt#1:y(t,i)=y(t-1,i)+x(t,i)-z(t,i));!存储量约束;
@for(yueshe(t,j):@sum(chanpin(i):H(i,j)*x(t,i))<=A(t,j)*24*30);!台时约束;
!@for(shebei(j):W(j)*H(i,j)*x(t,i)<=Wmax*24*30);!功率约束;
!@for(chanpin(i):y(0,i)=0);@for(chanpin(i):y(6,i)=50);!存储量约束;
@for(link(t,i):@gin(x(t,i));@gin(z(t,i));@gin(y(t,i));@bnd(0,y(t,i),100));!数据约束;
@for(link(t,i)|t#gt#1:g(t,i)=@sign(x(t,i)+y(t-1,i)+M(t,i)); z(t,i)=@if(g(t,i)#eq#1,M(t,i),x(t,i)+y(t,i));@free(g(t,i)));!供求关系约束;
end

声明声明:本网页内容为用户发布,旨在传播知识,不代表本网认同其观点,若有侵权等问题请及时与本网联系,我们将在第一时间删除处理。E-MAIL:11247931@qq.com