LINGO问题
model:sets:jumin/1,2,3,4/;shuiku/1..3/:S;var/1,2/;gongshui(shuiku,jumin):X,P,A;yongsh...
model:
sets:
jumin/1,2,3,4/;
shuiku/1..3/:S;
var/1,2/;
gongshui(shuiku,jumin):X,P,A;
yongshui(var,jumin):R;
endsets
data:
S=50,60,50;
P=160,130,220,170,
140,130,190,150,
190,200,230,0;
A=1,1,1,1,
1,1,1,1,
1,1,1,0;
R=30 70 10 10
50 70 20 40;
enddata
max=450*(@sum(gongshui:X))-@sum(gongshui:P*X);
@for(shuiku(i):@sum(jumin(j):X(i,j)*A(i,j))<=S(i));
@for(jumin(j):@sum(shuiku(i):X(i,j)*A(i,j))>=R(1,j);
@sum(shuiku(i):X(i,j)*A(i,j))<=R(1,j)+R(2,j););
end 展开
sets:
jumin/1,2,3,4/;
shuiku/1..3/:S;
var/1,2/;
gongshui(shuiku,jumin):X,P,A;
yongshui(var,jumin):R;
endsets
data:
S=50,60,50;
P=160,130,220,170,
140,130,190,150,
190,200,230,0;
A=1,1,1,1,
1,1,1,1,
1,1,1,0;
R=30 70 10 10
50 70 20 40;
enddata
max=450*(@sum(gongshui:X))-@sum(gongshui:P*X);
@for(shuiku(i):@sum(jumin(j):X(i,j)*A(i,j))<=S(i));
@for(jumin(j):@sum(shuiku(i):X(i,j)*A(i,j))>=R(1,j);
@sum(shuiku(i):X(i,j)*A(i,j))<=R(1,j)+R(2,j););
end 展开
展开全部
你把矩阵相乘的原理搞错了,一个3*4的矩阵无法乘以一个3*4的矩阵,只能乘以一个4*3的矩阵,你把矩阵x定义为4*3的就行了。
model:
sets:
jumin/1..4/;
shuiku/1..3/:S;
var/1,2/;
gongshui(shuiku,jumin):A,P;
gg(jumin,shuiku):X;
kk(shuiku,shuiku):Q;
yongshui(var,jumin):R;
endsets
data:
S=50,60,50;
P=160,130,220,170,
140,130,190,150,
190,200,230,0;
A=1,1,1,1,
1,1,1,1,
1,1,1,0;
R=30 70 10 10
50 70 20 40;
@text()=@status();
enddata
max=450*(M-N);
M=@sum(gg:x);
@for(kk(i,j):q(i,j)=@sum(jumin(k):P(i,k)*X(k,j)));
N=@sum(kk:q);
@for(shuiku(i):@sum(jumin(j):X(j,i)*A(i,j))<=S(i));
@for(jumin(j):@sum(shuiku(i):X(j,i)*A(i,j))>=R(1,j);
@sum(shuiku(i):X(j,i)*A(i,j))<=R(1,j)+R(2,j););
end
model:
sets:
jumin/1..4/;
shuiku/1..3/:S;
var/1,2/;
gongshui(shuiku,jumin):A,P;
gg(jumin,shuiku):X;
kk(shuiku,shuiku):Q;
yongshui(var,jumin):R;
endsets
data:
S=50,60,50;
P=160,130,220,170,
140,130,190,150,
190,200,230,0;
A=1,1,1,1,
1,1,1,1,
1,1,1,0;
R=30 70 10 10
50 70 20 40;
@text()=@status();
enddata
max=450*(M-N);
M=@sum(gg:x);
@for(kk(i,j):q(i,j)=@sum(jumin(k):P(i,k)*X(k,j)));
N=@sum(kk:q);
@for(shuiku(i):@sum(jumin(j):X(j,i)*A(i,j))<=S(i));
@for(jumin(j):@sum(shuiku(i):X(j,i)*A(i,j))>=R(1,j);
@sum(shuiku(i):X(j,i)*A(i,j))<=R(1,j)+R(2,j););
end
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询