multi item inventory routing problem in gams

Problems with modeling
Post Reply
irem
User
User
Posts: 2
Joined: 1 month ago

multi item inventory routing problem in gams

Post by irem » 1 month ago

Hi,
I had to solve a demo problem GAMS to use in my MS thesis. Since I did not know GAMS well, I encountered some problems / errors. I was gonna ask you to help me with this. First I have written the GAMS problem in order to be understandable in ANNEX 1 and the mathematical model is given in ANNEX 2. In my Gams model I have some letters that are different from the mathematical model. These are;
• Since i index is defined in GAMS, variable I (i, m, k) is entered as F (i, m, k). (In constraints 2,3 and 4). Because the model perceived the big I as a small i.
• Similarly, I defined Q (k) as O (k). (In constraint 8)
• Finally I defined the parameter C (i) as U (i). (In constraint 5,6 and 7)
I will have some questions within this information.
1) For example, in constraint 9, i <j in the first total, but in the second total j <i. How do I get this into GAMS?
2) If we look at constraints 4 and 5, should be in constraint 4 i ∈ V (V=0,1,2,…,n); in constraint 5 i ∈ V’ ( V’=1,2,…,n). How do I get this into GAMS?
3) in constraint 12 is not a binary variable. How will this constraint be defined in GAMS?
4) Finally, after entering the model I entered GAMS gave some errors that I could not fix. I'd appreciate it if you could help solve these problems.
Thank you.

ANNEX 1 : https://drive.google.com/file/d/1ZiE-dg ... sp=sharing

ANNEX 2 : https://drive.google.com/file/d/1FgBRDu ... sp=sharing

User avatar
bussieck
Moderator
Moderator
Posts: 208
Joined: 2 years ago

Re: multi item inventory routing problem in gams

Post by bussieck » 4 weeks ago

You need to learn more GAMS. There is lots of material out there, you might also find a GAMS buddy at your school to learn more. Since you made an effort and also provided specific questions and something to work with, here are a few comments:
  • if you write a model use good explanatory text for your symbols. If you plan to exchange your model internationally (as you do in this forum) use English (the text is also in English)
  • a variable type is for a entire symbol. So if some part of X is allowed to take value 2, you need to declare X as integer variables and for the ones that can only take 0 and 1, set an upper bound of 1. Not the other way around.
  • If you have V and V' make an i (0*3) and an iprime (1*3) and work with these in the model.
  • Be aware that equation 2 and 3 for t=1 uses T(.,m,t-1) which does not exist and hence the equation just has a 0 there.
  • Nested sums (sum(i,sum(m,sum(t,...)))) are much nicer written as sum((i,j,m,t),...)
  • Since F is declared as a positive variable, no need for constraint 4
  • If you need to restrict your sum indexes (e.g. i<j) you can either use a precalculated subset ij(i,j) that only contains the i-j pairs you want or you use a $() expression to limit the combination of indexes. With a simple i<j, I would do this with $(ord(i)<ord(j)). Since your i and j labels represent numbers you can also do $(i.val<j.val)
  • Since GAMS is case insensitive i and I is not distinguishable for the compiler. Rather than calling I F, I would rename to Icap or Ibig.
  • Constraint 10 is a hard one (independent of GAMS). You have to build all subsets of the set iprime. These are exponentially many. Even for small sets iprime is will be too much to generate apriori. In TSP these are the subtour elimination constraints and are usually generated on demand. There is a entire TSP sequence in the GAMS model library (see https://www.gams.com/latest/gamslib_ml/ ... _tsp1.html) that has various formulations of the TSP subtour elimination constraint. For your tiny model we can list them all. So I introduced a set s /s1*s7/ and a mapping set si / s1.i1, s2.i2, ... s7.(1,2,3)/. The troubles with this constraint are not over. The description say "for some g \in S". So can we select randomly any g in S (in the attached model I took the first i in S) or what does this mean?
  • After fixing all compilation errors the model runs but is infeasible. You should see if you (or I made) a mistake in the model algebra by providing a feasible solution (this should be easy for this tiny model). You can set the variable.l('1','2','3') = value to provide a solution. Now turn on the equation listing (option limrow=1e9;) and check in the equation listing for the INFEAS marker. These equations are not feasible for your provided "feasible" solution.
In any case I have attached the modified model.

Good luck!
-Michael
Attachments
ANNEX 1.gms
(3.07 KiB) Downloaded 24 times

irem
User
User
Posts: 2
Joined: 1 month ago

Re: multi item inventory routing problem in gams

Post by irem » 3 weeks ago

Your answer was very helpful. Thank you for your attention.

-Irem

Post Reply