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:

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

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/

tcap           total capacity of warehouse /650000/

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

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);

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!

asked 02 Sep '16, 04:53

dregazz's gravatar image

accept rate: 0%

I'm not fluent in GAMS, but it looks as if, in the stck(i, t) constraint, you are adding in the initial stock repeatedly, in every period. The initial stock should count only in the first period.


answered 02 Sep '16, 16:12

Paul%20Rubin's gravatar image

Paul Rubin ♦♦
accept rate: 19%

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "Title")
  • image?![alt text](/path/img.jpg "Title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported



Asked: 02 Sep '16, 04:53

Seen: 870 times

Last updated: 02 Sep '16, 16:12

OR-Exchange! Your site for questions, answers, and announcements about operations research.