1
我一直忙於模型,但我對結果感到不舒服,因爲我認爲GAMS違反了約束。我想告訴GAMS是:如果在GAMS中的功能
「先檢查需求 - >然後檢查當前的股票 - >IF有足夠的庫存從目前的銷售庫存 - >IF有沒有足夠的股票先買(生產)然後賣。「
我認爲在模型中,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;
預先感謝您的支持!