用Lingo编程 急

来自:    更新日期:早些时候
lingo编程出错!急用!很急。很急。。。~

model:
sets:
var/1..10/;
col/1..21/:x,p;
link(var,var):Ml,Md,Ld;
endsets
data:
Ld=0 26 31 17 41 15 20 45 35 1910
0 29 19 59 54 39 47 17 2320 28
0 27 36 31 39 12 37 2010 27 45
0 15 24 30 38 25 2542 36 21 39
0 33 56 24 44 5550 53 14 37 31
0 33 45 35 3031 37 38 49 12 30
0 25 40 3648 58 27 44 50 11 50
0 20 4039 51 12 12 38 26 31 36
0 3346 45 47 19 49 13 22 58 51
0 0 0 0 0 0 0 0 0 0;
enddata
min=@sum(col(i):p*x);
@for(var(i):@sum(var(j):ML(i,j))=1);
@for(var(j):@sum(var(i):ML(i,j))=1);
@for(link(i,j):@bin(ML));
@for(link(i,k)|i#ne#k:Md(i,k)>0);
@for(link(i,k):@for(link(j,l):Md(i,k)=@if((ML(i,j)*ML(k,l))#eq#1,Ld(j,l),Md(i,k))));
p(1)=282*(Md(1,2)+Md(2,3)+Md(3,5)+Md(5,7)+Md(7,8)+Md(8,10));
p(2)=282*(Md(3,4)+Md(4,5)+Md(5,6)+Md(6,7)+Md(7,8)+Md(8,9)+Md(9,10));
p(3)=261*(Md(1,4)+Md(4,10));
p(4)=261*(Md(1,4)+Md(4,8));
p(5)=261*(Md(1,4)+Md(4,9));
p(6)=277*(Md(4,5)+Md(5,6)+Md(6,8));
p(7)=277*(Md(4,5)+Md(5,6)+Md(6,7));
p(8)=277*(Md(4,5)+Md(5,7)+Md(7,9)+Md(9,10));
p(9)=218*(Md(2,3)+Md(3,4)+Md(4,5)+Md(5,6));
p(10)=218*(Md(2,3)+Md(3,4)+Md(4,5)+Md(5,7)+Md(7,8));
p(11)=218*(Md(2,3)+Md(3,4)+Md(4,5)+Md(5,7)+Md(7,10));
p(12)=397*(Md(4,5)+Md(5,7)+Md(7,8)+Md(8,10));
p(13)=397*(Md(4,5)+Md(5,8)+Md(8,9)+Md(9,10));
p(14)=397*(Md(4,5)+Md(5,8)+Md(8,10));
p(15)=451*(Md(1,2)+Md(2,3)+Md(3,4)+Md(4,5)+Md(5,6)+Md(6,7)+Md(7,8)+Md(8,9)+Md(9,10));
p(16)=388*(Md(4,5)+Md(5,7)+Md(7,9));
p(17)=388*(Md(5,6)+Md(6,8)+Md(8,9)+Md(9,10));
p(18)=388*(Md(5,6)+Md(6,7)+Md(7,8)+Md(8,9));
p(19)=389*(Md(8,9)+Md(9,10));
p(20)=389*(Md(6,7)+Md(7,8));
p(21)=389*(Md(3,4)+Md(4,5));
@for(col(i):@bin(x));
x(1)+x(2)=1;
x(3)+x(4)+x(5)=1;
x(6)+x(7)+x(8)=1;
x(9)+x(10)+x(11)=1;
x(12)+x(13)+x(14)=1;
x(15)=1;
x(16)+x(17)+x(18)=1;
x(19)+x(20)+x(21)=1;
end



这样就对了 都是些比较基础的错误,还有数据你少输了,把我最后一行那个所有的0给用你的数据替换掉

你的程序有的问题 xi取自然数为什么还要加符号函数呢?是不是有其它的意思,可以的话用百度找我一下

difference为正表示库存 为负表示迟交数
model:
sets:
production/1..3/:time,lackloss;
season/1..4/:;
link(production,season):demand,difference,produce;
endsets
data:
demand=
1500 1000 2000 1200
1500 1500 1200 1500
1000 2000 1500 2500;
lackloss=20 10 10;
time=2 4 3;
enddata
min=@sum(season(j):@sum(production(i):@if(difference(i,j)#ge#0,5*difference(i,j),-lackloss(i)*difference(i,j))));
@for(production(i):
difference(i,1)=produce(i,1)-demand(i,1);
@for(season(j)|j#gt#1:difference(i,j)=difference(i,j-1)+produce(i,j)-demand(i,j)));
@for(season(j):@sum(production(i):produce(i,j)*time(i))<=15000);
@for(production(i):difference(i,4)=150);
@for(link:@free(difference);@gin(produce));
end


用Lingo编程 急视频

相关评论:

相关主题精彩

版权声明:本网站为非赢利性站点,内容来自于网络投稿和网络,若有相关事宜,请联系管理员

Copyright © 喜物网