改了一点,在逻辑上没有问题,但是就不是线性模型了,用全局最优器解.
你看看吧!
MODEL:
data:
M=7;
enddata
sets:
demand/1..m/:p,a,d,x,y;
ob/1..m/:w;
link(demand,demand):aa;
endsets
data:
p=5,3,5,6,7,12,8;
a=3,4,4,1,5,8,8;
d=5,6,6,3,7,9,10;
enddata
[OBJ] min=@sum(demand(i):2*@abs(x(i)-p(i))+3*@abs(y(i)-a(i)));
@for(demand(i):
y(i)>a(i);
y(i)1);
@for(demand(i):@gin(x(i)));
@for(demand(i):@gin(y(i)));
@for(demand(i):
@for(demand(j)|j #ne# i:x(i)+y(i)=x(j)+y(j)+aa(i,j)));
@for(demand(i):
@for(demand(j):@free(aa(i,j))));
@for(link:
@free(aa));
@for(link:aa*aa>0);
end