Equations related to different values of a set Topic is solved

Problems with syntax of GAMS
Post Reply
ElPingu23
User
User
Posts: 2
Joined: 3 years ago

Equations related to different values of a set

Post by ElPingu23 »

Hey guys,

I'm a student using GAMS for a university project regarding nventory management. I'm still a beginner with GAMS so there's still a lot of errors that I make.
I have some restrictions that I need to set up, regarding the flow of inventory in a warehouse. The current inventory level (FI_i,j,t) should be equal to the level of the previous day (FI_i,j,t-1) plus the inventory coming from the factory today (SQ) and minus the inventory that is consumed today by customer demand (CD). The following print shows the mathematical formulation of these equations.
asd.png
So, the first equation is valid for t=1, where the inventory level from the previous day is substituted by the starting inventory level (ITo). The following days (t>1) are represented by the second equation, where the inventory level is based on the level of the previous day.

I'm having trouble regarding how to define the 't' set for these equations. Can anyone help me with a suggestion for the code?

Thank you very much
User avatar
Renger
Posts: 639
Joined: 7 years ago

Re: Equations related to different values of a set

Post by Renger »

Hi
You can write just one equation:

Code: Select all

set t /1*100/;
FI(i,j,t) =E= It0(i,j)$(t.val = 1) + FI(i,j,t-1)$(t.val > 1) ....
If your t set has numbers you can use t.val otherwise you should use ord(t).

Code: Select all

set t /y1*y100/;
FI(i,j,t) =E= It0(i,j)$(ord(t) = 1) + FI(i,j,t-1)$(ord(t)l > 1) ....
I hope this helps!
Cheers
Renger
____________________________________
Enjoy modeling even more: Read my blog on modeling at The lazy economist
ElPingu23
User
User
Posts: 2
Joined: 3 years ago

Re: Equations related to different values of a set

Post by ElPingu23 »

Hi Renger,

Your suggestion worked. Thanks a lot!
Post Reply