回 帖 发 新 帖 刷新版面

主题:lingo高手过来看看!!!

data:
a=  0.3096    0.4485    -0.0167    2.1279   -0.5783    0.7833    1.7064
    0.7319    0.3939    0.9724    0.3619    1.0159    0.8719    2.7302
    0.5624    0.4364    1.9492   -0.6544   -0.2483    2.0649   -0.5439
    0.2636    0.3911    1.0063    1.6944    0.8807    0.3874    2.3895
    0.5209    0.3821    1.3142   -1.0841    1.7369   -0.7481   -1.0064;
b=  0.1472    0.1521    0.2333    0.2942    0.6990    0.7515   18.4486    2.4940
    0.1843    0.1896    0.2513    0.3317    0.7370    1.3867   -4.2770   -1.1981
    0.1037    0.1855    0.2556    0.3082   -0.1614    1.4925   -4.8448   -1.3717
    0.1445    0.2107    0.5192    0.2598    1.0399    1.2999    2.8296    5.1860
    0.1817    0.2458    0.5164    0.3210    1.2155    1.3099   -9.6076    2.6736;
capacity=6 6 3.5 3  3 4 3 3;


enddata


sets:
  year/y1..y5/;
 item/x1..x8/:invest,plofit,capacity ;
 links(year,item): invest,plofit;
endsets
!目标函数;
  max=@for(year(5):
@sum(links(5,J):invest(5,J)*plofit(5,J)));
!需求约束;
@for(links(I,5):invest(I,5)=0.05);
@for(item(J):invest(J)<=capacity(J));
@for(links(I,J):@if(invest(I,1)>2,K=20+invest(I,1)*0.01,K=20));
@for(links(I,J):@sum(invest(I,J))<=K);
@for(links(I,1):plofit(I,1)=b(I,1));
@for(links(I,2):plofit(I,2)=b(I,2));
@for(links(I,7):plofit(I,7)=b(I,7));

@for(links(I):@if(invest(I,3)*invest(I,4) #gt# 0,plofit(I,3)=a(I,1),plofit(I,3)=b(I,3)));
@for(links(I):@if(invest(I,3)*invest(I,4) #gt# 0,plofit(I,4)=a(I,2),plofit(I,4)=b(I,4)));
@for(links(I):@if(invest(I,5)*invest(I,6) #gt# 0,plofit(I,5)=a(I,3),plofit(I,5)=b(I,5)));
@for(links(I):@if(invest(I,5)*invest(I,6) #gt# 0,plofit(I,6)=a(I,4),plofit(I,6)=b(I,6)));
@for(links(I):@if(invest(I,5)*invest(I,6)*invest(I,8) #gt# 0,plofit(I,5)=a(I,5),plofit(I,5)=b(I,5)));
@for(links(I):@if(invest(I,5)*invest(I,6)*invest(I,8) #gt# 0,plofit(I,6)=a(I,6),plofit(I,6)=b(I,6)));
@for(links(I):@if(invest(I,5)*invest(I,6)*invest(I,8) #gt# 0,plofit(I,8)=a(I,7),plofit(I,8)=b(I,8)));
end


程序哪出错。。。。还有想问下lingo里边得数组问题1!!!高手留个QQ啊

回复列表 (共1个回复)

沙发

高手过来帮忙!!!!

我来回复

您尚未登录,请登录后再回复。点此登录或注册