作业帮 > 综合 > 作业

用lingo实现,y(i)=y(j)时,x(i)不等于x(j)?

来源:学生作业帮 编辑:大师作文网作业帮 分类:综合作业 时间:2024/11/18 08:58:50
用lingo实现,y(i)=y(j)时,x(i)不等于x(j)?
大哥大姐们:
请问用lingo如何实现y(i)=y(j)时,x(i)不等于x(j)?
lingo有这个功能吗?
我试过了,但是不行,我的现有程序是:
MODEL:
data:
M=7;
enddata
sets:
demand/1..m/:p,a,d,x,y;
ob/1..m/:w;
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)));
end
怎么用程序表示当y相同时,x不同?
用lingo实现,y(i)=y(j)时,x(i)不等于x(j)?
改了一点,在逻辑上没有问题,但是就不是线性模型了,用全局最优器解.
你看看吧!
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