lingo代码什么错误?
发布网友
发布时间:2022-05-01 15:27
我来回答
共1个回答
热心网友
时间:2023-10-21 20:33
model:
title:第二题;
sets:
chanpin/1..7/:p,s,c,y0;!p价格,s标准差,c成本;
month/1..6/;
shebei/1..5/:W;
meishe/1..11/;!每一台具体的设备,共10台;
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;
yuemeishe(month,meishe):B;!t月份的具体每一台设备;
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):y0(i)=0);!存储量约束;
@for(link(t,i):@gin(x(t,i));@gin(z(t,i));@gin(y(t,i)));!数据约束;
@for(chanpin(i):g(1,i)=@sign(x(1,i)+y0(i)+M(1,i)); z(1,i)=@if(g(1,i)#eq#1,M(1,i),x(1,i)+y(1,i));@free(g(1,i)));
@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)));!供求关系约束;
@for(yuemeishe(t,l):@bin(B(t,l)));@sum(yuemeishe(t,l):B(t,l))=5;!维修约束;
@for(yuemeishe(t,l):@sum(chanpin(i):H(i,1)*x(t,i))<=(B(t,1)+B(t,2)+2)*24*30);
@for(yuemeishe(t,l):@sum(chanpin(i):H(i,2)*x(t,i))<=(B(t,5)+B(t,6)+2)*24*30);
@for(yuemeishe(t,l):@sum(chanpin(i):H(i,3)*x(t,i))<=(B(t,7)+B(t,8)+2)*24*30);
@for(yuemeishe(t,l):@sum(chanpin(i):H(i,4)*x(t,i))<=(B(t,9)+B(t,10)+2)*24*30);
@for(yuemeishe(t,l):@sum(chanpin(i):H(i,5)*x(t,i))<=(B(t,11)*24*30));
@for(yuemeishe(t,l):(B(t,1)+B(t,2)+B(t,3)+B(t,4))*5+(B(t,5)+B(t,6))*8+(B(t,7)+B(t,8)+B(t,9))*6+B(t,10)*8+B(t,11)*12<=72);
end
热心网友
时间:2023-10-21 20:33
model:
title:第二题;
sets:
chanpin/1..7/:p,s,c,y0;!p价格,s标准差,c成本;
month/1..6/;
shebei/1..5/:W;
meishe/1..11/;!每一台具体的设备,共10台;
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;
yuemeishe(month,meishe):B;!t月份的具体每一台设备;
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):y0(i)=0);!存储量约束;
@for(link(t,i):@gin(x(t,i));@gin(z(t,i));@gin(y(t,i)));!数据约束;
@for(chanpin(i):g(1,i)=@sign(x(1,i)+y0(i)+M(1,i)); z(1,i)=@if(g(1,i)#eq#1,M(1,i),x(1,i)+y(1,i));@free(g(1,i)));
@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)));!供求关系约束;
@for(yuemeishe(t,l):@bin(B(t,l)));@sum(yuemeishe(t,l):B(t,l))=5;!维修约束;
@for(yuemeishe(t,l):@sum(chanpin(i):H(i,1)*x(t,i))<=(B(t,1)+B(t,2)+2)*24*30);
@for(yuemeishe(t,l):@sum(chanpin(i):H(i,2)*x(t,i))<=(B(t,5)+B(t,6)+2)*24*30);
@for(yuemeishe(t,l):@sum(chanpin(i):H(i,3)*x(t,i))<=(B(t,7)+B(t,8)+2)*24*30);
@for(yuemeishe(t,l):@sum(chanpin(i):H(i,4)*x(t,i))<=(B(t,9)+B(t,10)+2)*24*30);
@for(yuemeishe(t,l):@sum(chanpin(i):H(i,5)*x(t,i))<=(B(t,11)*24*30));
@for(yuemeishe(t,l):(B(t,1)+B(t,2)+B(t,3)+B(t,4))*5+(B(t,5)+B(t,6))*8+(B(t,7)+B(t,8)+B(t,9))*6+B(t,10)*8+B(t,11)*12<=72);
end
热心网友
时间:2023-10-21 20:33
model:
title:第二题;
sets:
chanpin/1..7/:p,s,c,y0;!p价格,s标准差,c成本;
month/1..6/;
shebei/1..5/:W;
meishe/1..11/;!每一台具体的设备,共10台;
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;
yuemeishe(month,meishe):B;!t月份的具体每一台设备;
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):y0(i)=0);!存储量约束;
@for(link(t,i):@gin(x(t,i));@gin(z(t,i));@gin(y(t,i)));!数据约束;
@for(chanpin(i):g(1,i)=@sign(x(1,i)+y0(i)+M(1,i)); z(1,i)=@if(g(1,i)#eq#1,M(1,i),x(1,i)+y(1,i));@free(g(1,i)));
@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)));!供求关系约束;
@for(yuemeishe(t,l):@bin(B(t,l)));@sum(yuemeishe(t,l):B(t,l))=5;!维修约束;
@for(yuemeishe(t,l):@sum(chanpin(i):H(i,1)*x(t,i))<=(B(t,1)+B(t,2)+2)*24*30);
@for(yuemeishe(t,l):@sum(chanpin(i):H(i,2)*x(t,i))<=(B(t,5)+B(t,6)+2)*24*30);
@for(yuemeishe(t,l):@sum(chanpin(i):H(i,3)*x(t,i))<=(B(t,7)+B(t,8)+2)*24*30);
@for(yuemeishe(t,l):@sum(chanpin(i):H(i,4)*x(t,i))<=(B(t,9)+B(t,10)+2)*24*30);
@for(yuemeishe(t,l):@sum(chanpin(i):H(i,5)*x(t,i))<=(B(t,11)*24*30));
@for(yuemeishe(t,l):(B(t,1)+B(t,2)+B(t,3)+B(t,4))*5+(B(t,5)+B(t,6))*8+(B(t,7)+B(t,8)+B(t,9))*6+B(t,10)*8+B(t,11)*12<=72);
end
热心网友
时间:2023-10-21 20:33
model:
title:第二题;
sets:
chanpin/1..7/:p,s,c,y0;!p价格,s标准差,c成本;
month/1..6/;
shebei/1..5/:W;
meishe/1..11/;!每一台具体的设备,共10台;
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;
yuemeishe(month,meishe):B;!t月份的具体每一台设备;
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):y0(i)=0);!存储量约束;
@for(link(t,i):@gin(x(t,i));@gin(z(t,i));@gin(y(t,i)));!数据约束;
@for(chanpin(i):g(1,i)=@sign(x(1,i)+y0(i)+M(1,i)); z(1,i)=@if(g(1,i)#eq#1,M(1,i),x(1,i)+y(1,i));@free(g(1,i)));
@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)));!供求关系约束;
@for(yuemeishe(t,l):@bin(B(t,l)));@sum(yuemeishe(t,l):B(t,l))=5;!维修约束;
@for(yuemeishe(t,l):@sum(chanpin(i):H(i,1)*x(t,i))<=(B(t,1)+B(t,2)+2)*24*30);
@for(yuemeishe(t,l):@sum(chanpin(i):H(i,2)*x(t,i))<=(B(t,5)+B(t,6)+2)*24*30);
@for(yuemeishe(t,l):@sum(chanpin(i):H(i,3)*x(t,i))<=(B(t,7)+B(t,8)+2)*24*30);
@for(yuemeishe(t,l):@sum(chanpin(i):H(i,4)*x(t,i))<=(B(t,9)+B(t,10)+2)*24*30);
@for(yuemeishe(t,l):@sum(chanpin(i):H(i,5)*x(t,i))<=(B(t,11)*24*30));
@for(yuemeishe(t,l):(B(t,1)+B(t,2)+B(t,3)+B(t,4))*5+(B(t,5)+B(t,6))*8+(B(t,7)+B(t,8)+B(t,9))*6+B(t,10)*8+B(t,11)*12<=72);
end