弄好再追加50分,数学建模高手请进看这程序哪里出错,说中北大学今年复合肥料生产的题目,我用的说lingo。
题目如下:其实思路也很简单,就是定义AB矩阵代表采购和加工的矩阵,然后M代表每个月的费用,建立一些方程,只是不知道为什么说我M已经存在要我重新换一个名字,我只是给M矩阵赋...
题目如下:
其实思路也很简单,就是定义AB矩阵代表采购和加工的矩阵,然后M代表每个月的费用,建立一些方程,只是不知道为什么说我M已经存在要我重新换一个名字,我只是给M矩阵赋值啊,错误多多还望哪位高手给小弟解决下,由于没用过这lingo还望不要见笑,急。
model:
sets:
i/1..5/;
j/1..6/;
m/1..5/;
n/1..6/;
link(i,j):A,B,M;
endsets
data:
M=1650,1800,1950,1650,1725
1950,1950,1650,1350,1725
1650,2100,1950,1500,1425
1800,1650,1800,1800,1875
1500,1800,2250,1650,1575
1350,1500,2100,1200,2025;
enddata
max=Y3-Y1-Y2;
Y1=(A(1,1)*M(1,1)+A(1,2)*M(1,2)+A(1,3)*M(1,3)+A(1,4)*M(1,4)+A(1,5)*M(1,5)+
A(2,1)*(1+x*0.01)*M(2,1)+A(2,2)*(1+x*0.01)*M(2,2)+A(2,3)*(1+2*x*0.01)*M(2,3)+A(2,4)*(1+2*x*0.01)*M(2,4)+A(2,5)*(1+2*x*0.01)*M(2,5)+
A(3,1)*(1+2*x*0.01)*M(3,1)+A(3,2)*(1+2*x*0.01)*M(3,2)+A(3,3)*(1+4*x*0.01)*M(3,3)+A(3,4)*(1+4*x*0.01)*M(3,4)+A(3,5)*(1+4*x*0.01)*M(3,5)+
A(4,1)*(1+3*x*0.01)*M(4,1)+A(4,2)*(1+3*x*0.01)*M(4,2)+A(4,3)*(1+6*x*0.01)*M(4,3)+A(4,4)*(1+6*x*0.01)*M(4,4)+A(4,5)*(1+6*x*0.01)*M(4,5)+
A(5,1)*(1+4*x*0.01)*M(6,1)+A(5,2)*(1+4*x*0.01)*M(5,2)+A(5,3)*(1+8*x*0.01)*M(5,3)+A(5,4)*(1+8*x*0.01)*M(5,4)+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*5.0%)/( B(n,1)+B(n,2)+B(n,3)+B(n,4)+B(n,5))<=6%);
@for(n:(B(n,1)*8.8%+B(n,2)*6.1%+B(n,3)*2.0%+B(n,4)*4.2%+B(n,5)*5.0%)/( B(n,1)+B(n,2)+B(n,3)+B(n,4)+B(n,5))>=3%);
0=<x<=10; 展开
其实思路也很简单,就是定义AB矩阵代表采购和加工的矩阵,然后M代表每个月的费用,建立一些方程,只是不知道为什么说我M已经存在要我重新换一个名字,我只是给M矩阵赋值啊,错误多多还望哪位高手给小弟解决下,由于没用过这lingo还望不要见笑,急。
model:
sets:
i/1..5/;
j/1..6/;
m/1..5/;
n/1..6/;
link(i,j):A,B,M;
endsets
data:
M=1650,1800,1950,1650,1725
1950,1950,1650,1350,1725
1650,2100,1950,1500,1425
1800,1650,1800,1800,1875
1500,1800,2250,1650,1575
1350,1500,2100,1200,2025;
enddata
max=Y3-Y1-Y2;
Y1=(A(1,1)*M(1,1)+A(1,2)*M(1,2)+A(1,3)*M(1,3)+A(1,4)*M(1,4)+A(1,5)*M(1,5)+
A(2,1)*(1+x*0.01)*M(2,1)+A(2,2)*(1+x*0.01)*M(2,2)+A(2,3)*(1+2*x*0.01)*M(2,3)+A(2,4)*(1+2*x*0.01)*M(2,4)+A(2,5)*(1+2*x*0.01)*M(2,5)+
A(3,1)*(1+2*x*0.01)*M(3,1)+A(3,2)*(1+2*x*0.01)*M(3,2)+A(3,3)*(1+4*x*0.01)*M(3,3)+A(3,4)*(1+4*x*0.01)*M(3,4)+A(3,5)*(1+4*x*0.01)*M(3,5)+
A(4,1)*(1+3*x*0.01)*M(4,1)+A(4,2)*(1+3*x*0.01)*M(4,2)+A(4,3)*(1+6*x*0.01)*M(4,3)+A(4,4)*(1+6*x*0.01)*M(4,4)+A(4,5)*(1+6*x*0.01)*M(4,5)+
A(5,1)*(1+4*x*0.01)*M(6,1)+A(5,2)*(1+4*x*0.01)*M(5,2)+A(5,3)*(1+8*x*0.01)*M(5,3)+A(5,4)*(1+8*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4)*4.2%+B(n,5)*5.0%)/( B(n,1)+B(n,2)+B(n,3)+B(n,4)+B(n,5))<=6%);
@for(n:(B(n,1)*8.8%+B(n,2)*6.1%+B(n,3)*2.0%+B(n,4)*4.2%+B(n,5)*5.0%)/( B(n,1)+B(n,2)+B(n,3)+B(n,4)+B(n,5))>=3%);
0=<x<=10; 展开
1个回答
展开全部
lingo里面不区分大小写的 你的集里面有一个名是m 又有个元素名为M 重名了不行 其它的错误也不少 不具体说了
model:
sets:
mm/1..5/;
nn/1..6/;
link(nn,mm):A,B,M0;
endsets
data:
M0= 1650,1800,1950,1650,1725
1950,1950,1650,1350,1725
1650,2100,1950,1500,1425
1800,1650,1800,1800,1875
1500,1800,2250,1650,1575
1350,1500,2100,1200,2025;
enddata
max=Y3-Y1-Y2;
Y1=(A(1,1)*M0(1,1)+A(1,2)*M0(1,2)+A(1,3)*M0(1,3)+A(1,4)*M0(1,4)+A(1,5)*M0(1,5)+
A(2,1)*(1+x*0.01)*M0(2,1)+A(2,2)*(1+x*0.01)*M0(2,2)+A(2,3)*(1+2*x*0.01)*M0(2,3)+A(2,4)*(1+2*x*0.01)*M0(2,4)+A(2,5)*(1+2*x*0.01)*M0(2,5)+
A(3,1)*(1+2*x*0.01)*M0(3,1)+A(3,2)*(1+2*x*0.01)*M0(3,2)+A(3,3)*(1+4*x*0.01)*M0(3,3)+A(3,4)*(1+4*x*0.01)*M0(3,4)+A(3,5)*(1+4*x*0.01)*M0(3,5)+
A(4,1)*(1+3*x*0.01)*M0(4,1)+A(4,2)*(1+3*x*0.01)*M0(4,2)+A(4,3)*(1+6*x*0.01)*M0(4,3)+A(4,4)*(1+6*x*0.01)*M0(4,4)+A(4,5)*(1+6*x*0.01)*M0(4,5)+
A(5,1)*(1+4*x*0.01)*M0(6,1)+A(5,2)*(1+4*x*0.01)*M0(5,2)+A(5,3)*(1+8*x*0.01)*M0(5,3)+A(5,4)*(1+8*x*0.01)*M0(5,4)+A(5,5)*(1+8*x*0.01)*M0(5,5)+
A(6,1)*(1+5*x*0.01)*M0(6,1)+A(6,2)*(1+5*x*0.01)*M0(6,2)+A(6,3)*(1+10*x*0.01)*M0(6,3)+A(6,4)*(1+10*x*0.01)*M0(6,4)+A(6,5)*(1+10*x*0.01)*M0(6,5))*75;
Y2=@sum(mm(m):(A(1,m)-B(1,m)+500)+
(A(1,m)-B(1,m)+500+A(2,m)-B(2,m))+
(A(1,m)-B(1,m)+500+A(2,m)-B(2,m)+A(3,m)-B(3,m))+
(A(1,m)-B(1,m)+500+A(2,m)-B(2,m)+A(3,m)-B(3,m)+A(4,m)-B(4,m))+
(A(1,m)-B(1,m)+500+A(2,m)-B(2,m)+A(3,m)-B(3,m)+A(4,m)-B(4,m)+ A(5,m)-B(5,m))+
(A(1,m)-B(1,m)+500+A(2,m)-B(2,m)+A(3,m)-B(3,m)+A(4,m)-B(4,m)+ A(5,m)-B(5,m)+A(6,m)-B(6,m)));
Y3=@sum(nn(n):(B(n,1)+B(n,2)+B(n,3)+B(n,4)+B(n,5))*2250);
@for(mm(m):A(1,m)-B(1,m)+500<=1000);
@for(mm(m):A(1,m)-B(1,m)+500+A(2,m)-B(2,m)<=1000);
@for(mm(m):A(1,m)-B(1,m)+500+A(2,m)-B(2,m)+A(3,m)-B(3,m)<=1000);
@for(mm(m):A(1,m)-B(1,m)+500+A(2,m)-B(2,m)+A(3,m)-B(3,m)+A(4,m)-B(4,m)<=1000);
@for(mm(m):A(1,m)-B(1,m)+500+A(2,m)-B(2,m)+A(3,m)-B(3,m)+A(4,m)-B(4,m)+ A(5,m)-B(5,m)<=1000);
@for(mm(m):A(1,m)-B(1,m)+500+A(2,m)-B(2,m)+A(3,m)-B(3,m)+A(4,m)-B(4,m)+ A(5,m)-B(5,m)+A(6,m)-B(6,m)<=1000);
@for(nn(n):B(n,1)+B(n,2)<=200);
@for(nn(n):B(n,3)+B(n,4)+B(n,5)<=250);
@for(nn(n):(B(n,1)*8.8/100+B(n,2)*6.1/100+B(n,3)*2.0/100+B(n,4)*4.2/100+B(n,5)*5.0/100)/( B(n,1)+B(n,2)+B(n,3)+B(n,4)+B(n,5))<=6/100);
@for(nn(n):(B(n,1)*8.8/100+B(n,2)*6.1/100+B(n,3)*2.0/100+B(n,4)*4.2/100+B(n,5)*5.0/100)/( B(n,1)+B(n,2)+B(n,3)+B(n,4)+B(n,5))>=3/100);
x<=10;
end
model:
sets:
mm/1..5/;
nn/1..6/;
link(nn,mm):A,B,M0;
endsets
data:
M0= 1650,1800,1950,1650,1725
1950,1950,1650,1350,1725
1650,2100,1950,1500,1425
1800,1650,1800,1800,1875
1500,1800,2250,1650,1575
1350,1500,2100,1200,2025;
enddata
max=Y3-Y1-Y2;
Y1=(A(1,1)*M0(1,1)+A(1,2)*M0(1,2)+A(1,3)*M0(1,3)+A(1,4)*M0(1,4)+A(1,5)*M0(1,5)+
A(2,1)*(1+x*0.01)*M0(2,1)+A(2,2)*(1+x*0.01)*M0(2,2)+A(2,3)*(1+2*x*0.01)*M0(2,3)+A(2,4)*(1+2*x*0.01)*M0(2,4)+A(2,5)*(1+2*x*0.01)*M0(2,5)+
A(3,1)*(1+2*x*0.01)*M0(3,1)+A(3,2)*(1+2*x*0.01)*M0(3,2)+A(3,3)*(1+4*x*0.01)*M0(3,3)+A(3,4)*(1+4*x*0.01)*M0(3,4)+A(3,5)*(1+4*x*0.01)*M0(3,5)+
A(4,1)*(1+3*x*0.01)*M0(4,1)+A(4,2)*(1+3*x*0.01)*M0(4,2)+A(4,3)*(1+6*x*0.01)*M0(4,3)+A(4,4)*(1+6*x*0.01)*M0(4,4)+A(4,5)*(1+6*x*0.01)*M0(4,5)+
A(5,1)*(1+4*x*0.01)*M0(6,1)+A(5,2)*(1+4*x*0.01)*M0(5,2)+A(5,3)*(1+8*x*0.01)*M0(5,3)+A(5,4)*(1+8*x*0.01)*M0(5,4)+A(5,5)*(1+8*x*0.01)*M0(5,5)+
A(6,1)*(1+5*x*0.01)*M0(6,1)+A(6,2)*(1+5*x*0.01)*M0(6,2)+A(6,3)*(1+10*x*0.01)*M0(6,3)+A(6,4)*(1+10*x*0.01)*M0(6,4)+A(6,5)*(1+10*x*0.01)*M0(6,5))*75;
Y2=@sum(mm(m):(A(1,m)-B(1,m)+500)+
(A(1,m)-B(1,m)+500+A(2,m)-B(2,m))+
(A(1,m)-B(1,m)+500+A(2,m)-B(2,m)+A(3,m)-B(3,m))+
(A(1,m)-B(1,m)+500+A(2,m)-B(2,m)+A(3,m)-B(3,m)+A(4,m)-B(4,m))+
(A(1,m)-B(1,m)+500+A(2,m)-B(2,m)+A(3,m)-B(3,m)+A(4,m)-B(4,m)+ A(5,m)-B(5,m))+
(A(1,m)-B(1,m)+500+A(2,m)-B(2,m)+A(3,m)-B(3,m)+A(4,m)-B(4,m)+ A(5,m)-B(5,m)+A(6,m)-B(6,m)));
Y3=@sum(nn(n):(B(n,1)+B(n,2)+B(n,3)+B(n,4)+B(n,5))*2250);
@for(mm(m):A(1,m)-B(1,m)+500<=1000);
@for(mm(m):A(1,m)-B(1,m)+500+A(2,m)-B(2,m)<=1000);
@for(mm(m):A(1,m)-B(1,m)+500+A(2,m)-B(2,m)+A(3,m)-B(3,m)<=1000);
@for(mm(m):A(1,m)-B(1,m)+500+A(2,m)-B(2,m)+A(3,m)-B(3,m)+A(4,m)-B(4,m)<=1000);
@for(mm(m):A(1,m)-B(1,m)+500+A(2,m)-B(2,m)+A(3,m)-B(3,m)+A(4,m)-B(4,m)+ A(5,m)-B(5,m)<=1000);
@for(mm(m):A(1,m)-B(1,m)+500+A(2,m)-B(2,m)+A(3,m)-B(3,m)+A(4,m)-B(4,m)+ A(5,m)-B(5,m)+A(6,m)-B(6,m)<=1000);
@for(nn(n):B(n,1)+B(n,2)<=200);
@for(nn(n):B(n,3)+B(n,4)+B(n,5)<=250);
@for(nn(n):(B(n,1)*8.8/100+B(n,2)*6.1/100+B(n,3)*2.0/100+B(n,4)*4.2/100+B(n,5)*5.0/100)/( B(n,1)+B(n,2)+B(n,3)+B(n,4)+B(n,5))<=6/100);
@for(nn(n):(B(n,1)*8.8/100+B(n,2)*6.1/100+B(n,3)*2.0/100+B(n,4)*4.2/100+B(n,5)*5.0/100)/( B(n,1)+B(n,2)+B(n,3)+B(n,4)+B(n,5))>=3/100);
x<=10;
end
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询