以下是用lingo写的程序,但不能运行,格式有错吗?请问错在哪里了?

问题描述:

以下是用lingo写的程序,但不能运行,格式有错吗?请问错在哪里了?
model:
sets:
number/1..32/:A,x,a,z;
endsets
max= @sum(number(j):(A(j)-1)*x(j)*a(j)) ;
@for(number(j):x(j)*(A(j)-1)=0,A(j)>=0,z(j)>=0);
data:
x=60,15,35,10,12.5,75,7.5,90,100,50,110,30,40,37.5,40,25,15,12.5,25,25,30,15,15,40,10,30,35,40,60,75,22.5,40;
z=500,130,200,30,60,800,10,500,400,300,1000,80,1500,1000,500,300,200,100,700,2000,300,200,600,500,100,400,600,700,1000,3000,1500,1200;
enddata
end

错误很多 最好能自己仔细阅读lingo教程
1 lingo不区分大小写 所以你的A和a重名
2 倒数第二个约束括号位置错了
3 最后一个约束不必写 因为lingo默认变量非负 如果要写的话中间也应该是;而不是,
改成这样
model:
sets:
number/1..32/:A,x,a1,z;
endsets
max= @sum(number(j):(A(j)-1)*x(j)*a1(j));
@for(number(j):x(j)*(A(j)-1)