lingo中if语言怎么用啊?求大神帮忙!
model:sets:mydata/1,2,3,4,5,6/:bk,ak,supply,stock;endsets@for(mydata(i):@if(i#eq#1,st...
model:
sets:
mydata/1,2,3,4,5,6/:bk,ak,supply,stock;
endsets
@for(mydata(i):
@if(i#eq#1,stock(i)=2+supply(i)-bk(i));
@if(i#gt#2,stock(i)=stock(i-1)+supply(i)-bk(i));
我想令初始库存stock=2;然后下一个库存stock=上一个库存+supply(i)-bk(i);
怎么写啊????急···
sets:
mydata/1,2,3,4,5,6/:need,time,supply,stock;
endsets
min=@sum(mydata(i):time(i)*supply(i));
@for(mydata(i):
supply(i)>=need(i);
stock(i)<=9);
stock(1)=2+supply(1)-need(1);
@for(mydata(i)|i#gt#1: stock(i)=stock(i-1)+supply(i)-need(i));
stock(6)<=0;
data:
need= 8 5 3 2 7 4;
time=11 18 13 17 20 10;
enddata
end 展开
sets:
mydata/1,2,3,4,5,6/:bk,ak,supply,stock;
endsets
@for(mydata(i):
@if(i#eq#1,stock(i)=2+supply(i)-bk(i));
@if(i#gt#2,stock(i)=stock(i-1)+supply(i)-bk(i));
我想令初始库存stock=2;然后下一个库存stock=上一个库存+supply(i)-bk(i);
怎么写啊????急···
sets:
mydata/1,2,3,4,5,6/:need,time,supply,stock;
endsets
min=@sum(mydata(i):time(i)*supply(i));
@for(mydata(i):
supply(i)>=need(i);
stock(i)<=9);
stock(1)=2+supply(1)-need(1);
@for(mydata(i)|i#gt#1: stock(i)=stock(i-1)+supply(i)-need(i));
stock(6)<=0;
data:
need= 8 5 3 2 7 4;
time=11 18 13 17 20 10;
enddata
end 展开
1个回答
展开全部
stock(1)=2+supply(1)-bk(1);
@for(mydata(i)|i#gt#1: stock(i)=stock(i-1)+supply(i)-bk(i));
@for(mydata(i)|i#gt#1: stock(i)=stock(i-1)+supply(i)-bk(i));
追问
大哥,谢谢啊,但是我的程序还是运行不出来,能帮帮我吗?
追答
sets:
mydata/1,2,3,4,5,6/:need,time,supply,stock;
endsets
min=@sum(mydata(i):time(i)*supply(i));
@for(mydata(i):
stock(i)=need那个约束根本就不对 去掉就行了 那个是没有可行解 自己好好想想
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询