lingo对excel中矩阵的转置操作出错 代码如下:
代码:model:sets:var_i/1..1000/:a;var_j/1..100/:b;links1(var_i,var_j):x,c,m;!1000*100;li...
代码:
model:
sets:
var_i/1..1000/:a;
var_j/1..100/:b;
links1(var_i,var_j):x,c,m;!1000*100;
links2(var_j,var_i):n,x2;!100*1000;
endsets
data:
a=@ole('A.xls',dataa1);
b=@ole('A.xls',dataa2);
m=@ole('m.xls',datam2);
n=@ole('m.xls',datam2);
c=@ole('n.xls',datac1);
enddata
@for(links2(i,j):x2(i,j)=x(j,i));!矩阵的转置;
max=@sum(var_j(j):@sum(var_i(i):c(i,j)*x(i,j)));
@for(var_j(j):@sum(var_i(i):n(j,i)*x2(i,j))<=b(j));
@for(var_i(i):@sum(var_j(j):m(i,j)*x(i,j))=a(i));
@for(var_j(j):@for(var_i(i):x(i,j)>=0));
@for(var_j(j):@for(var_i(i):x(i,j)<=1));
@for(var_j(j):@for(var_i(i):@gin(x(i,j))));
end 展开
model:
sets:
var_i/1..1000/:a;
var_j/1..100/:b;
links1(var_i,var_j):x,c,m;!1000*100;
links2(var_j,var_i):n,x2;!100*1000;
endsets
data:
a=@ole('A.xls',dataa1);
b=@ole('A.xls',dataa2);
m=@ole('m.xls',datam2);
n=@ole('m.xls',datam2);
c=@ole('n.xls',datac1);
enddata
@for(links2(i,j):x2(i,j)=x(j,i));!矩阵的转置;
max=@sum(var_j(j):@sum(var_i(i):c(i,j)*x(i,j)));
@for(var_j(j):@sum(var_i(i):n(j,i)*x2(i,j))<=b(j));
@for(var_i(i):@sum(var_j(j):m(i,j)*x(i,j))=a(i));
@for(var_j(j):@for(var_i(i):x(i,j)>=0));
@for(var_j(j):@for(var_i(i):x(i,j)<=1));
@for(var_j(j):@for(var_i(i):@gin(x(i,j))));
end 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询