求助lingo达人,求不出可行解set:product/1,2,3,4,5,6/:x,y,p,q,m,arfa; endsets data:y=42,32,41,67,25,29; arfa=0.1,0.1,0.2,0.2,0.3,0.3; m= , , , , ,0; p= , , , , ,0; q=0, , , , , ; enddata m(1)=49-y(1)+x(1)+p(1)-q(1); m(2)=m(1)-y(2)+x(2)+p(2)-q(
来源:学生作业帮助网 编辑:六六作业网 时间:2024/12/23 11:25:14
求助lingo达人,求不出可行解set:product/1,2,3,4,5,6/:x,y,p,q,m,arfa; endsets data:y=42,32,41,67,25,29; arfa=0.1,0.1,0.2,0.2,0.3,0.3; m= , , , , ,0; p= , , , , ,0; q=0, , , , , ; enddata m(1)=49-y(1)+x(1)+p(1)-q(1); m(2)=m(1)-y(2)+x(2)+p(2)-q(
求助lingo达人,求不出可行解
set:product/1,2,3,4,5,6/:x,y,p,q,m,arfa; endsets data:y=42,32,41,67,25,29; arfa=0.1,0.1,0.2,0.2,0.3,0.3; m= , , , , ,0; p= , , , , ,0; q=0, , , , , ; enddata m(1)=49-y(1)+x(1)+p(1)-q(1); m(2)=m(1)-y(2)+x(2)+p(2)-q(2); m(3)=m(2)-y(3)+x(3)+p(3)-q(3); m(4)=m(3)-y(4)+x(4)+p(4)-q(4); m(5)=m(4)-y(5)+x(5)+p(5)-q(5); m(6)=m(5)-y(6)+x(6)+p(6)-q(6); min=@sum(product(i):0.5*x(i)^2*(1+arfa(i))+0.1*m(i)); @for(product(i):x(i)>=0;x(i)=0;m(i)>=0;p(i)>=0;q(i)>=0;@gin(x(i));@gin(y(i));@gin(m(i));@gin(p(i));@gin(q(i))); 去掉X
求助lingo达人,求不出可行解set:product/1,2,3,4,5,6/:x,y,p,q,m,arfa; endsets data:y=42,32,41,67,25,29; arfa=0.1,0.1,0.2,0.2,0.3,0.3; m= , , , , ,0; p= , , , , ,0; q=0, , , , , ; enddata m(1)=49-y(1)+x(1)+p(1)-q(1); m(2)=m(1)-y(2)+x(2)+p(2)-q(
结果不正确,那只能说明你的模型有问题了
或者是你那边漏掉约束条件没编出来.
LS的第二段代码中@for(product(i):m(i+1) = m(i) - y(i) + x(i) + p(i) - q(i));会出现属性下标越界的,应该用if来加限制或分开写
没问题啊(帮你把前面几个约束条件整合到一句了,另外lingo默认变量非负,限制非负的可以省略不写)
sets:
product/1,2,3,4,5,6/:x,y,p,q,m,arfa;
endsets
data:
y=42,32,41,67,25,29;
arfa=0.1,0.1,0.2,0.2,0.3,0.3;
m= , , , , ,0;
p= , , , , ,0;
q=0, , , , , ;
enddata
@for(product(i):m(i)=@if(i#eq#1,49,m(i-1))-y(i)+x(i)+p(i)-q(i));
min=@sum(product(i):0.5*x(i)^2*(1+arfa(i))+0.1*m(i));
@for(product(i):x(i)