if the initial value necessary in time series constraint

Hi!

I wonder if the initial value necessary in time series constraint.
When I tried my modeling, I give the set as /1*8/
and I have the balance inventory constraints such as the following.
E_DO2(t)…DD(t)=l=DU(t)-(DIP(t)- DIN(t))-CU(t-1);
E_DI(t)…(DIP(t+1)-DIN(t+1))=e=(DIP(t)-DIN(t))+DD(t)+CU(t)-X(t);
as you can see, the time in left hand side is t+1. I thought the result will strat from DIP(2)and DIN(2) but there is a value for DIP(1)and DIN(1) in result.
Then, I tried to give DIP(1)and DIN(1) an initial value.
DIP.l(t)=0 or DIP.fx(“1”)=0
However, the result shows nonzero. I am very confused about it :frowning:

My question

  1. If my constraint starts from t+1, should I give the variable an initial value?
  2. Why the result showed different from the value which I give them? (DIP.l(t)=0 or DIP.fx(“1”)=0)
  3. What is the different between DIP.l(t)=0 or DIP.fx(“1”)=0 I tried both of them, and the result of DIP(3),DIP(4)…WILL DIFFERENT

I am appreciated that you can help me~~

Hi
You have the following equations:

E_DO2(t)..DD(t)=l=DU(t)-(DIP(t)- DIN(t))-CU(t-1);
E_DI(t)..(DIP(t+1)-DIN(t+1))=e=(DIP(t)-DIN(t))+DD(t)+CU(t)-X(t);

The first equation has a value for CU for the period CU(t-1) which is not part of the model. This equation should, therefore, start at t+1. You can do this by indexing it like this

E_DO2(t+1)..DD(t+1)=l=DU(t+1)-(DIP(t+1)- DIN(t+1))-CU(t);

or add a condition:

E_DO2(t)$(ord(t) > 1) ..DD(t)=l=DU(t)-(DIP(t)- DIN(t))-CU(t-1);

In both cases, if CU isn’t defined in another equation, you should give a known start value and fix the value accordingly.
For the second equation, the reasoning is the same.
Important is to find out, which variables are defined by the model, and which have to be fixed as they are not calculated in the model. This depends on what the other equations in your model define.

In a simple example of capital accumulation, you have to set the capital at the beginning of the time horizon.

K(t+1) =E= K(t) + I(t)

In most models, the capital for the first period is not a part of the solution but given as the starting capital in the economy.

By the way, you can have a look at which equations are used by Gams by setting the LIMROW option to the number of time periods (it defaults to 3 equations). In your listing file you can then check if your equations are written the way you want. And how it writes the equation for the first and last periods. In your case, the equation for the period t+1 is simply dropped, as t+1 is not part of the model horizon and you will see no first equation.
I hope this helps
CHeers
Renger