Stock Balance

Hi everyone… I’m having some problems about the logic to define the stock balance in a production planning problem…
the equation of the balance is: Ii, t-1 + Xit – Iit = dit i = 1, …, N, t = 0,1, …, T (2), in which i are the items and t the periods of time.
The thing is… I try to write it on GAMS like this: balancoestoquenormal(i,t)… E(i,t-1) + X(i,t) - E(i,t) =e= demanda(i,t) , which already has a problem when t=0, that’s why I made an specific equation for the period 0 (as the initial stock is 0): balancoestoqueinicial(i)… X(i,‘1’) - E(i,‘1’) =e= demanda(i,‘1’);
with that being said, I want to know how can I define the set “t” to be greater or equal than 2 in the first equation balancoestoquenormal(i,t)…
How do I write it? would it be balancoestoquenormal(i,t=g=2)?? because I want it to count from 2…
thank you!

Hi

You can use the $-sign to define the equations

balancoestoquenormal(i,t)$(ord(t) >1).. E(i,t-1) + X(i,t) - E(i,t) =e= demanda(i,t);

same thing for t > 2.

If you are not sure, which equations will appear in the model, you can use
option limrow = n
where n is the length of t.

If you write this equation without the $-condition:

balancoestoquenormal(i,t).. E(i,t-1) + X(i,t) - E(i,t) =e= demanda(i,t);

Gams will drop E(i,t-1) from the equation for the first period and that is not what you want.

Hope this helps.
Cheers
Renger