1

I've been busy with a model, but I'm uncomfortable about the result because I think GAMS violates a constraint. What I want to tell to GAMS is:

"check demand first -> then check current stocks -> IF there is enough stocks sell from current stocks -> IF there is not enough stocks first buy (produce) then sell."

I think in the model GAMS does not obey any demand (sell), any minimum values and sells everything without buying any.

The model is hereinbelow:

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;

Thank you in advance for your support!

1 Answers1

0

You haven't set any demand constraints, and the only minimum values are the zero bounds from defining the variables as being positive.

What other constraint did you expect GAMS to obey?

Selling everything is the correct solution to the problem you have defined.

I also think this part is a mistake:

stck.up(i,t)=tcap;

You probably meant to write 'stock' rather than 'stck'. If this was a lower bound (writing 'lo' instead of 'up'), you would have a problem with a non-trivial solution, as you are adding a constraint that the warehouse should be filled to maximum capacity.

Martin Bonde
  • 536
  • 3
  • 11