用lingo实现,y(i)=y(j)时,x(i)不等于x(j)?
大哥大姐们:请问用lingo如何实现y(i)=y(j)时,x(i)不等于x(j)?lingo有这个功能吗?我试过了,但是不行,我的现有程序是:MODEL:data:M=7...
大哥大姐们:
请问用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)<d(i););
@for(ob(i)|i+1 #le#m:w(i)=@if(y(i)#eq#y(i+1),1,0));
@for(ob(i):w(i)*x(i)=0);
@for(demand(i):w(i)+x(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)?
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)<d(i););
@for(ob(i)|i+1 #le#m:w(i)=@if(y(i)#eq#y(i+1),1,0));
@for(ob(i):w(i)*x(i)=0);
@for(demand(i):w(i)+x(i)>1);
@for(demand(i):@gin(x(i)));
@for(demand(i):@gin(y(i)));
end
怎么用程序表示当y相同时,x不同? 展开
展开全部
改了一点,在逻辑上没有问题,但是就不是线性模型了,用全局最优器解。
你看看吧!
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)<d(i););
@for(ob(i)|i+1 #le#m:w(i)=@if(y(i)#eq#y(i+1),1,0));
@for(ob(i):w(i)*x(i)=0);
@for(demand(i):w(i)+x(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
你看看吧!
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)<d(i););
@for(ob(i)|i+1 #le#m:w(i)=@if(y(i)#eq#y(i+1),1,0));
@for(ob(i):w(i)*x(i)=0);
@for(demand(i):w(i)+x(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
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询