1

我一直忙于模型,但我对结果感到不舒服,因为我认为 GAMS 违反了约束。我想对 GAMS 说的是:

“首先检查需求 -> 然后检查当前库存 ->如果现有库存中有足够的库存出售 ->如果没有足够的库存,首先购买(生产)然后出售。”

我认为在模型中 GAMS 不服从任何需求(卖出),任何最小值,并且不买任何东西就卖掉所有东西。

型号如下:

Sets
i  items /s,p,b/
t  time in quarters /1,2,3/

Parameters
price(i)       selling price per unit i per quarter in euros /s 6.34, p 6.46, b 5.93/
inistock(i)    initial stock in units /s 320000, p 296199, b 104208/
cap(i)         capacity limit for each unit /s 400000, p 350000, b 150000/
c              cost of holding 1 unit of i /s 10, p 15, b 12/

Scalars
tcap           total capacity of warehouse /650000/

Variables
stock(i,t)     stock stored at time t
sell(i,t)      stock sold at time t
buy(i,t)       stock bought at time t
cost           total cost

Positive Variables stock,sell,buy

Equations
cst            total cost occurs
stck(i,t)      stock balance of unit i at time t;

cst..         cost=e=sum((i,t),price(i)*(buy(i,t)-sell(i,t))+c(i)*stock(i,t));
stck(i,t)..   stock(i,t)=e=inistock(i)+stock(i,t-1)+buy(i,t)-sell(i,t);
stck.up(i,t)=tcap;

Option LP=Cplex ;

Option optcr=0;

Model TWH The Warehouse Problem / all /;

Solve TWH minimizing cost using lp;

预先感谢您对我们的支持!

4

1 回答 1

0

您没有设置任何需求约束,唯一的最小值是将变量定义为正数的零界限。

您希望 GAMS 遵守哪些其他约束?

出售所有东西是解决您定义的问题的正确方法。

我也认为这部分是一个错误:

stck.up(i,t)=tcap;

您可能打算写“stock”而不是“stck”。如果这是一个下限(写 'lo' 而不是 'up'),你会遇到一个非平凡的解决方案的问题,因为你正在添加一个约束,即仓库应该被填充到最大容量。

于 2016-11-29T12:28:06.213 回答