我的lingo程序哪里错了啊?

来源:百度知道 编辑:UC知道 时间:2024/05/17 02:57:36
model:
sets:
hp/1..12/:A,B,C,D,x,y,t,r,L;
endsets
data:
A=245.1916,284.1283,365.7021,427.249,437.3608,459.9476,433.4294,404.8342,359.2775,305.0403,225.6284,180.7868;
B=119.2088,145.4009,163.2084,175.7858,189.9004,189.9489,189.0502,178.184,162.3631,143.5265,118.484,127.4269;
C=66.5403,92.3014,76.9834,126.8677,137.8738,119.2908,128.6322,112.2805,106.1233,93.559,68.1415,49.8148;
D=44.0014,54.9536,42.69605,59.2862,49.0071,53.5132,60.3861,36.2401,51.006,42.4224,41.8066,57.1133;
enddata
max=@sum(hp(i):L(i));
@for(hp(i):L(i)=@if(18.5*x(i)+12*y(i) #le# 8870,2120*(18.5*x(i)+12*y(i)),8870*850+1270*(18.5*x(i)+12*y(i))));
@for(hp(i):18.5*x(i)<=11500);
@for(hp(i):12*y(i)<=8500);
t(1)=A(1)+B(1)+C(1)-x(1)+2350;
r(1)=D(1)+x(1)-y(1)+1420;
@for(hp(i)|i #NE# 12:t(i+1)=A(i+1)+B(i+1)+C(i+1)-x(i+1)+t(i));
@for(hp(i)|i #NE# 12:r(i+1)=D(i+1)+x(i+1)-y(i+1)+r(i));
@for(hp(i)|i #NE# 12:M=@if(A(i+1)+B(i+1)+C(i+1) #GE#

@for(hp(i):L(i)=@if(18.5*x(i)+12*y(i) #le# 8870,2120*(18.5*x(i)+12*y(i)),8870*850+1270*(18.5*x(i)+12*y(i))));
????18.5*x(i)+12*y(i)<=8870(还是<=后面那一串)那么L(i)到底等于多少??
我不知道,从来没用过@if
楼上错了.LINGO比LINDO功能强大得多

目标函数的位置应该在数据的上面吧?

刚学过一点点,好多东西我也不懂!

我们现在用lindo,这个比Lingo好用点,比较简洁!

你看书

这是lingo的提示:
LINGO was unable to find a solution that simultaneously satisfies all the constraints. Check the model consistency. Try dropping constraints until the problem goes away to get an idea of where the trouble may lie. Also, check the solution report.
大致意思是:模形找不到最优的解,你再仔细检察一下约束条件。